/* ==========================================================================
   مدرسة الصحابة الشرعية — Islamic theme for the admin panel
   Loaded LAST in layouts/include.blade.php, so it re-skins style/rtl and the
   token-driven redesign sheets (sidebar, header, content, tables, dashboard).
   The whole redesign derives its brand tints from --theme-color, so pinning
   the palette here recolours every page consistently in LTR and RTL.
   To return to the colour chosen in Settings, delete the two --theme-color /
   --secondary-color lines in the :root block below.
   ========================================================================== */

:root {
    --theme-color: #0b4a37 !important;
    --secondary-color: #c8a24a !important;

    --isl-primary: #0b4a37;
    --isl-primary-2: #0f6b4f;
    --isl-primary-3: #158062;
    --isl-primary-soft: #e8f1ec;
    --isl-gold: #c8a24a;
    --isl-gold-2: #e3c77a;
    --isl-gold-dark: #9c7a2b;
    --isl-cream: #f8f5ec;
    --isl-ink: #15231d;
    --isl-muted: #64736b;
    --isl-line: rgba(11, 74, 55, .1);
    --isl-ease: cubic-bezier(.22, .8, .24, 1);
    --isl-font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    --isl-font-display: "Amiri", "Times New Roman", serif;
    --isl-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23c8a24a' stroke-width='1'%3E%3Crect x='26' y='26' width='36' height='36'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3Cpath d='M0 0L18.5 18.5M88 0L69.5 18.5M0 88L18.5 69.5M88 88L69.5 69.5M44 0V18.5M44 88V69.5M0 44H18.5M88 44H69.5'/%3E%3C/g%3E%3C/svg%3E");
    --isl-pattern-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%230b4a37' stroke-width='1'%3E%3Crect x='26' y='26' width='36' height='36'/%3E%3Crect x='26' y='26' width='36' height='36' transform='rotate(45 44 44)'/%3E%3Ccircle cx='44' cy='44' r='7'/%3E%3Cpath d='M0 0L18.5 18.5M88 0L69.5 18.5M0 88L18.5 69.5M88 88L69.5 69.5M44 0V18.5M44 88V69.5M0 44H18.5M88 44H69.5'/%3E%3C/g%3E%3C/svg%3E");
    --isl-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23e3c77a' stroke-width='1.6'%3E%3Crect x='20' y='20' width='60' height='60'/%3E%3Crect x='20' y='20' width='60' height='60' transform='rotate(45 50 50)'/%3E%3Ccircle cx='50' cy='50' r='16'/%3E%3Ccircle cx='50' cy='50' r='44'/%3E%3C/g%3E%3C/svg%3E");
    --isl-lantern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 170'%3E%3Cline x1='30' y1='0' x2='30' y2='40' stroke='%23c8a24a' stroke-width='1.5'/%3E%3Ccircle cx='30' cy='44' r='4' fill='none' stroke='%23c8a24a' stroke-width='2'/%3E%3Cpath d='M22 48h16l6 12H16z' fill='%23c8a24a'/%3E%3Cpath d='M14 60h32l5 44-11 18H20L9 104z' fill='%239c7a2b'/%3E%3Cpath d='M20 66h20l3 36-7 12H24l-7-12z' fill='%23ffe7a3'/%3E%3Cpath d='M30 66v48M20 84h20' stroke='%239c7a2b' stroke-width='1.4'/%3E%3Cpath d='M20 122h20l-10 16z' fill='%23c8a24a'/%3E%3Ccircle cx='30' cy='142' r='3' fill='%23c8a24a'/%3E%3C/svg%3E");

    --dash-amber: #c8a24a;
    --dash-bg: var(--isl-cream);
    --dash-border: #e7e2d4;
    --dash-text: var(--isl-ink);
    --dash-muted: var(--isl-muted);
    --dash-radius: 16px;
}

/* ---------- Typography ---------- */
body,
.sidebar, .navbar, .content-wrapper, .card, .btn, .form-control, .select2-container, .dropdown-menu,
.bootstrap-table, .modal, .jq-toast-wrap, .swal2-popup, .tooltip, input, select, textarea, button {
    font-family: var(--isl-font) !important;
}
.page-title, .dash-header-title, .modal-title, .isl-auth__school, .isl-auth__title {
    font-family: var(--isl-font-display) !important;
    letter-spacing: 0;
}
.page-title { font-weight: 700 !important; color: var(--isl-primary) !important; font-size: 1.55rem !important; }
[dir="rtl"] body { letter-spacing: 0; }
/* Arabic glyphs need a little more line height than the Latin-tuned defaults */
[dir="rtl"] .card .card-body, [dir="rtl"] .form-group label, [dir="rtl"] .sidebar .menu-title { line-height: 1.7; }

/* ---------- Page surface ---------- */
.content-wrapper {
    background-color: var(--isl-cream) !important;
    background-image: linear-gradient(180deg, rgba(248, 245, 236, .97), rgba(248, 245, 236, .97)), var(--isl-pattern-dark) !important;
    background-size: auto, 110px !important;
    animation: isl-page-in .55s var(--isl-ease) both;
}
.content-wrapper > .row > [class*="col"],
.content-wrapper > .page-header,
.content-wrapper > .dashboard-page > *,
.content-wrapper > .row > .grid-margin {
    animation: isl-rise .6s var(--isl-ease) both;
}
.content-wrapper > .row > [class*="col"]:nth-child(2) { animation-delay: .06s; }
.content-wrapper > .row > [class*="col"]:nth-child(3) { animation-delay: .12s; }
.content-wrapper > .row > [class*="col"]:nth-child(4) { animation-delay: .18s; }
.content-wrapper > .row > [class*="col"]:nth-child(n+5) { animation-delay: .24s; }

.page-header { position: relative; padding-bottom: .6rem; margin-bottom: 1.4rem !important; }
.page-header::after {
    content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 70px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--isl-gold), var(--isl-gold-2));
}
[dir="rtl"] .page-header::after { background: linear-gradient(270deg, var(--isl-gold), var(--isl-gold-2)); }
.page-title-icon.bg-theme, .bg-theme { background: linear-gradient(135deg, var(--isl-primary-2), var(--isl-primary)) !important; }

/* ---------- Header (topbar) ---------- */
.navbar.default-layout-navbar {
    background: rgba(255, 255, 255, .96) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--isl-line) !important;
    box-shadow: 0 6px 24px -18px rgba(11, 74, 55, .5) !important;
}
.navbar.default-layout-navbar::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--isl-gold) 20%, var(--isl-gold-2) 50%, var(--isl-gold) 80%, transparent);
    background-size: 200% 100%; animation: isl-shimmer 8s linear infinite; opacity: .85;
}
.navbar .navbar-brand-wrapper { background: #fff !important; }
.navbar .navbar-brand-wrapper .navbar-brand img { transition: transform .5s var(--isl-ease); }
.navbar .navbar-brand-wrapper .navbar-brand:hover img { transform: scale(1.05) rotate(-3deg); }
.navbar .topbar-action-btn:hover, .navbar .navbar-toggler:hover { background: var(--isl-primary-soft) !important; }
.navbar .navbar-dropdown { border-radius: 14px !important; border: 1px solid var(--isl-line) !important; box-shadow: 0 18px 40px -20px rgba(11, 74, 55, .45) !important; animation: isl-drop .22s var(--isl-ease); }
.navbar .navbar-dropdown .dropdown-item:hover { background: var(--isl-primary-soft) !important; color: var(--isl-primary) !important; }
.session-year-dropdown { border-radius: 999px !important; border-color: var(--isl-line) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
    background-color: #fff !important;
    background-image: linear-gradient(180deg, #fff 55%, rgba(255, 255, 255, .9)), var(--isl-pattern-dark) !important;
    background-size: auto, 90px !important;
    background-position: 0 0, 0 100% !important;
}
.sidebar .nav .nav-item .nav-link { border-radius: 12px !important; transition: background .25s, color .25s, transform .25s var(--isl-ease) !important; }
.sidebar .nav:not(.sub-menu) > .nav-item:hover:not(.nav-category):not(.nav-profile) > .nav-link { background: var(--isl-primary-soft) !important; }
.sidebar .nav:not(.sub-menu) > .nav-item > .nav-link:hover { transform: translateX(3px); }
[dir="rtl"] .sidebar .nav:not(.sub-menu) > .nav-item > .nav-link:hover { transform: translateX(-3px); }
.sidebar .nav .nav-item.active > .nav-link {
    background: linear-gradient(135deg, var(--isl-primary-2), var(--isl-primary)) !important;
    box-shadow: 0 10px 22px -14px rgba(11, 74, 55, .9);
}
.sidebar .nav .nav-item.active > .nav-link .menu-title,
.sidebar .nav .nav-item.active > .nav-link .menu-icon,
.sidebar .nav .nav-item.active > .nav-link .menu-arrow { color: #fff !important; stroke: currentColor; }
.sidebar .nav .nav-item.active > .nav-link::before { background: var(--isl-gold) !important; }
.sidebar .nav.sub-menu .nav-item .nav-link.active { color: var(--isl-primary) !important; font-weight: 700; }
.sidebar .nav.sub-menu .nav-item .nav-link.active::before { background: var(--isl-gold) !important; }
.sidebar-search-input { border-radius: 999px !important; }
.sidebar-search-input:focus { border-color: var(--isl-primary-3) !important; box-shadow: 0 0 0 3px rgba(21, 128, 98, .12) !important; }

/* ---------- Cards ---------- */
.card {
    border-radius: 16px !important;
    border: 1px solid var(--dash-border) !important;
    box-shadow: 0 2px 6px -2px rgba(11, 74, 55, .06), 0 12px 28px -24px rgba(11, 74, 55, .35) !important;
    transition: box-shadow .35s, transform .35s var(--isl-ease);
}
.card:hover { box-shadow: 0 4px 10px -4px rgba(11, 74, 55, .08), 0 22px 40px -26px rgba(11, 74, 55, .45) !important; }
.card .card-title { color: var(--isl-primary) !important; font-weight: 700 !important; }
.card .card-title::before {
    content: ""; display: inline-block; width: 9px; height: 9px; margin-inline-end: 9px; vertical-align: middle;
    background: var(--isl-gold); transform: rotate(45deg); border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn-theme, .btn-primary:not(.btn-light) {
    background: linear-gradient(135deg, var(--isl-primary-2), var(--isl-primary)) !important;
    border-color: var(--isl-primary) !important; color: #fff !important;
    position: relative; overflow: hidden;
    transition: transform .25s var(--isl-ease), box-shadow .25s !important;
}
.btn-theme:hover, .btn-primary:not(.btn-light):hover { transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(11, 74, 55, .8) !important; }
.btn-theme::after, .btn-primary:not(.btn-light)::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
    transform: translateX(-120%); transition: transform .8s var(--isl-ease);
}
.btn-theme:hover::after, .btn-primary:not(.btn-light):hover::after { transform: translateX(120%); }
.btn { border-radius: 10px !important; }
.btn-warning:not(.btn-light) { background: var(--isl-gold) !important; border-color: var(--isl-gold) !important; color: var(--isl-ink) !important; }

/* ---------- Forms ---------- */
.form-control:focus, .select2-container--focus .select2-selection, .select2-container--open .select2-selection {
    border-color: var(--isl-primary-3) !important; box-shadow: 0 0 0 3px rgba(21, 128, 98, .12) !important;
}
.form-check .form-check-label input:checked + .input-helper::before { background: var(--isl-primary) !important; border-color: var(--isl-primary) !important; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] input[type="tel"] { direction: ltr; text-align: right; }
[dir="rtl"] input[type="email"]::placeholder, [dir="rtl"] input[type="tel"]::placeholder { direction: rtl; }

/* ---------- Tables / pagination ---------- */
.bootstrap-table .fixed-table-container thead th { background: var(--isl-primary-soft) !important; color: var(--isl-primary) !important; }
.page-item.active .page-link { background: var(--isl-primary) !important; border-color: var(--isl-primary) !important; }
.badge-success, .badge-theme { background: var(--isl-primary-3) !important; }

/* ---------- Modals / toasts ---------- */
.modal-content { border-radius: 18px !important; border: 0 !important; overflow: hidden; }
.modal-header { background: linear-gradient(135deg, var(--isl-primary-soft), #fff) !important; border-bottom: 1px solid var(--isl-line) !important; }
.modal.fade .modal-dialog { transform: translateY(18px) scale(.98); transition: transform .3s var(--isl-ease) !important; }
.modal.show .modal-dialog { transform: none; }
.swal2-styled.swal2-confirm { background: var(--isl-primary) !important; }

/* ---------- Footer ---------- */
.footer { background: #fff !important; border-top: 1px solid var(--isl-line) !important; }
.footer a { color: var(--isl-primary) !important; }

/* ---------- Dashboard ---------- */
.dash-stat-card, .dash-card { transition: transform .35s var(--isl-ease), box-shadow .35s; }
.dash-stat-card:hover { transform: translateY(-4px); }
.dash-stat-icon { background: var(--isl-primary-soft) !important; color: var(--isl-primary) !important; border-radius: 14px !important; }
.dash-stat-value { font-family: var(--isl-font-display); color: var(--isl-primary); }

.isl-dash-banner {
    position: relative; overflow: hidden; isolation: isolate;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px;
    padding: 28px 30px; border-radius: 22px; color: #fff;
    background: linear-gradient(120deg, var(--isl-primary) 0%, var(--isl-primary-2) 60%, #0a3d2e 100%);
    box-shadow: 0 22px 44px -28px rgba(11, 74, 55, .9);
}
.isl-dash-banner::before { content: ""; position: absolute; inset: -40%; z-index: -1; background: var(--isl-pattern) repeat; background-size: 90px; opacity: .14; animation: isl-drift 90s linear infinite; }
.isl-dash-banner::after { content: ""; position: absolute; z-index: -1; width: 260px; height: 260px; inset-inline-end: -60px; top: -70px; background: var(--isl-star) center / contain no-repeat; opacity: .35; animation: isl-spin 50s linear infinite; }
.isl-dash-banner__greeting { display: inline-block; font-family: var(--isl-font-display); color: var(--isl-gold-2); font-size: 1.1rem; margin-bottom: 2px; }
.isl-dash-banner .dash-header-title { color: #fff !important; font-size: 1.9rem; margin-bottom: .25rem; }
.isl-dash-banner .dash-header-subtitle { color: rgba(255, 255, 255, .78) !important; }
.isl-dash-banner__date {
    display: flex; flex-direction: column; gap: 2px; text-align: center;
    padding: 12px 20px; border-radius: 16px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(227, 199, 122, .35);
}
.isl-dash-banner__hijri { font-family: var(--isl-font-display); font-size: 1.2rem; color: var(--isl-gold-2); }
.isl-dash-banner__greg { font-size: .85rem; color: rgba(255, 255, 255, .75); }

/* ---------- Login / auth pages ---------- */
body.isl-auth { min-height: 100vh; margin: 0; background: var(--isl-cream) !important; }
.isl-auth__wrap { display: flex; min-height: 100vh; }
.isl-auth__side {
    position: relative; overflow: hidden; flex: 1 1 52%;
    display: flex; align-items: center; justify-content: center; text-align: center; color: #fff;
    background: radial-gradient(circle at 30% 30%, var(--isl-primary-3), var(--isl-primary) 55%, #062a20);
}
.isl-auth__pattern { position: absolute; inset: -50%; background: var(--isl-pattern) repeat; background-size: 110px; opacity: .14; animation: isl-drift 80s linear infinite; }
.isl-auth__star { position: absolute; width: 520px; height: 520px; background: var(--isl-star) center / contain no-repeat; opacity: .28; animation: isl-spin 70s linear infinite; }
.isl-auth__lantern {
    position: absolute; top: 0; inset-inline-start: 14%; width: 52px; height: 150px;
    background: var(--isl-lantern) top center / contain no-repeat; transform-origin: top center;
    animation: isl-swing 4.5s ease-in-out infinite; filter: drop-shadow(0 10px 22px rgba(255, 220, 140, .55));
}
.isl-auth__side-inner { position: relative; padding: 40px; max-width: 560px; }
.isl-auth__bismillah {
    font-family: var(--isl-font-display); font-size: 1.9rem; margin-bottom: 1.2rem;
    background: linear-gradient(90deg, var(--isl-gold), #fff4cf, var(--isl-gold)); background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: isl-rise .9s var(--isl-ease) both .1s, isl-shimmer 5s linear infinite 1s;
}
.isl-auth__school { font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 700; color: #fff; margin: 0 0 .4rem; animation: isl-rise .9s var(--isl-ease) both .3s; }
.isl-auth__motto { color: var(--isl-gold-2); font-size: 1.1rem; margin-bottom: 2rem; animation: isl-rise .9s var(--isl-ease) both .45s; }
.isl-auth__ayah { display: inline-block; font-family: var(--isl-font-display); font-size: 1.6rem; padding: 10px 26px; border-radius: 999px; border: 1px solid rgba(227, 199, 122, .4); background: rgba(255, 255, 255, .06); animation: isl-rise .9s var(--isl-ease) both .6s; }
.isl-auth__main { flex: 1 1 48%; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--isl-cream) var(--isl-pattern-dark) repeat; background-size: 120px; position: relative; }
.isl-auth__main::before { content: ""; position: absolute; inset: 0; background: rgba(248, 245, 236, .94); }
.isl-auth__main .auth-content-wrapper { position: relative; width: 100%; max-width: 440px; padding: 0 !important; background: transparent !important; }
.isl-auth__card {
    background: #fff !important; border-radius: 24px !important; padding: 40px 34px !important; text-align: start !important;
    border: 1px solid rgba(200, 162, 74, .3); box-shadow: 0 30px 60px -36px rgba(11, 74, 55, .55);
    animation: isl-rise .8s var(--isl-ease) both .2s;
    width: 100% !important; height: auto !important; min-height: 0 !important; max-width: none !important;
}
.isl-auth__card .brand-logo { margin-bottom: 1rem !important; }
.isl-auth__card .brand-logo img { max-height: 70px; width: auto !important; }
.isl-auth__title { text-align: center; color: var(--isl-primary); font-size: 1.7rem; margin: 0; }
.isl-auth__subtitle { text-align: center; color: var(--isl-muted); margin: .3rem 0 .4rem; }
.isl-auth__card .form-control { height: 50px; border-radius: 12px !important; }
.isl-auth__card .input-group .form-control { border-start-end-radius: 0 !important; border-end-end-radius: 0 !important; }
.isl-auth__card .input-group-text { border-radius: 0 12px 12px 0 !important; cursor: pointer; background: var(--isl-primary-soft) !important; color: var(--isl-primary); }
[dir="rtl"] .isl-auth__card .input-group-text { border-radius: 12px 0 0 12px !important; }
[dir="rtl"] .isl-auth__card .input-group .form-control { border-radius: 0 12px 12px 0 !important; }
.isl-auth__card .auth-form-btn { height: 52px; border-radius: 14px !important; font-weight: 700; font-size: 1.05rem; }
.isl-auth__card .auth-link { color: var(--isl-primary) !important; }
@media (max-width: 991px) {
    .isl-auth__wrap { flex-direction: column; }
    .isl-auth__side { flex: none; min-height: 300px; }
    .isl-auth__side-inner { padding: 50px 20px 30px; }
    .isl-auth__star { width: 340px; height: 340px; }
    .isl-auth__main { flex: 1; margin-top: -40px; background: transparent; }
    .isl-auth__main::before { display: none; }
}

/* ---------- Keyframes ---------- */
@keyframes isl-page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes isl-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes isl-spin { to { transform: rotate(360deg); } }
@keyframes isl-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-90px, -90px, 0); } }
@keyframes isl-swing { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-5deg); } }
@keyframes isl-shimmer { to { background-position: -200% center; } }
@keyframes isl-drop { from { opacity: 0; transform: translateY(-6px); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Password reset pages (auth/passwords/*) — same card + patterned backdrop as the login page */
.isl-auth--simple .content-wrapper.auth {
    background-color: var(--isl-cream) !important;
    background-image: radial-gradient(circle at 50% 0, rgba(11, 74, 55, .12), transparent 60%), var(--isl-pattern-dark) !important;
    background-size: auto, 110px !important;
    min-height: 100vh;
}
.isl-auth--simple .isl-auth__card { margin-top: 4vh; }
.isl-auth--simple .isl-auth__title { margin-bottom: 1rem; }
