@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

:root {
    --primary-bg: #0b0e14;
    --surface: #161b22;
    --surface-glass: rgba(22, 27, 34, 0.7);
    --accent: #6366f1;
    --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --nav-h: 70px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background-color: var(--primary-bg);
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(168, 85, 247, 0.1) 0%, transparent 40%);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

/* Hiding & Structure */
.view { display: none !important; padding-bottom: 100px; }
.view.active { display: block !important; animation: fadeIn 0.4s ease; }
[hidden] { display: none !important; }
.print-only {
    position: fixed;
    top: 0;
    left: -10000px;
    width: 215.9mm;
    z-index: -1000;
}

/* Modal System */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}
.modal-content {
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-overlay.active .modal-content {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Login Screen - Fixed & Absolute Top */
#login-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&q=80&w=2072') center/cover;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#login-screen::before {
    content: ''; position: absolute; inset: 0; background: rgba(11, 14, 20, 0.85);
}
#login-screen.active { display: flex !important; }

.login-card {
    position: relative; width: 90%; max-width: 400px; padding: 2.5rem;
    background: var(--surface-glass); backdrop-filter: blur(20px);
    border: 1px solid var(--border); border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Typography Scale */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; color: var(--text-dim); }
 
 .salat-pill {
     background: var(--surface);
     border: 2px solid var(--border);
     color: var(--text-dim);
     padding: 1.25rem 1rem;
     border-radius: 16px;
     font-weight: 800;
     cursor: pointer;
     transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
     flex: 1;
     min-width: 100px;
     text-align: center;
     font-size: 0.85rem;
     letter-spacing: 0.5px;
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
     gap: 0.5rem;
 }
 
 .salat-pill.active {
     background: var(--success);
     color: white;
     border-color: rgba(255,255,255,0.3);
     box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
     transform: translateY(-4px);
 }
 
 .salat-pill:hover:not(.active) {
     border-color: var(--accent);
     color: var(--text);
     background: rgba(99, 102, 241, 0.1);
 }
 
 .adab-pill.active {
     background: #a855f7;
     box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4);
 }

/* Navigation */
.glass-nav {
    height: var(--nav-h); padding: 0 1.5rem;
    background: rgba(11, 14, 20, 0.8); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 1000;
}

.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 450px;
    height: 70px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.nav-item {
    background: none; border: none; color: var(--text-dim);
    font-size: 0.75rem; font-weight: 600; text-align: center;
    transition: all 0.2s; cursor: pointer; display: flex; flex-direction: column; align-items: center;
}
.nav-item.active { color: var(--accent); transform: translateY(-3px); }
.nav-item span { font-size: 1.5rem; margin-bottom: 4px; }

/* Dashboard Grid */
.dashboard-grid {
    max-width: 1200px; margin: 0 auto; padding: 1.5rem;
    display: grid; grid-template-columns: 1fr; gap: 1.5rem;
}

@media (min-width: 900px) {
    .dashboard-grid { grid-template-columns: 340px 1fr; }
}

/* Cards & Components */
.glass-card {
    background: var(--surface-glass); border: 1px solid var(--border);
    border-radius: 20px; padding: 1.5rem; position: relative; overflow: hidden;
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
}
.level-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 900;
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    position: relative;
    flex-shrink: 0;
}
.level-circle::after {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0.3;
}
.level-info h2 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.level-info .rank-title {
    margin: 2px 0 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.xp-bar-outer {
    height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 4px; overflow: hidden;
    margin: 1rem 0;
}
.xp-bar-inner {
    height: 100%; background: var(--accent-gradient); border-radius: 4px; transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Profile Card Grid */
.profile-card-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-top: 1rem;
}
.profile-field {
    background: rgba(255, 255, 255, 0.03); 
    padding: 1.25rem 1rem; 
    border-radius: 16px; 
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}
.profile-field:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.1);
}
.profile-field .label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.profile-field .value { font-size: 1rem; font-weight: 600; margin-top: 6px; color: var(--text); }

/* Buttons */
.btn-primary {
    background: var(--accent-gradient); color: white; border: none;
    padding: 1rem; border-radius: 14px; font-weight: 700; cursor: pointer; transition: 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }

/* Inputs */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.5rem; }
input, select {
    width: 100%; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
    border-radius: 12px; padding: 0.75rem 1rem; color: white; font-size: 1rem; outline: none; transition: 0.2s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }

/* Hide default browser password reveal and clear buttons (Edge/IE) */
input::-ms-reveal,
input::-ms-clear {
    display: none;
}


option {
    background-color: #161b22;
    color: white;
}

/* Utils */
.mt-2 { margin-top: 2rem; }
.accent-text { color: var(--accent); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }

/* Journal list */
.journal-card {
    background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border);
    margin-bottom: 0.75rem; border-radius: 14px; padding: 1rem;
    display: flex; justify-content: space-between; align-items: center;
}

/* Premium Raport Styling */
.raport-page {
    background: #fff;
    color: #1a1a1a;
    padding: 3rem;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
    line-height: 1.6;
}
.raport-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: #0b0e14;
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.raport-sub {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 2rem;
    border-bottom: 3px double #0b0e14;
    padding-bottom: 1rem;
}
.raport-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}
.raport-table th {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: #475569;
}
.raport-table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
}
.raport-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
}
.sig-box {
    text-align: center;
    min-width: 200px;
}
.sig-line {
    margin-top: 5rem;
    border-top: 1px solid #1a1a1a;
    padding-top: 0.5rem;
    font-weight: 600;
}

/* Integrated Student Modal Styles */
.modal-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.modal-tabs::-webkit-scrollbar { display: none; }
.modal-tab-btn {
    flex: 1;
    padding: 0.85rem;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: all 0.2s;
}
.modal-tab-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.modal-tab-btn.active { background: var(--accent); color: white; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; animation: fadeIn 0.3s ease; }

.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-pill.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-pill.danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Jurnal Quiz Options */
.option-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 1.25rem 1rem;
    margin-bottom: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.option-btn:hover {
    background: rgba(168, 85, 247, 0.15); /* Purple accent */
    border-color: #a855f7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

.option-btn:active {
    transform: translateY(0);
    background: rgba(168, 85, 247, 0.3);
}

/* Add minor pulse animation for the active question */
@keyframes fadeInSlide {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.option-btn {
    animation: fadeInSlide 0.3s ease-out forwards;
}

/* Admin & Dinas Additional Styles */
.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.6rem 1.25rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-btn:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.tab-btn.active { 
    background: var(--accent); 
    color: white; 
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.dinas-tab { display: none; }
.dinas-tab.active { display: block; animation: fadeIn 0.4s ease; }

.monitoring-card {
    display: flex; gap: 1rem; align-items: center; padding: 1.25rem;
    background: rgba(255,255,255,0.02); border: 1px solid var(--border);
    border-radius: 16px; margin-bottom: 0.75rem;
}

#dinas-audit-list tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 600px) {
    .dashboard-grid { padding: 1rem; gap: 1rem; }
    .glass-nav { padding: 0 1rem; }
    h1 { font-size: 1.5rem; }
    #super-actions-header { flex-wrap: wrap; }
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

.btn-page {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-page:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 0 1rem;
}

/* Import Styles */
#import-dropzone {
    transition: all 0.3s ease;
}

#import-dropzone.dragover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
    transform: scale(1.02);
}

.import-error-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(239, 68, 68, 0.1);
    font-size: 0.8rem;
    color: var(--danger);
}

.import-success-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
    font-size: 0.8rem;
    color: var(--success);
}

.day-btn {
    padding: 1.25rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.day-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.4);
}
.day-btn:active {
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: var(--text-dim);
}

/* =========================================
   PRINT STYLES (F4 PAGE - 215mm x 330mm)
   ========================================= */
@media print {
    @page {
        size: 215.9mm 330.2mm; /* F4 / Folio size */
        margin: 0;
    }

    body {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide everything except the print view */
    body > *:not(#print-rapor-view) {
        display: none !important;
    }

    .print-only {
        display: block !important;
        position: static !important;
        left: 0 !important;
    }

    #print-rapor-view {
        width: 215.9mm;
        margin: 0;
        padding: 0;
        background: white;
    }

    .rapor-page {
        width: 215.9mm;
        height: 330.2mm;
        box-sizing: border-box;
        position: relative;
        padding: 15mm;
        page-break-after: always;
        overflow: hidden;
    }

    /* Page 1 Cover Elements */
    .rapor-border {
        position: absolute;
        width: 50mm;
        height: 50mm;
        background: #e0e0e0; /* Placeholder color */
    }
    .border-tl { top: 0; left: 0; }
    .border-tr { top: 0; right: 0; }
    .border-bl { bottom: 0; left: 0; }
    .border-br { bottom: 0; right: 0; }

    .rapor-header-logos {
        margin-top: 10mm;
    }
    .rapor-header-logos-small {
        margin-top: 5mm;
        margin-bottom: 10mm;
    }

    .rapor-title-container {
        text-align: center;
        margin-top: 30mm;
    }

    .rapor-center-logo {
        margin-top: 30mm;
    }

    .rapor-student-info-box {
        margin: 40mm auto 0;
        width: 80%;
        border: 2px solid #1a237e;
        border-radius: 15px;
        padding: 15mm 10mm;
    }

    .rapor-info-table {
        width: 100%;
        font-size: 14px;
        font-weight: 700;
        line-height: 2.5;
    }
    
    .rapor-small-info {
        font-size: 10px;
        line-height: 1.5;
    }

    .rapor-section-title {
        font-size: 12px;
        font-weight: 800;
        text-align: center;
        margin-bottom: 10px;
    }

    .rapor-partisipasi-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 5px;
    }

    .rapor-charts-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .rapor-chart-box {
        border: 1px solid #e0e0e0;
        padding: 10px;
        position: relative;
    }

    .rapor-chart-header {
        font-size: 10px;
        font-weight: 800;
        color: #1a237e;
        margin-bottom: 5px;
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .rapor-star {
        background: #ffeb3b;
        color: #f57f17;
        font-size: 10px;
        padding: 2px 5px;
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    }

    .rapor-avg-box {
        width: 40px;
        text-align: center;
        margin-right: 10px;
    }
    .rapor-avg-score {
        font-size: 18px;
        font-weight: 900;
        color: #1a237e;
        margin: 5px 0;
    }

    .rapor-canvas-container {
        flex: 1;
        height: 80px;
    }

    .rapor-chart-desc {
        font-size: 9px;
        color: #555;
        margin-top: 5px;
        min-height: 25px;
    }

    .rapor-notes-box {
        border: 1px solid #000;
        height: 80px;
        position: relative;
    }
    .rapor-notes-title {
        position: absolute;
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        background: white;
        padding: 0 10px;
        font-size: 10px;
        font-weight: bold;
    }

    /* specific canvas resets */
    canvas {
        max-width: 100%;
        height: 100% !important;
    }
}
