#main-content > main {
    zoom: 0.9;
}
body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

/* Custom scrollbar for better aesthetics */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: #a0aec0; /* gray-400 for light theme */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #718096; /* gray-500 for light theme */
}
.nav-item.active {
    background-color: #3b82f6;
    color: white;
}
.modal {
    transition: opacity 0.3s ease;
}
/* Style for read-only fields in modal */
.detail-view .form-input { display: none; }
.detail-view .form-value { display: block; }
.edit-view .form-input { display: block; }
.edit-view .form-value { display: none; }
.edit-view label { color: #9ca3af; }
.detail-view label { font-weight: 600; color: #9ca3af; }
.detail-view .form-value { color: #e5e7eb; margin-top: 0.25rem; }
.permission-group { background-color: #374151; padding: 1rem; border-radius: 0.5rem; }
.lms-content-section { display: none; }
.lms-content-section.active { display: block; }

/* THEME STYLES */
/* Dark Theme */
.theme-dark {
    --bg-primary: #111827; /* gray-900 */
    --bg-secondary: #1f2937; /* gray-800 */
    --bg-tertiary: #374151; /* gray-700 */
    --border-color: #4b5563; /* gray-600 */
    --text-primary: #f3f4f6; /* gray-100 */
    --text-secondary: #9ca3af; /* gray-400 */
}
/* Light Theme (Default) */
.theme-light {
    --bg-primary: #f3f4f6;    /* gray-100 */
    --bg-secondary: #ffffff;  /* white */
    --bg-tertiary: #e5e7eb;  /* gray-200 */
    --border-color: #d1d5db;  /* gray-300 */
    --text-primary: #1f2937;  /* gray-800 */
    --text-secondary: #6b7280;  /* gray-500 */
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}
.bg-main { background-color: var(--bg-primary); }
.bg-sidebar { background-color: var(--bg-secondary); }
.bg-card { background-color: var(--bg-secondary); }
.bg-input { background-color: var(--bg-tertiary); }
.text-main { color: var(--text-primary); }
.text-subtle { color: var(--text-secondary); }
.border-main { border-color: var(--border-color); }
.hover\:bg-tertiary:hover { background-color: var(--bg-tertiary); }

/* Custom override for light theme with dark sidebar */
.theme-light #sidebar {
    background-color: #1f2937; /* gray-800 */
    color: #f3f4f6; /* gray-100 */
    border-color: #4b5563; /* gray-600 */
}
.theme-light #sidebar .text-main {
    color: #f3f4f6; /* gray-100 */
}
.theme-light #sidebar .text-subtle {
    color: #9ca3af; /* gray-400 */
}
.theme-light #sidebar .hover\:bg-tertiary:hover {
    background-color: #374151; /* gray-700 */
}
.theme-light #sidebar .nav-item.active {
    background-color: #3b82f6;
    color: white;
}
.theme-light #sidebar #logout-btn {
    color: #f87171; /* red-400 */
}
.theme-light #sidebar #logout-btn:hover {
    background-color: #ef4444; /* red-500 */
    color: white;
}
.theme-light #sidebar .nav-item {
    color: #f3f4f6; /* gray-100 */
}

#sidebar.collapsed {
    width: 5rem;
}
#sidebar.collapsed .sidebar-text, #sidebar.collapsed .sidebar-arrow, #sidebar.collapsed .app-name-wrapper {
    display: none;
}
#sidebar.collapsed .nav-item, #sidebar.collapsed [id$="-toggle"] {
    justify-content: center;
}
#sidebar.collapsed .submenu {
    display: none !important;
}
.sidebar-icon {
    width: 1.25rem; /* w-5 */
    margin-right: 0.75rem; /* mr-3 */
    text-align: center;
}
#sidebar.collapsed .sidebar-icon {
    margin-right: 0;
}

.running-text-container {
    background-color: #1e40af; /* blue-800 */
    color: white;
    padding: 0.5rem;
    overflow: hidden;
    white-space: nowrap;
}
.running-text-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
}
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-btn.active { 
    border-color: #3b82f6;
    color: #3b82f6;
}

.info-box {
    display: flex;
    align-items: center;
    min-height: 90px;
    background: #fff;
    width: 100%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    border-radius: 0.25rem;
    color: white;
    overflow: hidden;
}
.info-box-icon {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90px;
    font-size: 45px;
}
.info-box-content {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.info-box-text {
    text-transform: uppercase;
    font-size: 0.875rem;
}
.info-box-number {
    display: block;
    font-weight: bold;
    font-size: 1.5rem;
}
.bg-aqua { background-color: #00c0ef !important; }
.bg-green { background-color: #00a65a !important; }
.bg-yellow { background-color: #f39c12 !important; }
.bg-red { background-color: #dd4b39 !important; }
.theme-light .info-box .info-box-text,
.theme-light .info-box .info-box-number {
    color: white;
}

.ta-card-active {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    min-width: 200px;
    max-width: 280px;
    width: 100%;
    flex: 1 1 auto;
}
.ta-card-active:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.ta-card-active.diktuk-bintara {
    background-color: #fef9c3;
    border-color: #facc15;
}
.ta-card-active.diktuk-tamtama {
    background-color: #fee2e2;
    border-color: #f87171;
}
.ta-card-active.dikbangspes {
    background-color: #dcfce7;
    border-color: #4ade80;
}
.ta-card-active.diktuk-bintara .ta-card-header {
    color: #a16207;
}
.ta-card-active.diktuk-tamtama .ta-card-header {
    color: #b91c1c;
}
.ta-card-active.dikbangspes .ta-card-header {
    color: #15803d;
}
#ta-aktif-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: flex-start;
}

.theme-light table thead.bg-tertiary {
    background-color: #1E40AF !important;
}
.theme-light table thead th {
    color: #FFFFFF;
}
.theme-light table tbody tr {
    background-color: #FFFFFF;
    border-color: #E5E7EB;
}
.theme-light table tbody tr:nth-child(even) {
    background-color: #F9FAFB;
}
.theme-light table tbody tr:hover {
    background-color: #EFF6FF;
}
.theme-dark table thead.bg-tertiary {
    background-color: #3B82F6;
}
.theme-dark table tbody tr {
    background-color: var(--bg-secondary);
}
.theme-dark table tbody tr:nth-child(even) {
    background-color: var(--bg-primary);
}
.theme-dark table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.mapel-pill {
    display: inline-flex;
    align-items: center;
    background-color: #3b82f6;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.mapel-pill-remove {
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
}
#mapel-dropdown .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
}
#mapel-dropdown .dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.academic-card {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    color: #1e3a8a;
    border-radius: 15px;
    padding: 15px;
    max-width: 450px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1), 0 6px 6px rgba(0,0,0,0.1);
    border: 1px solid #a5b4fc;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.academic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.15), 0 8px 10px rgba(0,0,0,0.1);
}
.academic-card .card-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #a5b4fc;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 11px;
    text-align: center;
}
.academic-card .logo {
    width: 40px;
    height: 40px;
    margin-right: 15px;
}
.academic-card .card-body {
    display: flex;
    align-items: center;
    gap: 15px;
}
.academic-card .photo-container img {
    width: 100px;
    height: 125px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.academic-card .info-container {
    font-family: 'Courier New', Courier, monospace;
}
.academic-card .nama {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.academic-card .info-item {
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.academic-card .card-footer {
    margin-top: 15px;
    background-color: white;
    padding: 5px;
    border-radius: 8px;
}
.academic-card #kta-barcode {
    width: 100%;
}

.ta-tabs-container {
    position: relative;
    display: inline-block;
}
.ta-tabs-container nav {
    background-color: var(--bg-tertiary);
    border-radius: 999px;
    padding: 0.25rem;
    display: flex;
}
.ta-tab-btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease-in-out;
    position: relative;
    z-index: 10;
}
.ta-tab-btn.active {
    color: white;
}
.theme-light .ta-tab-btn.active {
    color: var(--text-primary);
}
#ta-tab-slider, #e-album-tab-slider {
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    height: auto;
    background-color: #3b82f6;
    border-radius: 999px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
}
.theme-light #ta-tab-slider, .theme-light #e-album-tab-slider {
    background-color: #ffffff;
}

.page-break-inside-avoid {
    page-break-inside: avoid;
}
.print-header {
    display: none;
}
.score-pill {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.875rem;
    margin-right: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.theme-light .score-pill {
    color: #374151;
}
.score-pill:hover {
    background-color: #4b5563;
}
.theme-light .score-pill:hover {
    background-color: #d1d5db;
}
.score-delete-btn {
    margin-left: 8px;
    border: none;
    background: none;
    color: #9ca3af;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.score-delete-btn:hover {
    color: #ef4444;
}

/* ======================================================================= */
/* ======================== KODE CETAK TRANSKRIP (FINAL) ================= */
/* ======================================================================= */
.page { 
    background-color: white; 
    color: black; 
    box-shadow: 0 0 10px rgba(0,0,0,0.2); 
    margin: 1rem auto; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.page.paper-a4 {
    width: 210mm;
    height: 297mm;
}
.page.paper-folio {
    width: 215.9mm;
    height: 330mm;
}


@media print {
    @page {
      size: A4; /* Default, akan di-override jika perlu */
      margin: 0;
    }

    @page folio {
        size: 8.5in 13in;
        margin: 0;
    }

    body, html {
        background: white !important;
        color: black !important;
        width: 100%;
        height: 100%;
    }
    
    .no-print, #app-container, #login-container, #loading-overlay, .grecaptcha-badge {
        display: none !important;
    }
    
    #modal-container, #transkrip-detail-modal, .printable-only, #printable-transcript, #transkrip-nilai-section, #transkrip-nilai-section > div, #print-area {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .modal > div {
        box-shadow: none !important;
        max-height: none !important;
    }

    .page { 
        box-shadow: none !important; 
        margin: 0 !important;
        border: none !important;
        width: 100% !important;
        height: 100% !important;
        page-break-after: always;
    }

    .page.paper-folio {
        page: folio;
    }
    
    .page:last-child {
        page-break-after: avoid;
    }

    /* PERBAIKAN: Memaksa warna teks header tabel menjadi hitam pekat saat dicetak */
    table thead th, table thead td {
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* PERBAIKAN: Mengatur agar hanya baris nomor kolom yang diulang */
    #printable-transcript thead .header-number {
        display: table-row-group;
    }
}

/* =============================================== */
/* === KODE CSS UNTUK KARTU TANDA SISWA BARU === */
/* =============================================== */

.new-kts-card {
    position: relative;
    width: 304px;
    height: 192px;
    background-image: url('https://ik.imagekit.io/d3nxlzdjsu/TEMPLATE%20KTS%20POLAIR.png?updatedAt=1760422816258');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.new-kts-card:hover {
    transform: scale(1.03);
}

/* * ATURAN DEFAULT UNTUK POSISI, FONT, DAN WARNA 
 * (Dipindahkan dari dashboard.js untuk menghilangkan "flash" layout)
*/

.new-kts-card .kts-foto,
.new-kts-card .kts-nama-print,
.new-kts-card .kts-nosis-print,
.new-kts-card .kts-pendidikan-print {
    position: absolute;
    margin: 0;
    padding: 0;
    /* Font default: */
    font-family: 'Roboto Bold', sans-serif;
    font-weight: bold;
    color: #0D2B5B;
    text-transform: uppercase;
}

.new-kts-card .kts-foto {
    object-fit: cover;
    background-color: #e2e8f0;
    /* Posisi default: */
    width: 65px;
    height: 81px;
    top: 24px;
    right: 21px;
}

.kts-nama-print {
    /* Posisi default: */
    font-size: 16px;
    top: 108px;
    left: 27px;
}

.kts-nosis-print {
    /* Posisi default: */
    font-size: 12px;
    top: 128px;
    left: 27px;
}

.kts-pendidikan-print {
    /* Posisi default: */
    font-size: 11px;
    top: 142px;
    left: 27px;
}
/* --- AKHIR ATURAN DEFAULT --- */


@media print {
    /* === [START] PERBAIKAN TOTAL ATURAN CETAK KTS === */
    /* Target: 10 kartu (2 kolom x 5 baris) di A4 Portrait (210mm x 297mm)
      Ukuran Kartu Standar: 85.6mm x 54mm
    */
    
    #print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm; /* Lebar A4 */
        height: 297mm; /* Tinggi A4 */
        box-sizing: border-box; 
        
        /* 1. Gunakan GRID untuk 2x5 */
        display: grid; 
        grid-template-columns: 1fr 1fr; /* 2 kolom sama rata */
        grid-template-rows: repeat(5, auto); /* 5 baris, tinggi otomatis */
        
        /* 2. Hitung Padding & Gap agar presisi */
        /* Padding Halaman (1cm atas/bawah, 1.3cm kiri/kanan) */
        padding: 10mm 13.7mm; 
        
        /* Jarak Antar Kartu (Horizontal: 1cm, Vertikal: 2.2mm) */
        column-gap: 10mm; 
        row-gap: 2.2mm; 
        
        /* * Kalkulasi ( (210mm - (2*13.7mm padding)) - 10mm gap ) / 2 = 85.6mm per kartu
         * ( (297mm - (2*10mm padding)) - (4*2.2mm gap) ) / 5 = 54.04mm per kartu
        */
    }
    
    #print-area .new-kts-card {
        page-break-inside: avoid; /* Wajib agar kartu tidak terpotong */
        transform: scale(1); 
        box-shadow: none !important; 
        margin: 0; /* Hapus margin otomatis */
        
        /* 3. Paksa Ukuran Kartu Sesuai Standar CR80 */
        width: 85.6mm !important;
        height: 54mm !important;
        
        /* 4. Paksa Cetak Background */
        background-image: url('https://ik.imagekit.io/d3nxlzdjsu/TEMPLATE%20KTS%20POLAIR.png?updatedAt=1760422816258') !important;
        background-size: 100% 100% !important; /* Paksa gambar mengisi kartu */
        background-position: center;
        background-repeat: no-repeat;
        background-color: transparent !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        
        border: none !important; /* Hapus border sisaan */
    }

    /* 5. Pastikan Teks Terbaca */
    #print-area .new-kts-card .kts-nama-print,
    #print-area .new-kts-card .kts-nosis-print,
    #print-area .new-kts-card .kts-pendidikan-print {
        color: #0D2B5B !important; /* Warna biru tua asli dari desain */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    /* === [END] PERBAIKAN TOTAL ATURAN CETAK KTS === */
}
/* --- AKHIR KODE CETAK KTS --- */


/* Tambahkan di akhir file public/style.css */
.dashboard-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: 0.5rem;
    color: white;
    text-align: center;
    transition: transform 0.2s ease-in-out;
    min-height: 100px;
}
.dashboard-action-btn:hover {
    transform: translateY(-4px);
}


/* Tambahkan di akhir file public/style.css */

.academic-card {
    user-select: none; /* Mencegah seleksi teks standar */
    -webkit-user-select: none; /* Mencegah seleksi teks untuk browser Safari/Chrome */
    -moz-user-select: none; /* Mencegah seleksi teks untuk browser Firefox */
    -ms-user-select: none; /* Mencegah seleksi teks untuk browser IE/Edge */
}


/* ========================================================== */
/* ===     STYLE MENU IKON DASHBOARD SISWA (SEPERTI DANA) === */
/* ========================================================== */

/* 1. TOMBOL (Link <a>) */
.dashboard-icon-btn {
    display: flex;
    flex-direction: column; /* Ikon di atas, teks di bawah */
    align-items: center;
    justify-content: flex-start;
    text-decoration: none;
    color: var(--color-main); /* Warna teks label */
    transition: transform 0.2s, opacity 0.2s;
}
.dashboard-icon-btn:hover {
    transform: translateY(-3px); /* Efek 'hover' sedikit naik */
    opacity: 0.8;
}

/* 2. BACKGROUND IKON (LINGKARAN BERWARNA) */
.dashboard-icon-btn .icon-wrapper {
    width: 52px;  /* Ukuran lingkaran */
    height: 52px; /* Ukuran lingkaran */
    border-radius: 9999px; /* Bulat sempurna */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px; /* Jarak antara ikon dan teks */
    /* Warna background diambil dari class Tailwind di HTML (cth: .bg-blue-500) */
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.1);
}

/* 3. IKON (Font Awesome) DI DALAM LINGKARAN */
.dashboard-icon-btn .icon-wrapper i {
    font-size: 1.3rem; /* 22px */
    color: #FFFFFF !important; /* Warna ikonnya (PUTIH) */
}

/* 4. TEKS LABEL DI BAWAH IKON */
.dashboard-icon-btn .icon-label {
    font-size: 0.8rem; /* 13px */
    font-weight: 500;
    color: var(--color-main);
    line-height: 1.2;
}

/* =Ganti jadi .text-main -- Hapus .color-main */
.dashboard-icon-btn .icon-label {
    color: var(--text-main);
}
.dashboard-icon-btn {
    color: var(--text-main);
}


/* ========================================================== */
/* ===             ATURAN TAMPILAN (MEDIA QUERIES)        === */
/* ========================================================== */

/* 1. ATURAN UNTUK DESKTOP (Layar besar, 1024px ke atas) */
@media (min-width: 1024px) {
    /* Sembunyikan grid ikon mobile di desktop */
    #mobile-dashboard-icons {
        display: none !important;
    }
    
    /* Pastikan tombol desktop terlihat */
    #desktop-dashboard-buttons {
        display: grid !important;
    }
    
    /* Pastikan Peringkat, Grafik, & Pengumuman terlihat di desktop */
    #peringkat-card, #grafik-card, #pengumuman-card {
        display: block !important;
    }

    /* Sembunyikan header "Selamat Datang" versi mobile */
    #welcome-header-block {
        display: none !important; /* Sembunyikan di desktop */
    }
    
    /* Tampilkan header "Selamat Datang" versi desktop */
    #desktop-welcome-header {
        display: block !important;
    }
}

/* 2. ATURAN UNTUK MOBILE & TABLET (Layar kecil, 1023px ke bawah) */
@media (max-width: 1023px) {
    /* Sembunyikan tombol-tombol besar di mobile */
    #desktop-dashboard-buttons {
        display: none !important;
    }
    
    /* Pastikan grid ikon mobile terlihat */
    #mobile-dashboard-icons {
        display: grid !important;
    }

    /* HILANGKAN KARTU PERINGKAT, GRAFIK, & PENGUMUMAN DI MOBILE */
    #peringkat-card, #grafik-card, #pengumuman-card {
        display: none !important;
    }

    /* Sembunyikan header "Selamat Datang" versi desktop */
    #desktop-welcome-header {
        display: none !important;
    }
    
    /* Tampilkan header "Selamat Datang" versi mobile */
    #welcome-header-block {
        /* [MODIFIKASI DI SINI] Ubah dari 'block' menjadi 'none' */
        display: none !important;
        text-align: center;
        margin-top: -0.5rem; /* Tarik ke atas, lebih dekat ke running text */
        margin-bottom: 0.5rem; /* Kurangi jarak bawah */
    }
    #welcome-header-block h2 {
        font-size: 1.1rem; /* Perkecil font (dari 2xl) */
    }
    #welcome-header-block p {
        font-size: 0.8rem; /* Perkecil font (dari 1rem) */
    }

    /* Perkecil Running Text di Mobile */
    .running-text-container {
        padding: 0.3rem !important;
        font-size: 0.75rem !important;
    }
}