/* ==========================================================================
   Muddaker — Theme (single source of truth)
   Extracted from resources/views/auth/login.blade.php.
   Loaded LAST in every layout so it overrides the legacy app.css /
   dashboard.css / page.css / guest.css component definitions.

   Goal: lighter, simpler, more elegant. Fewer borders, softer shadows,
   generous whitespace, one radius scale, navy + gold accents.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand palette (verbatim from the login page) */
    --navy-900: #0E1A30;
    --navy-800: #14224A;
    --navy-700: #1B2D5E;
    --navy-600: #243B72;
    --gold-500: #D4A030;
    --gold-400: #E6B84D;
    --gold-300: #F0CC78;
    --paper: #FFFCF6;
    --ink: #182B48;
    --muted: #6B7A8F;

    /* Semantic aliases (the legacy sheets read --primary/--secondary/--navy…) */
    --primary: #182B48;
    --primary-light: #2A4570;
    --secondary: #D4A030;
    --navy: #14224A;
    --gold: #D4A030;
    --accent: #B1C2E0;

    --success: #1E9E57;
    --danger: #C0392B;
    --warning: #D9820F;
    --info: #2980B9;

    --success-bg: #ECFDF5;
    --success-ink: #065F46;
    --danger-bg: #FEF2F2;
    --danger-ink: #991B1B;
    --warning-bg: #FEF5E7;
    --warning-ink: #B36B00;
    --info-bg: #EFF6FF;
    --info-ink: #1D4ED8;

    /* Surfaces + lines */
    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-2: #FBFCFE;
    --line: #E7E9F0;
    --line-soft: #F0F2F7;
    --field-icon: #94A3B8;

    /* Radii */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Shadows (soft, like the login page) */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 16px rgba(20, 34, 74, 0.08);
    --shadow-lg: 0 10px 30px rgba(20, 34, 74, 0.14);
    --shadow-primary: 0 10px 24px rgba(20, 34, 74, 0.25);
    --ring: 0 0 0 4px rgba(27, 45, 94, 0.08);
    --ring-gold: 0 0 0 4px rgba(212, 160, 48, 0.14);

    /* Typography */
    --font: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-quran: 'Amiri', 'Traditional Arabic', serif;

    /* Metrics */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Arabic ligatures must not be broken by letter-spacing (legacy rule kept). */
body, input, textarea, select, optgroup,
.form-control, .form-select, .form-label,
p, span, div, h1, h2, h3, h4, h5, h6,
td, th, label, a, li, button {
    letter-spacing: 0 !important;
    word-spacing: 0 !important;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--navy-600); }
small { color: var(--muted); }
hr { border-color: var(--line); opacity: 1; }
::selection { background: rgba(212, 160, 48, 0.22); }

/* Scrollbars — thin + neutral */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD2DE; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #AEB7C6; background-clip: content-box; }

.quran-text, .amiri-text { font-family: var(--font-quran); }

/* --------------------------------------------------------------------------
   3. Layout shell
   -------------------------------------------------------------------------- */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transition: margin-right 0.3s ease;
}
.main-content.sidebar-collapsed { margin-right: var(--sidebar-collapsed-width); }

.top-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
    z-index: 999;
}

.page-title {
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

.page-content { flex: 1; padding: 24px; }

/* Footer is markup-inline; keep it airy */
.main-content > footer {
    background: transparent !important;
    border-top: 1px solid var(--line) !important;
    color: var(--muted) !important;
}

/* --------------------------------------------------------------------------
   4. Sidebar — flat navy, login-style, decorations removed
   -------------------------------------------------------------------------- */
.sidebar {
    background:
        radial-gradient(900px 500px at 110% 120%, rgba(31, 58, 138, 0.45), transparent 55%),
        linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--navy-700) 100%) !important;
    box-shadow: none;
}

/* The login brand panel uses a subtle gold hexagon lattice; reuse it. */
.sidebar::before {
    content: '' !important;
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'><g fill='none' stroke='%23D4A030' stroke-opacity='0.07' stroke-width='1'><polygon points='90,10 170,55 170,125 90,170 10,125 10,55'/><polygon points='90,30 150,62 150,118 90,150 30,118 30,62'/><circle cx='90' cy='90' r='40'/><circle cx='90' cy='90' r='22'/></g></svg>") !important;
    background-size: 220px 220px;
    opacity: 1;
    pointer-events: none;
}
.sidebar::after { background: none !important; }

/* Remove the legacy ornament layer entirely. */
.sidebar-top-decoration,
.sidebar-corner-decoration,
.sidebar-crescent,
.sidebar-star,
.sidebar-dome,
.sidebar-frame,
.islamic-divider,
.sidebar-bismillah { display: none !important; }

.sidebar-close-btn {
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: var(--radius) !important;
}
.sidebar-close-btn:hover { background: rgba(255, 255, 255, 0.22) !important; transform: none; }

.sidebar-logo {
    padding: 22px 18px 18px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: transparent !important;
    text-align: center;
}
.sidebar-logo img {
    width: 96px !important;
    height: 72px !important;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.96);
    padding: 10px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.sidebar-logo.has-custom-logo img { width: 120px !important; height: 78px !important; }
.sidebar-logo img:hover { transform: none; box-shadow: var(--shadow-md); }
.sidebar-logo h6 {
    color: #fff; font-size: 16px; margin: 12px 0 2px; font-weight: 700; text-shadow: none;
}
.sidebar-logo small { color: var(--gold-300); font-size: 11px; font-weight: 600; text-shadow: none; }

.sidebar-nav { padding: 12px 8px 20px; }

.nav-section-title {
    color: rgba(240, 204, 120, 0.85) !important;
    font-size: 11px !important;
    text-transform: none;
    padding: 16px 14px 6px !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    display: block;
}
.nav-section-title::before { display: none !important; }
.nav-section-title::after { display: none !important; }

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    padding: 10px 12px !important;
    margin: 2px 0 !important;
    border-radius: var(--radius) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    gap: 12px !important;
    text-shadow: none !important;
    border: 0 !important;
}
.sidebar .nav-link::before,
.sidebar .nav-link::after { display: none !important; }
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #fff !important;
}
.sidebar .nav-link.active {
    background: rgba(212, 160, 48, 0.16) !important;
    color: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(212, 160, 48, 0.25) !important;
}
.sidebar .nav-link .icon-wrapper {
    width: 34px !important;
    height: 34px !important;
    border-radius: var(--radius-sm) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 0 !important;
    transition: background 0.18s ease, color 0.18s ease;
}
.sidebar .nav-link:hover .icon-wrapper { background: rgba(255, 255, 255, 0.12) !important; transform: none; box-shadow: none; }
.sidebar .nav-link.active .icon-wrapper {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400)) !important;
    box-shadow: none !important;
}
.sidebar .nav-link i { color: var(--gold-300) !important; font-size: 15px !important; text-shadow: none !important; }
.sidebar .nav-link.active i { color: var(--navy-800) !important; }
.sidebar .nav-link:hover i { color: #fff !important; }
.sidebar .nav-link.active:hover i { color: var(--navy-800) !important; }
.sidebar .nav-link span { flex: 1; white-space: nowrap; }

.sidebar .nav-link .badge {
    background: var(--danger) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border: 0 !important;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    margin-right: auto;
}

.sidebar-footer {
    padding: 14px 18px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(0, 0, 0, 0.12) !important;
}
.sidebar-footer-content { color: rgba(255, 255, 255, 0.6) !important; font-size: 11px; text-shadow: none !important; }
.sidebar-footer-content i { color: var(--gold-300) !important; text-shadow: none !important; }

/* Mobile sheet */
@media (max-width: 991.98px) {
    .sidebar {
        background:
            radial-gradient(900px 500px at 110% 120%, rgba(31, 58, 138, 0.45), transparent 55%),
            linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--navy-700) 100%) !important;
    }
    .top-header { padding: 0 16px; height: 58px; }
    .page-content { padding: 16px; }
}

/* Header controls */
#sidebarToggle, #mobileMenuBtn {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
    width: 42px; height: 42px;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-xs) !important;
}
#sidebarToggle:hover, #mobileMenuBtn:hover {
    background: var(--navy-800) !important;
    color: #fff !important;
    transform: none;
    box-shadow: var(--shadow-sm) !important;
}

.notification-bell {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    width: 42px; height: 42px;
}
.notification-bell:hover {
    background: var(--navy-800) !important;
    color: #fff !important;
    transform: none;
    box-shadow: var(--shadow-sm) !important;
}
.notification-badge {
    background: var(--danger) !important;
    box-shadow: none !important;
    border: 2px solid var(--surface) !important;
}

.user-avatar-btn { border-radius: var(--radius-pill); padding: 4px 8px; }
.user-avatar-btn:hover { background: var(--line-soft); }
.user-avatar-wrapper, .user-avatar-img { border-radius: var(--radius) !important; }
.user-avatar-img { border: 1px solid var(--line) !important; width: 40px; height: 40px; }
.user-avatar-btn:hover .user-avatar-img { transform: none; box-shadow: none; border-color: var(--gold-500) !important; }
.user-avatar-status { background: var(--success) !important; border: 2px solid var(--surface) !important; }
.user-info .name { color: var(--ink); font-size: 13px; font-weight: 700; }
.user-info .role { color: var(--muted); font-size: 11px; }
.user-info .role i { color: var(--success) !important; font-size: 7px; }
.user-chevron { color: var(--muted) !important; }
.user-avatar-btn:hover .user-chevron { color: var(--gold-500) !important; transform: none; }

/* Dropdown surfaces */
.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}
.user-dropdown, .notif-dropdown { border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-lg) !important; }
.user-dropdown-header {
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600)) !important;
}
.user-dropdown-header::after { background: linear-gradient(90deg, transparent, var(--gold-500), transparent) !important; height: 2px !important; }
.user-dropdown .dropdown-item { color: var(--ink); border-radius: var(--radius-sm); }
.user-dropdown .dropdown-item:hover { background: var(--line-soft) !important; }
.user-dropdown .dropdown-item i {
    background: var(--line-soft) !important; color: var(--gold-500) !important;
    width: 30px; height: 30px; border-radius: var(--radius-sm) !important;
}
.user-dropdown .dropdown-item:hover i { background: var(--gold-500) !important; color: #fff !important; }
.user-dropdown .dropdown-item.text-danger { color: var(--danger) !important; }
.user-dropdown .dropdown-item.text-danger:hover { background: var(--danger-bg) !important; }
.user-dropdown .dropdown-item.text-danger i { background: var(--danger-bg) !important; color: var(--danger) !important; }
.badge-count { background: var(--danger) !important; }

/* Notification dropdown */
.notif-header { background: linear-gradient(135deg, var(--navy-800), var(--navy-600)) !important; }
.notif-header::after { background: linear-gradient(90deg, transparent, var(--gold-500), transparent) !important; height: 2px !important; }
.notif-header-icon { background: rgba(212, 160, 48, 0.18) !important; color: var(--gold-300) !important; }
.notif-mark-all { background: rgba(255, 255, 255, 0.12) !important; color: var(--gold-300) !important; }
.notif-mark-all:hover { background: rgba(255, 255, 255, 0.2) !important; color: #fff !important; }
.notif-item { border-bottom: 1px solid var(--line-soft) !important; }
.notif-item:hover { background: var(--line-soft) !important; }
.notif-item.unread { background: rgba(212, 160, 48, 0.05) !important; }
.notif-icon { background: var(--line-soft) !important; color: var(--navy-700) !important; }
.notif-icon.new { background: linear-gradient(135deg, var(--gold-500), var(--gold-400)) !important; color: #fff !important; box-shadow: none !important; }
.notif-title { color: var(--ink) !important; }
.notif-time i { color: var(--gold-500) !important; }
.notif-dot { background: var(--gold-500) !important; box-shadow: none !important; }
.notif-empty i { color: var(--gold-500) !important; }
.notif-footer { background: var(--surface-2) !important; border-top: 1px solid var(--line-soft) !important; }
.notif-footer-link { color: var(--navy-700) !important; }
.notif-footer-link:hover { color: var(--gold-500) !important; }

/* --------------------------------------------------------------------------
   5. Page header / breadcrumb / hero utilities
   -------------------------------------------------------------------------- */
.breadcrumb { font-size: 12.5px; margin-bottom: 0.75rem; }
.breadcrumb-item a { color: var(--muted); }
.breadcrumb-item.active { color: var(--ink); font-weight: 600; }

.page-header { align-items: flex-end; margin-bottom: 20px; }
.header-icon {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, var(--navy-800), var(--navy-600)) !important;
    border-radius: var(--radius) !important;
    color: var(--gold-300) !important;
    box-shadow: none !important;
    font-size: 18px !important;
}
.header-icon.quran, .header-icon.supervisors { background: linear-gradient(135deg, var(--navy-800), var(--navy-600)) !important; box-shadow: none !important; }
.header-text h4 { color: var(--ink) !important; font-size: 18px !important; }
.header-text p { color: var(--muted) !important; }

.stat-pill {
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    color: var(--ink) !important;
    border-radius: var(--radius-pill) !important;
    padding: 7px 16px !important;
}
.stat-pill.primary { background: var(--navy-800) !important; color: #fff !important; border-color: var(--navy-800) !important; }
.stat-pill.danger { background: var(--danger-bg) !important; color: var(--danger-ink) !important; border-color: transparent !important; }
.stat-pill i { color: var(--gold-500) !important; }
.stat-pill.primary i { color: var(--gold-300) !important; }

/* --------------------------------------------------------------------------
   6. Misc global
   -------------------------------------------------------------------------- */
.sticky-top {
    z-index: 100 !important;
    top: calc(var(--header-height) + 16px) !important;
}
.sidebar-backdrop.show { backdrop-filter: blur(3px); }
@media print {
    .sidebar, .top-header, .no-print { display: none !important; }
    .main-content { margin-right: 0 !important; }
    body { background: #fff; }
}
