:root {
    --primary-color: #4f46e5;
    --secondary-color: #818cf8;
    --bg-color: #f3f4f6;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-color: #1f2937;
    --header-bg: #1e293b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(79, 70, 229, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    /* Keep background static */
    margin: 0;
    color: var(--text-color);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--header-bg);
    padding: 1rem 2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h2 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header a {
    color: inherit;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }

    .nav-links a {
        font-size: 0.9rem;
    }
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logout-btn {
    color: #fca5a5;
    text-decoration: none;
    transition: 0.3s;
}

.logout-btn:hover {
    color: #f87171;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeInDown 0.5s ease-out;
}

/* Forms */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.filter-form .form-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.filter-form .form-group label {
    margin-bottom: 0;
    white-space: nowrap;
}

.filter-form .form-control {
    width: auto;
    min-width: 150px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #4b5563;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.8);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

th {
    padding: 1rem;
    text-align: right;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

tbody tr {
    transition: all 0.2s;
}

tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges & Tags */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-blue {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-green {
    background: #dcfce7;
    color: #15803d;
}

.badge-red {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-gray {
    background: #f3f4f6;
    color: #4b5563;
}

.price-tag {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Cards Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-card h2 {
    color: var(--text-color);
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    opacity: 0.8;
}

/* Action Buttons Group */
.action-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-edit {
    background: #fef3c7;
    color: #d97706;
}

.btn-edit:hover {
    background: #fde68a;
}

.btn-delete {
    background: #fee2e2;
    color: #dc2626;
}


/* Responsive Utilities */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header h2 {
        font-size: 1.25rem;
    }

    .nav-links {
        overflow-x: auto;
        padding-bottom: 0.5rem;
        width: 100%;
        justify-content: flex-start;
        /* Allow scroll on very small screens */
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links::-webkit-scrollbar {
        height: 3px;
    }

    .nav-links::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 10px;
    }

    .nav-links a {
        white-space: nowrap;
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Form stacking */
    .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-form .form-group {
        margin-bottom: 0;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-form .form-control {
        width: 100%;
        min-width: 0;
    }

    .filter-form .btn {
        width: 100%;
    }

    /* Stack flex containers on mobile */
    .glass-card>div[style*="display:flex"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .glass-card>div[style*="display:flex"] .btn {
        width: 100%;
    }

    /* Stack grid layouts */
    .dashboard-grid,
    div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* Mobile Table Handling */
@media (max-width: 640px) {

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .price-tag {
        font-size: 0.85rem;
        padding: 0.2rem 0.6rem;
    }

    .action-btns {
        justify-content: center;
    }

    /* Card view for tables on very small screens if needed, 
       but table-responsive usually handles it well enough.
       Adding wrapper class.
    */
}

/* Utility Classes */
.w-100 {
    width: 100% !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.gap-1 {
    gap: 1rem !important;
}

.d-flex-col-mobile {
    display: flex;
}

@media(max-width: 768px) {
    .d-flex-col-mobile {
        flex-direction: column;
    }

    .header-main {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .filter-actions {
        width: 100%;
        flex-direction: column;
    }
}