/* ===== CSS Variables & Base Styles ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --success-color: #38ef7d;
    --warning-color: #f5576c;
    --info-color: #4facfe;

    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);

    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===== Animated Background ===== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 50%, rgba(17, 153, 142, 0.1) 0%, transparent 40%);
    z-index: -2;
}

.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: float 15s ease-in-out infinite;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(102, 126, 234, 0.2);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: rgba(118, 75, 162, 0.2);
    bottom: 10%;
    left: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: rgba(17, 153, 142, 0.15);
    top: 40%;
    right: 20%;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    33% {
        transform: translateY(-30px) rotate(5deg);
    }

    66% {
        transform: translateY(20px) rotate(-5deg);
    }
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: pulse 3s ease-in-out infinite;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.6);
    }
}

.logo-text h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.year-badge {
    display: inline-block;
    background: var(--primary-gradient);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 4px;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-mini-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Stats Section ===== */
.stats-section {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.stat-card-primary::before {
    background: var(--primary-gradient);
}

.stat-card-success::before {
    background: var(--success-gradient);
}

.stat-card-warning::before {
    background: var(--warning-gradient);
}

.stat-card-info::before {
    background: var(--info-gradient);
}

.stat-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-large);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.stat-card-primary .stat-icon {
    background: var(--primary-gradient);
}

.stat-card-success .stat-icon {
    background: var(--success-gradient);
}

.stat-card-warning .stat-icon {
    background: var(--warning-gradient);
}

.stat-card-info .stat-icon {
    background: var(--info-gradient);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card-primary .stat-value {
    color: #a78bfa;
}

.stat-card-success .stat-value {
    color: #34d399;
}

.stat-card-warning .stat-value {
    color: #f472b6;
}

.stat-card-info .stat-value {
    color: #60a5fa;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 1s ease-out;
}

.stat-card-primary .progress-bar {
    background: var(--primary-gradient);
}

.stat-card-success .progress-bar {
    background: var(--success-gradient);
}

.stat-card-warning .progress-bar {
    background: var(--warning-gradient);
}

.stat-card-info .progress-bar {
    background: var(--info-gradient);
}

/* ===== Charts Section ===== */
.charts-section {
    margin-bottom: 30px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: fadeInUp 0.6s ease-out backwards;
}

.chart-card:nth-child(1) {
    animation-delay: 0.5s;
}

.chart-card:nth-child(2) {
    animation-delay: 0.6s;
}

.chart-card:nth-child(3) {
    animation-delay: 0.7s;
}

.chart-card:nth-child(4) {
    animation-delay: 0.8s;
}

.chart-card-wide {
    grid-column: span 1;
}

.chart-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-large);
}

.chart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.chart-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-header h3 svg {
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

.chart-body {
    padding: 24px;
    height: 300px;
    position: relative;
}

.chart-body-square {
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-body canvas {
    max-width: 100%;
    max-height: 100%;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-card-wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .chart-body {
        height: 250px;
        padding: 16px;
    }

    .chart-body-square {
        height: 280px;
    }
}

/* ===== Filters Section ===== */
.filters-section {
    margin-bottom: 30px;
}

.filters-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.search-wrapper {
    position: relative;
}

.search-wrapper svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.search-wrapper input:focus+svg,
.search-wrapper:focus-within svg {
    color: var(--primary-color);
}

input,
select {
    width: 100%;
    padding: 12px 16px;
    padding-right: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-fast);
    outline: none;
}

select {
    padding-right: 16px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

input::placeholder {
    color: var(--text-muted);
}

/* ===== Table Section ===== */
.table-section {
    margin-bottom: 30px;
}

.table-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.table-header h2 svg {
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

.table-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255, 255, 255, 0.03);
}

th {
    padding: 16px 20px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 18px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.status-badge.success {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

.status-badge.error {
    background: rgba(244, 114, 182, 0.2);
    color: #f472b6;
}

.status-badge:hover {
    transform: scale(1.15);
}

/* Amount styling */
.amount {
    font-weight: 600;
    font-family: 'Tajawal', monospace;
    color: #a78bfa;
}

/* Order number */
.order-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 32px;
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--border-radius-sm);
    padding: 0 10px;
}

/* Description cell */
.description-cell {
    max-width: 350px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.description-cell:hover {
    white-space: normal;
    overflow: visible;
}

/* Month badge */
.month-badge {
    display: inline-block;
    background: rgba(79, 172, 254, 0.2);
    color: #60a5fa;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ===== Pagination ===== */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 18px;
    height: 18px;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-number:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-number.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-size label {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-size select {
    width: auto;
    padding: 8px 12px;
    padding-left: 32px;
    min-width: 80px;
}

@media (max-width: 768px) {
    .pagination-wrapper {
        flex-direction: column;
        text-align: center;
    }

    .pagination-controls {
        order: -1;
    }

    .page-number,
    .pagination-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filters-card {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        gap: 12px;
    }

    th,
    td {
        padding: 12px 14px;
    }

    .description-cell {
        max-width: 200px;
    }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.filters-card,
.table-card {
    animation: fadeInUp 0.6s ease-out backwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.filters-card {
    animation-delay: 0.5s;
}

.table-card {
    animation-delay: 0.6s;
}

/* Loading animation for table rows */
tbody tr {
    animation: fadeInUp 0.4s ease-out backwards;
}

tbody tr:nth-child(1) {
    animation-delay: 0.7s;
}

tbody tr:nth-child(2) {
    animation-delay: 0.75s;
}

tbody tr:nth-child(3) {
    animation-delay: 0.8s;
}

tbody tr:nth-child(4) {
    animation-delay: 0.85s;
}

tbody tr:nth-child(5) {
    animation-delay: 0.9s;
}

tbody tr:nth-child(n+6) {
    animation-delay: 0.95s;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* No Data State */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-data svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-data p {
    font-size: 16px;
}