/* ============================================================
   CSS VARIABLES — ركز هنا لتغيير الألوان بسهولة
   ============================================================ */
:root {
    --clr-primary: #602650; /* اللون الأساسي */
    --clr-primary-light: #8a3a75; /* درجة أفتح */
    --clr-primary-dark: #3d1833; /* درجة أغمق */
    --clr-primary-xlight: #b06fa0; /* درجة أفتح جداً للـ hover */

    --clr-accent: #a03d88; /* accent من نفس الثيم */

    --clr-bg: #faf7f9; /* خلفية الصفحة مع نبضة بنفسجية خفيفة */
    --clr-surface: #FFFFFF;
    --clr-text: #1A1A2E;
    --clr-text-muted: #7a6a75; /* muted بنبضة من اللون الأساسي */
    --clr-border: #e8dde5; /* border بنبضة بنفسجية خفيفة */
    --clr-danger: #E74C3C;
    --clr-success: #27AE60;
    --shadow-sm: 0 1px 4px rgba(96,38,80,.07);
    --shadow-md: 0 4px 16px rgba(96,38,80,.12);
    --shadow-lg: 0 8px 32px rgba(96,38,80,.18);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --transition: 0.22s ease;
    --font-main: 'Tajawal', sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    background: var(--clr-surface) !important;
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 0;
    transition: box-shadow var(--transition);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--clr-primary) !important;
    letter-spacing: -0.5px;
    position: relative;
}

    .navbar-brand::after {
        content: '';
        position: absolute;
        bottom: 2px;
        right: 0;
        width: 6px;
        height: 6px;
        background: var(--clr-accent);
        border-radius: 50%;
    }

.nav-link {
    color: var(--clr-text) !important;
    font-weight: 500;
    padding: 0.4rem 0.9rem !important;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

    .nav-link:hover {
        background: rgba(96, 38, 80, 0.08);
        color: var(--clr-primary) !important;
    }

    .nav-link.active {
        color: var(--clr-primary) !important;
        background: rgba(96, 38, 80, 0.12);
    }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    background: var(--clr-surface);
    color: var(--clr-text-muted);
    font-size: 0.875rem;
    padding: 1.25rem 0;
    border-color: var(--clr-border) !important;
}

    .footer a {
        color: var(--clr-primary-light);
        text-decoration: none;
        transition: color var(--transition);
    }

        .footer a:hover {
            color: var(--clr-accent);
        }

/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */
.text-primary-custom {
    color: var(--clr-primary) !important;
}

.text-accent {
    color: var(--clr-accent) !important;
}

.text-muted-custom {
    color: var(--clr-text-muted) !important;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--clr-text);
}

.page-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--clr-primary);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--clr-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--clr-accent);
    display: inline-block;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-family: var(--font-main);
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.4rem;
    transition: all var(--transition);
    border: none;
}

.btn-primary {
    background: var(--clr-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(96,38,80,.28);
}

    .btn-primary:hover {
        background: var(--clr-primary-light);
        box-shadow: 0 4px 14px rgba(96,38,80,.38);
        transform: translateY(-1px);
    }

.btn-accent {
    background: var(--clr-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(160,61,136,.28);
}

    .btn-accent:hover {
        filter: brightness(1.08);
        transform: translateY(-1px);
    }

.btn-outline-primary {
    border: 2px solid var(--clr-primary) !important;
    color: var(--clr-primary) !important;
    background: transparent;
}

    .btn-outline-primary:hover {
        background: var(--clr-primary) !important;
        color: #fff !important;
    }

.btn-sm {
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.7rem 2rem;
    font-size: 1.1rem;
}

.btn-pill {
    border-radius: var(--radius-pill);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

    .card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--clr-border);
    font-weight: 700;
    color: var(--clr-primary);
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--clr-border);
    padding: 0.85rem 1.25rem;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    font-family: var(--font-main);
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.9rem;
    color: var(--clr-text);
    background: var(--clr-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

    .form-control:focus, .form-select:focus {
        border-color: var(--clr-primary-light);
        box-shadow: 0 0 0 3px rgba(96,38,80,.15);
        outline: none;
    }

    .form-control::placeholder {
        color: var(--clr-text-muted);
    }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: 0.95rem;
    border-collapse: separate;
    border-spacing: 0;
}

    .table thead th {
        background: var(--clr-primary);
        color: #fff;
        font-weight: 600;
        padding: 0.85rem 1rem;
        border: none;
    }

    .table tbody tr {
        transition: background var(--transition);
    }

        .table tbody tr:hover {
            background: rgba(96,38,80,.05);
        }

    .table tbody td {
        padding: 0.8rem 1rem;
        border-bottom: 1px solid var(--clr-border);
        vertical-align: middle;
    }

/* ============================================================
   BADGES
   ============================================================ */
.badge-primary {
    background: var(--clr-primary);
    color: #fff;
}

.badge-accent {
    background: var(--clr-accent);
    color: #fff;
}

.badge-success {
    background: var(--clr-success);
    color: #fff;
}

.badge-danger {
    background: var(--clr-danger);
    color: #fff;
}

.badge {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.3em 0.75em;
    border-radius: var(--radius-pill);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border: none;
    border-radius: var(--radius-md);
    border-right: 4px solid;
    font-weight: 500;
}

.alert-success {
    border-color: var(--clr-success);
    background: rgba(39,174,96,.1);
    color: #1a6b3c;
}

.alert-danger {
    border-color: var(--clr-danger);
    background: rgba(231,76,60,.1);
    color: #922b21;
}

.alert-info {
    border-color: var(--clr-primary-light);
    background: rgba(96,38,80,.08);
    color: var(--clr-primary-dark);
}

.alert-warning {
    border-color: var(--clr-accent);
    background: rgba(160,61,136,.1);
    color: var(--clr-primary-dark);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.section {
    padding: 3rem 0;
}

.section-sm {
    padding: 1.5rem 0;
}

.section-lg {
    padding: 5rem 0;
}

.divider {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: 2rem 0;
}

/* Glass card */
.card-glass {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.5);
}

/* Stat card */
.stat-card {
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-right: 4px solid var(--clr-primary);
    transition: box-shadow var(--transition);
}

    .stat-card:hover {
        box-shadow: var(--shadow-md);
    }

    .stat-card .stat-number {
        font-size: 2rem;
        font-weight: 800;
        color: var(--clr-primary);
        line-height: 1;
    }

    .stat-card .stat-label {
        font-size: 0.85rem;
        color: var(--clr-text-muted);
        margin-top: 0.25rem;
    }

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

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

.fade-in-up {
    animation: fadeInUp 0.45s ease both;
}

.fade-in-up-1 {
    animation: fadeInUp 0.45s 0.1s ease both;
}

.fade-in-up-2 {
    animation: fadeInUp 0.45s 0.2s ease both;
}

.fade-in-up-3 {
    animation: fadeInUp 0.45s 0.3s ease both;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--clr-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--clr-primary-light);
    border-radius: 3px;
}

/* ============================================================
   RESPONSIVE — ALL SCREENS
   ============================================================ */

/* XS — Mobile Portrait (< 576px) */
@media (max-width: 575.98px) {
    .page-title {
        font-size: 1.3rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .section {
        padding: 1.25rem 0;
    }

    .section-lg {
        padding: 2rem 0;
    }

    .section-sm {
        padding: 0.75rem 0;
    }

    .card-body {
        padding: 0.9rem;
    }

    .card-header {
        padding: 0.75rem 0.9rem;
    }

    .stat-card {
        padding: 1rem;
    }

        .stat-card .stat-number {
            font-size: 1.4rem;
        }

    .btn {
        width: 100%;
        margin-bottom: 0.4rem;
    }

    .btn-sm {
        width: auto;
    }

    .table {
        font-size: 0.8rem;
    }

        .table thead th {
            padding: 0.6rem 0.5rem;
        }

        .table tbody td {
            padding: 0.55rem 0.5rem;
        }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .footer {
        font-size: 0.8rem;
        text-align: center;
    }
}

/* SM — Mobile Landscape / Small tablets (576px – 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .page-title {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .section {
        padding: 1.75rem 0;
    }

    .section-lg {
        padding: 3rem 0;
    }

    .stat-card .stat-number {
        font-size: 1.6rem;
    }

    .table {
        font-size: 0.85rem;
    }
}

/* MD — Tablets (768px – 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .page-title {
        font-size: 1.75rem;
    }

    .section {
        padding: 2.25rem 0;
    }

    .section-lg {
        padding: 3.5rem 0;
    }

    .stat-card .stat-number {
        font-size: 1.75rem;
    }
}

/* LG — Small Desktops / Laptops (992px – 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .page-title {
        font-size: 2rem;
    }

    .section {
        padding: 2.75rem 0;
    }

    .section-lg {
        padding: 4rem 0;
    }
}

/* XL — Desktops (1200px – 1399px) */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .page-title {
        font-size: 2.2rem;
    }

    .section-lg {
        padding: 4.5rem 0;
    }
}

/* XXL — Large Desktops (≥ 1400px) */
@media (min-width: 1400px) {
    .page-title {
        font-size: 2.4rem;
    }

    .section-lg {
        padding: 5rem 0;
    }

    body {
        font-size: 1.05rem;
    }
}

/* ============================================================
   TOUCH DEVICES — disable hover effects on mobile
   ============================================================ */
@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .btn:hover {
        transform: none;
    }

    .btn-primary:hover {
        box-shadow: 0 2px 8px rgba(96,38,80,.28);
    }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .navbar, .footer {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .btn {
        display: none;
    }
}

/* ============================================================
   ADMIN DRAWER
   ============================================================ */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(61,24,51,0.45);
    z-index: 1040;
    animation: fadeIn .2s ease;
}

.admin-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 270px;
    height: 100%;
    background: var(--clr-surface);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 28px rgba(96,38,80,.18);
    transition: right .28s cubic-bezier(.4, 0, .2, 1);
}

    .admin-drawer.show {
        right: 0;
    }

        .admin-drawer.show ~ .drawer-overlay,
        .drawer-overlay:has(~ .admin-drawer.show) {
            display: block;
        }

        .admin-drawer.show + .drawer-overlay,
        #drawerOverlay.active {
            display: block;
        }

.admin-drawer-header {
    background: #602650;
    color: #fff;
    padding: 1.1rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1rem;
}

.btn-close-drawer {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

    .btn-close-drawer:hover {
        background: rgba(255,255,255,.28);
    }

.admin-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.admin-drawer-footer {
    border-top: 1px solid var(--clr-border);
    padding: 0.5rem 0;
}

.drawer-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 0.6rem 1rem 0.2rem;
    margin: 0;
}

.drawer-divider {
    border: none;
    border-top: 1px solid var(--clr-border);
    margin: 0.4rem 0;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 1rem;
    margin: 1px 0.5rem;
    border-radius: 6px;
    color: #333 !important;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: background 0.3s, color 0.3s;
}

    .drawer-item:hover {
        background: rgba(96, 38, 80, 0.1);
        color: #602650 !important;
    }

    .drawer-item.active {
        background: rgba(96, 38, 80, 0.15);
        color: #602650 !important;
        font-weight: 600;
    }

    .drawer-item i {
        font-size: 1rem;
        width: 20px;
        min-width: 20px;
        text-align: center;
        line-height: 1;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

.drawer-badge {
    background: #602650;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    margin-right: auto;
}

.drawer-item-danger {
    color: #e74c3c;
}

    .drawer-item-danger:hover {
        background: rgba(231, 76, 60, .1);
        color: #e74c3c;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
