/* ============================================================================
   SOFT FROSTED GLASSMORPHISM & TACTILE 3D DESIGN SYSTEM
   Warm Terracotta (#EA580C) + Soft Natural Daylight Architectural Canvas
   ============================================================================ */

:root {
    --primary-accent: #EA580C;
    --primary-hover: #C2410C;
    --primary-grad: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    --soft-tint-surface: #FFF7ED;
    --soft-tint-badge: #FFEDD5;
    --soft-tint-border: #FED7AA;
    --soft-tint-text: #9A3412;

    --text-heading: #0F172A;
    --text-secondary: #475569;
    --bg-fallback: #F6F1EB;

    --sem-success: #10B981;
    --sem-warning: #F59E0B;
    --sem-info: #0EA5E9;
    --sem-danger: #F43F5E;

    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-bg-strong: rgba(255, 255, 255, 0.86);
    --glass-inset: rgba(255, 255, 255, 0.56);
    --glass-modal: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.60);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.90), 0 20px 45px -12px rgba(15, 23, 42, 0.08);
    --tactile-btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 8px 18px -4px rgba(234, 88, 12, 0.34), 0 2px 0 #C2410C;
    --radius-card: 1.35rem;
    --radius-inset: 0.95rem;
}

/* --- Continuous Fixed Architectural Daylight Background Canvas --- */
html {
    background-color: var(--bg-fallback);
}

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    color: var(--text-heading);
    background: transparent !important;
    background-color: transparent !important;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: -24px;
    transform: scale(1.04);
    z-index: -2;
    background-color: var(--bg-fallback);
    background-image:
        linear-gradient(135deg, rgba(255, 252, 248, 0.52) 0%, rgba(246, 241, 235, 0.44) 100%),
        url('../img/bg-architecture.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: blur(7px);
    pointer-events: none;
}

/* Preserve Icon Fonts Explicitly */
.material-symbols-rounded,
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}
.material-symbols-rounded { font-family: 'Material Symbols Rounded' !important; }
.material-symbols-outlined { font-family: 'Material Symbols Outlined' !important; }

/* Form Elements & Headings Typography */
button, input, select, textarea {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, .br-title, .logo {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    font-weight: 800 !important;
    color: var(--text-heading);
    letter-spacing: -0.025em;
}
h1 { letter-spacing: -0.035em; }

p, .br-desc, .subtitle {
    color: var(--text-secondary);
}

/* Numerical Clarity (KPI, Tables, Currencies, Clocks, Timers) */
.stat-info h2,
.kpi-card h2,
.kpi-details h2,
.stat-pill .num,
.nominal-text,
.clock-badge,
.date-badge,
#timerText,
#qrCountdown,
#qrisModalNominal,
.num-tabular {
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap;
}

/* --- Sticky Light Frosted Navbar (Public Landing, PPDB) --- */
.topbar {
    background: rgba(255, 247, 237, 0.78) !important;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid var(--soft-tint-border) !important;
    color: var(--soft-tint-text) !important;
}
.topbar span,
.topbar strong {
    color: var(--soft-tint-text) !important;
}

.navbar,
.nav {
    position: sticky !important;
    top: 0;
    z-index: 950 !important;
    background: rgba(255, 255, 255, 0.74) !important;
    backdrop-filter: blur(24px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 30px -12px rgba(15, 23, 42, 0.08) !important;
    overflow: visible !important;
}

.navbar .logo {
    color: var(--text-heading) !important;
}
.navbar .sub-brand {
    color: var(--primary-accent) !important;
    font-weight: 700 !important;
}

.nav-links a,
.navbar a,
.nav a {
    white-space: nowrap !important;
}
.nav-links a:hover {
    color: var(--primary-accent) !important;
}

.ta-pill {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
    border: 1px solid var(--soft-tint-border) !important;
    white-space: nowrap !important;
}

/* Smooth anchor scrolling below sticky navbar */
section[id],
footer[id],
.panel[id] {
    scroll-margin-top: 92px;
}

/* --- Landing Hero & Unified Footer --- */
.hero-section {
    background: transparent !important;
    padding-top: 48px !important;
}

.site-footer {
    background: rgba(255, 255, 255, 0.76) !important;
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-top: 1px solid var(--glass-border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.90);
    color: var(--text-secondary) !important;
}
.site-footer h4 { color: var(--text-heading) !important; }
.site-footer p,
.site-footer a { color: var(--text-secondary) !important; }
.site-footer a:hover { color: var(--primary-accent) !important; }
.footer-bottom {
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: var(--text-secondary) !important;
}

/* --- Sidebar Left Frosted Shell (All 49 Internal Pages) --- */
#sidebar.glass-panel,
#sidebar.sidebar {
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(24px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.70) !important;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.85), 8px 0 32px rgba(15, 23, 42, 0.06) !important;
}

.sidebar-container {
    background: transparent !important;
    border-right: none !important;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif !important;
}

.sidebar-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.07) !important;
}
.sidebar-header .material-symbols-rounded {
    color: var(--primary-accent) !important;
}
.sidebar-role-badge {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
    border-color: var(--soft-tint-border) !important;
}

.menu-item a {
    border-radius: 12px !important;
    color: #334155 !important;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.menu-item a:hover {
    background: var(--soft-tint-surface) !important;
    color: var(--primary-accent) !important;
    transform: translateX(2px);
}
.menu-item a.active {
    background: var(--primary-grad) !important;
    color: #FFFFFF !important;
    box-shadow: var(--tactile-btn-shadow) !important;
}
.has-submenu.open > a {
    background: var(--soft-tint-surface) !important;
    color: var(--primary-accent) !important;
}
.submenu {
    background: rgba(255, 255, 255, 0.56) !important;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 12px !important;
}
.submenu .menu-item a:hover {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
}
.submenu .menu-item a.active {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
    box-shadow: inset 3px 0 0 var(--primary-accent) !important;
}

#sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    color: var(--text-heading) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    border-radius: 12px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 20px rgba(15, 23, 42, 0.10) !important;
    transition: all 0.2s ease !important;
}
#sidebar-toggle-btn:hover {
    background: var(--soft-tint-surface) !important;
    color: var(--primary-accent) !important;
    transform: translateY(-2px);
}

/* --- Frosted Glass Cards, Header Banners & Auth Cards --- */
.panel,
.card,
.br-card,
.info-card,
.photo-card,
.stat-card,
.kpi-card,
.widget-card,
.exam-card,
.soal-box,
.book-card,
.ann-card,
.login-box,
.logout-card {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(24px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
    border-radius: var(--radius-card) !important;
}

.backgroundheader,
.header-banner,
.hero {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.84) 0%, rgba(255, 247, 237, 0.80) 100%) !important;
    backdrop-filter: blur(24px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    border-left: 6px solid var(--primary-accent) !important;
    box-shadow: var(--glass-shadow) !important;
    border-radius: var(--radius-card) !important;
    color: var(--text-heading) !important;
}
.backgroundheader::after,
.header-banner::after {
    background: radial-gradient(circle, rgba(249, 115, 22, 0.14) 0%, rgba(249, 115, 22, 0) 70%) !important;
}
.backgroundheader h1,
.backgroundheader h2,
.header-banner h1,
.header-banner h2,
.hero h1 {
    color: var(--text-heading) !important;
}
.backgroundheader p,
.backgroundheader div,
.header-banner p,
.hero p {
    color: var(--text-secondary) !important;
}
.backgroundheader .material-symbols-rounded,
.backgroundheader .material-symbols-outlined,
.header-banner .material-symbols-rounded,
.header-banner .material-symbols-outlined {
    color: var(--primary-accent) !important;
}

.backgroundheader a.btn,
.header-banner a.btn,
.backgroundheader a[href]:not(.btn),
.header-banner a[href]:not(.btn),
.backgroundheader button,
.header-banner button,
.timer-bar a.btn {
    background: var(--soft-tint-surface) !important;
    color: var(--soft-tint-text) !important;
    border: 1px solid var(--soft-tint-border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px -2px rgba(15, 23, 42, 0.08) !important;
}
.backgroundheader a.btn:hover,
.header-banner a.btn:hover,
.backgroundheader a[href]:not(.btn):hover,
.header-banner a[href]:not(.btn):hover,
.backgroundheader button:hover,
.header-banner button:hover,
.timer-bar a.btn:hover {
    background: var(--primary-grad) !important;
    color: #FFFFFF !important;
    border-color: var(--primary-accent) !important;
}
.backgroundheader a:hover .material-symbols-rounded,
.backgroundheader a:hover .material-symbols-outlined,
.header-banner a:hover .material-symbols-rounded,
.header-banner a:hover .material-symbols-outlined {
    color: #FFFFFF !important;
}

.date-badge,
.clock-badge {
    background: var(--soft-tint-surface) !important;
    color: var(--soft-tint-text) !important;
    border: 1px solid var(--soft-tint-border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Interactive Card Depth */
.stat-card,
.kpi-card,
.widget-card,
.exam-card,
.book-card,
.ann-card,
.role-card {
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease !important;
}
.stat-card:hover,
.kpi-card:hover,
.widget-card:hover,
.exam-card:hover,
.book-card:hover,
.ann-card:hover,
.role-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 24px 48px -12px rgba(15, 23, 42, 0.12) !important;
}
.stat-card::before {
    background: var(--primary-accent) !important;
}

/* --- Inner Inset Translucent Tiles --- */
.stat-pill,
.role-card,
.db-info,
.announcement-item,
.logo-preview-wrap,
.info-group p,
.tugas-card,
.opt-label,
.timer-bar {
    background: var(--glass-inset) !important;
    border: 1px solid rgba(255, 255, 255, 0.80) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.90), 0 6px 18px -6px rgba(15, 23, 42, 0.06) !important;
    border-radius: var(--radius-inset) !important;
}

.timer-bar {
    background: rgba(255, 255, 255, 0.84) !important;
    color: var(--text-heading) !important;
    backdrop-filter: blur(20px) saturate(160%);
    border-left: 5px solid var(--primary-accent) !important;
}

.announcement-item {
    border-left: 4px solid var(--primary-accent) !important;
}
.announcement-item.secondary {
    border-left: 4px solid var(--soft-tint-border) !important;
}
.announcement-item .icon {
    color: var(--primary-accent) !important;
}
.announcement-content h4 {
    color: var(--text-heading) !important;
}

/* --- Tactile 3D Buttons & Active Controls --- */
.btn,
button[type="submit"],
input[type="submit"] {
    border-radius: 11px !important;
    font-weight: 700 !important;
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease, filter 0.16s ease !important;
}
.btn:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    transform: translateY(-2px);
}
.btn:active,
button[type="submit"]:active,
input[type="submit"]:active {
    transform: translateY(1px);
}

.btn-primary,
input[type="submit"],
.btn-backup[href*="action=backup"] {
    background: var(--primary-grad) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: var(--tactile-btn-shadow) !important;
}
.btn-primary:hover,
input[type="submit"]:hover {
    background: var(--primary-hover) !important;
}

/* Preserve Distinct Semantic Status Buttons */
.btn-success {
    background: linear-gradient(135deg, #34D399, #10B981) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -3px rgba(16, 185, 129, 0.32), 0 2px 0 #059669 !important;
}
.btn-warning {
    background: linear-gradient(135deg, #FBBF24, #F59E0B) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -3px rgba(245, 158, 11, 0.32), 0 2px 0 #D97706 !important;
}
.btn-info {
    background: linear-gradient(135deg, #38BDF8, #0EA5E9) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -3px rgba(14, 165, 233, 0.32), 0 2px 0 #0284C7 !important;
}
.btn-danger,
.btn-restore {
    background: linear-gradient(135deg, #FB7185, #F43F5E) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -3px rgba(244, 63, 94, 0.32), 0 2px 0 #E11D48 !important;
}
.btn-secondary,
.btn-cancel {
    background: rgba(255, 255, 255, 0.78) !important;
    color: #334155 !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 6px rgba(15, 23, 42, 0.06) !important;
}
.btn-outline {
    background: var(--soft-tint-surface) !important;
    color: var(--soft-tint-text) !important;
    border: 1px solid var(--soft-tint-border) !important;
}

/* Soft Tint Badges & Chips */
.chip-accent {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
    border-color: var(--soft-tint-border) !important;
}
.chip {
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-heading);
}
.role-badge,
.badge-jenis,
.badge-kat,
.mapel-badge {
    background: var(--soft-tint-badge) !important;
    color: var(--soft-tint-text) !important;
    border: 1px solid var(--soft-tint-border) !important;
}
.ann-card {
    border-left: 4px solid var(--primary-accent) !important;
}

/* Semantic Status Pills Kept Distinct from Primary Accent */
.badge-success, .badge-ok, .badge-pub, .badge-akt, .badge-Hadir {
    background: #ECFDF5 !important;
    color: #065F46 !important;
    border: 1px solid #A7F3D0 !important;
}
.badge-pending, .badge-pin {
    background: #FFFBEB !important;
    color: #92400E !important;
    border: 1px solid #FDE68A !important;
}
.badge-failed, .badge-late {
    background: #FFF1F2 !important;
    color: #9F1239 !important;
    border: 1px solid #FECDD3 !important;
}

/* --- Form Controls & Inputs --- */
.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"],
select.form-control,
textarea.form-control {
    background: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
    border-radius: 11px !important;
    color: var(--text-heading) !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}
.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    background: rgba(255, 255, 255, 0.96) !important;
    border-color: var(--primary-accent) !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.16) !important;
    outline: none;
}

/* --- Clean Translucent Glass Tables --- */
.table-responsive,
.table-container,
.table-wrap {
    background: rgba(255, 255, 255, 0.56) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    border-radius: 16px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
}
table th,
table td {
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
}
table thead th,
table tr th {
    background: rgba(255, 247, 237, 0.78) !important;
    color: var(--soft-tint-text) !important;
    border-bottom: 1px solid rgba(254, 215, 170, 0.75) !important;
    font-weight: 700 !important;
}
table tbody td {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    color: var(--text-heading);
}
table tbody tr:hover td {
    background: rgba(255, 247, 237, 0.45) !important;
}
.th-nilai-group {
    background: rgba(255, 237, 213, 0.85) !important;
    color: var(--soft-tint-text) !important;
}
.th-nilai-item {
    background: rgba(255, 247, 237, 0.72) !important;
    border-top: 1px solid rgba(254, 215, 170, 0.65) !important;
}
.search-row td {
    background: rgba(255, 255, 255, 0.65) !important;
}

.pagination .active {
    background: var(--primary-grad) !important;
    border-color: var(--primary-accent) !important;
    color: #fff !important;
}

/* --- Modals (Outside Cards / Backdrop Safe) --- */
.modal,
.modal-overlay,
#modalQrisSiswa,
#modalNilaiTugas {
    z-index: 2500 !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.modal-content,
.modal-box,
.modal-card,
#modalQrisSiswa > div,
#modalNilaiTugas > div {
    background: var(--glass-modal) !important;
    backdrop-filter: blur(24px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%) !important;
    border: 1px solid rgba(255, 255, 255, 0.80) !important;
    border-radius: 1.5rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 28px 65px -15px rgba(15, 23, 42, 0.25) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
}

/* --- Select2 & SweetAlert2 Integration --- */
.select2-container--default .select2-selection--single {
    background: rgba(255, 255, 255, 0.82) !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
    border-radius: 11px !important;
    min-height: 42px;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-heading) !important;
}
.select2-dropdown {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--soft-tint-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--primary-accent) !important;
}

.swal2-container {
    z-index: 3500 !important;
}
.swal2-popup {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif !important;
    background: rgba(255, 255, 255, 0.90) !important;
    backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.78) !important;
    border-radius: 1.4rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 24px 60px -12px rgba(15, 23, 42, 0.22) !important;
}
.swal2-styled.swal2-confirm {
    background: var(--primary-grad) !important;
    border-radius: 10px !important;
}

/* --- Print View Safety Reset (Rapor, Kartu QR, Rekap) --- */
@media print {
    html,
    body {
        background: #FFFFFF !important;
        height: auto !important;
        overflow: visible !important;
    }
    body::before {
        display: none !important;
    }
    .panel,
    .card,
    .main,
    .table-responsive,
    .table-container,
    table,
    table th,
    table td {
        background: #FFFFFF !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        height: auto !important;
    }
}
