/* ============================================================================
 * MA DIGITAL SCHOOL - Stylesheet Utama (Modern Frosted Glass Bento UI)
 * Identitas Visual: MA Mathla'ul Anwar Kedondong
 * ============================================================================ */

:root {
    --mdg-primary: #006633;
    --mdg-primary-dark: #004d26;
    --mdg-secondary: #16834A;
    --mdg-bg: #EAF3F1;
    --mdg-white: #FFFFFF;
    --mdg-accent: #D4AF37;
    --mdg-text: #0F172A;
    --mdg-muted: #64748B;
    --mdg-border: rgba(255, 255, 255, 0.86);
    --mdg-hairline: rgba(15, 23, 42, 0.07);
    --mdg-glass-bg: rgba(255, 255, 255, 0.64);
    --mdg-glass-strong: rgba(255, 255, 255, 0.84);
    --mdg-sidebar-bg: rgba(244, 250, 249, 0.80);
    --mdg-sidebar-width: 265px;
    --mdg-radius-lg: 22px;
    --mdg-radius-md: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--mdg-bg);
    background-image:
        radial-gradient(circle at 10% 15%, rgba(20, 184, 166, 0.14), transparent 40%),
        radial-gradient(circle at 88% 18%, rgba(167, 139, 250, 0.18), transparent 44%),
        radial-gradient(circle at 78% 85%, rgba(56, 189, 248, 0.13), transparent 40%),
        linear-gradient(135deg, #dfeeec 0%, #ecf4f3 48%, #e9e6f6 100%);
    background-attachment: fixed;
    color: var(--mdg-text);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Tombol Utama Madrasah */
.btn-madrasah {
    background: linear-gradient(95deg, var(--mdg-primary) 0%, var(--mdg-secondary) 100%);
    color: #fff;
    border: none;
    font-weight: 600;
    border-radius: 12px;
    padding: 0.58rem 1.2rem;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    box-shadow: 0 8px 18px -6px rgba(0, 102, 51, 0.35);
}

.btn-madrasah:hover,
.btn-madrasah:focus {
    background: linear-gradient(95deg, var(--mdg-primary-dark), var(--mdg-primary));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -6px rgba(0, 102, 51, 0.42);
}

.btn-outline-madrasah {
    border: 1.5px solid var(--mdg-primary);
    color: var(--mdg-primary);
    background: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.16s ease;
}

.btn-outline-madrasah:hover {
    background-color: var(--mdg-primary);
    color: #fff;
}

/* Layout Dashboard (Frosted Glass Bento) */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--mdg-sidebar-width);
    background: var(--mdg-sidebar-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--mdg-border);
    color: var(--mdg-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.04);
}

.app-sidebar.show {
    transform: translateX(0);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(3px);
    z-index: 1040;
}

.sidebar-backdrop.show {
    display: block;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

.sidebar-brand {
    padding: 1.45rem 1.3rem 1rem;
}

.brand-emblem {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--mdg-primary), var(--mdg-secondary));
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(0, 102, 51, 0.2);
}

.sidebar-nav {
    padding: 0.45rem 0.95rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
    border-radius: 999px;
}

.sidebar-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mdg-muted);
    padding: 0.7rem 0.75rem 0.3rem;
    font-weight: 700;
}

.sidebar-group {
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    padding: 0.4rem;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    padding: 0.42rem 0.6rem;
    border-radius: 11px;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--mdg-muted);
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--mdg-primary);
}

.sidebar-group-icon {
    font-size: 0.85rem;
    color: var(--mdg-primary);
}

.sidebar-group-chevron {
    font-size: 0.72rem;
    transition: transform 0.2s ease;
}

.sidebar-group-toggle[aria-expanded="false"] .sidebar-group-chevron {
    transform: rotate(-90deg);
}

.sidebar-group-body {
    padding-top: 0.25rem;
}

.sidebar-group-body .sidebar-link:last-child {
    margin-bottom: 0;
}

.sidebar-divider {
    height: 1px;
    background: var(--mdg-hairline);
    margin: 0.75rem 0.6rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.68rem 0.95rem;
    margin-bottom: 0.28rem;
    border-radius: 13px;
    color: #334155;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.16s ease;
}

.sidebar-link i {
    font-size: 1.02rem;
    color: var(--mdg-primary);
    opacity: 0.88;
    transition: color 0.16s ease;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.85);
    color: var(--mdg-primary);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.sidebar-link.active {
    background: linear-gradient(95deg, var(--mdg-primary) 0%, var(--mdg-secondary) 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 10px 22px -6px rgba(0, 102, 51, 0.38);
}

.sidebar-link.active i {
    color: #ffffff;
    opacity: 1;
}

.sidebar-link.disabled-preview {
    opacity: 0.55;
    cursor: default;
}

.sidebar-footer {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--mdg-hairline);
    font-size: 0.76rem;
    color: var(--mdg-muted);
    background: rgba(255, 255, 255, 0.35);
}

/* Main Content & Open Floating Topbar */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    background: rgba(244, 250, 249, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.15rem 1.25rem 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (min-width: 992px) {
    .app-topbar {
        padding: 1.45rem 2.1rem 0.75rem;
    }
}

.topbar-greeting {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--mdg-primary);
    line-height: 1.25;
}

.topbar-hero-title {
    font-size: clamp(1.32rem, 2.2vw, 1.8rem);
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0.1rem 0 0;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--mdg-glass-strong);
    border: 1px solid var(--mdg-border);
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.topbar-icon-btn:hover {
    background: #ffffff;
    color: var(--mdg-primary);
    transform: translateY(-1px);
}

.topbar-notif-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    border: 1.5px solid #fff;
}

.topbar-user-btn {
    background: var(--mdg-glass-strong);
    border: 1px solid var(--mdg-border);
    border-radius: 999px;
    padding: 0.3rem 0.85rem 0.3rem 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #0F172A;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    transition: all 0.15s ease;
}

.topbar-user-btn:hover {
    background: #ffffff;
}

.app-content {
    padding: 0.85rem 1.25rem 1.75rem;
    flex: 1;
}

@media (min-width: 992px) {
    .app-content {
        padding: 0.9rem 2.1rem 2rem;
    }
}

.app-footer {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--mdg-border);
    padding: 0.9rem 2.1rem;
    font-size: 0.8rem;
    color: var(--mdg-muted);
}

/* Glassmorphism Cards, KPI Tiles & Bento Components */
.card-modern {
    background: var(--mdg-glass-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--mdg-border);
    border-radius: var(--mdg-radius-lg);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.045);
}

.stat-card {
    background: var(--mdg-glass-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--mdg-border);
    border-radius: var(--mdg-radius-lg);
    padding: 1.15rem 1.25rem;
    height: 100%;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.kpi-label {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mdg-muted);
    margin-bottom: 0.15rem;
}

.kpi-value {
    font-size: 1.48rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.15;
}

.kpi-icon-purple {
    background: linear-gradient(135deg, #DDD6FE, #C4B5FD);
    color: #6D28D9;
    box-shadow: 0 6px 14px rgba(139, 92, 246, 0.22);
}

.kpi-icon-pink {
    background: linear-gradient(135deg, #FBCFE8, #F472B6);
    color: #BE185D;
    box-shadow: 0 6px 14px rgba(236, 72, 153, 0.22);
}

.kpi-icon-amber {
    background: linear-gradient(135deg, #FDE68A, #FBBF24);
    color: #B45309;
    box-shadow: 0 6px 14px rgba(245, 158, 11, 0.22);
}

.kpi-icon-teal {
    background: linear-gradient(135deg, #99F6E4, #2DD4BF);
    color: #0F766E;
    box-shadow: 0 6px 14px rgba(20, 184, 166, 0.22);
}

.bg-madrasah-soft {
    background-color: rgba(0, 102, 51, 0.11);
    color: var(--mdg-primary);
}

.bg-gold-soft {
    background-color: rgba(212, 175, 55, 0.18);
    color: #9A7B16;
}

.badge-gold {
    background-color: rgba(212, 175, 55, 0.16);
    color: #8A6D12;
    border: 1px solid rgba(212, 175, 55, 0.42);
    font-weight: 600;
}

/* Segmented Bar (Games Statistic style) */
.bento-segment-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    display: flex;
    gap: 3px;
    padding: 1px;
}

.bento-seg-primary {
    background: linear-gradient(90deg, var(--mdg-primary), var(--mdg-secondary));
    border-radius: 999px;
}

.bento-seg-warning {
    background: #CBD5E1;
    border-radius: 999px;
}

.bento-seg-danger {
    background: #FB7185;
    border-radius: 999px;
}

/* VS / Split Circle Showcase */
.bento-vs-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFE4E6, #FECDD3);
    color: #E11D48;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(244, 63, 94, 0.18);
}

.bento-team-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

/* Dark Teal / Emerald Gradient Promo Card */
.bento-promo-card {
    background: linear-gradient(135deg, var(--mdg-primary-dark) 0%, var(--mdg-primary) 48%, var(--mdg-secondary) 100%);
    color: #fff;
    border-radius: var(--mdg-radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 36px -10px rgba(0, 102, 51, 0.45);
}

.bento-promo-card .promo-orb-1 {
    position: absolute;
    right: -18px;
    top: -22px;
    width: 115px;
    height: 115px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.85), rgba(16, 185, 129, 0.15));
    pointer-events: none;
}

.bento-promo-card .promo-orb-2 {
    position: absolute;
    right: 26px;
    bottom: -24px;
    width: 88px;
    height: 88px;
    border-radius: 22px;
    transform: rotate(22deg);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

.btn-promo-pill {
    background: rgba(255, 255, 255, 0.94);
    color: var(--mdg-primary-dark);
    border: none;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.52rem 1.2rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.15s ease, background-color 0.15s ease;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.btn-promo-pill:hover {
    background: #ffffff;
    color: var(--mdg-primary);
    transform: translateY(-1px);
}

.hero-banner {
    background: linear-gradient(135deg, var(--mdg-primary) 0%, var(--mdg-secondary) 100%);
    color: #fff;
    border-radius: var(--mdg-radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--mdg-accent);
}

/* Tabel & Kontrol Form Bersih di dalam Glass Card */
.card-modern .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.38);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.65);
    margin-bottom: 0;
}

.card-modern .table thead th {
    background: rgba(255, 255, 255, 0.48);
    border-bottom: 1px solid var(--mdg-hairline);
    color: var(--mdg-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-modern .table td,
.card-modern .table th {
    border-color: var(--mdg-hairline);
}

.card-modern .bg-light {
    background-color: rgba(255, 255, 255, 0.56) !important;
    border-color: var(--mdg-hairline) !important;
}

/* Portal Publik Navbar (Putih Solid Timbul) & Footer */
.portal-navbar {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.portal-navbar .nav-link {
    border-radius: 10px;
    padding: 0.45rem 0.75rem !important;
    color: #334155;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.portal-navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--mdg-primary);
}

.portal-navbar .nav-link.active {
    background: linear-gradient(95deg, var(--mdg-primary) 0%, var(--mdg-secondary) 100%);
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 6px 16px -4px rgba(0, 102, 51, 0.3);
}

.portal-footer {
    background: rgba(255, 255, 255, 0.56);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--mdg-border);
    color: #334155;
}

.card-modern .table td,
.card-modern .table th {
    padding: 0.65rem 0.75rem;
}

.form-control,
.form-select {
    background-color: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.12);
    border-radius: 12px;
}

.form-control:focus,
.form-select:focus {
    background-color: #ffffff;
    border-color: var(--mdg-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 51, 0.12);
}

.card-link-subtle {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mdg-primary);
    text-decoration: none;
}

.card-link-subtle:hover {
    text-decoration: underline;
}

/* Halaman Login (Frosted Glass Canvas) */
.login-page {
    min-height: 100vh;
    background-color: var(--mdg-bg);
    background-image:
        radial-gradient(circle at 12% 18%, rgba(20, 184, 166, 0.18), transparent 45%),
        radial-gradient(circle at 86% 22%, rgba(167, 139, 250, 0.20), transparent 46%),
        radial-gradient(circle at 75% 84%, rgba(212, 175, 55, 0.14), transparent 40%),
        linear-gradient(135deg, #dfeeec 0%, #ecf4f3 48%, #e9e6f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.09);
    overflow: hidden;
}

.login-card-header {
    background: linear-gradient(135deg, var(--mdg-primary-dark) 0%, var(--mdg-primary) 55%, var(--mdg-secondary) 100%);
    color: #fff;
    padding: 1.75rem 1.5rem;
    text-align: center;
    border-bottom: 3px solid var(--mdg-accent);
}
