/*
 * File: psikotest_template.css
 * Path: assets/css/latihancat_template/
 * Deskripsi: Styling utama untuk layout kuis fullscreen (termasuk FOUC fix).
 */

/* --- FIX SVG DAN RESET DASAR --- */
html, body {
    box-sizing: border-box;
    /* Mencegah scroll dan memastikan layout fullscreen */
    overflow: hidden !important; 
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}

/* === SYSTEM STYLES (Wrapper Kuis) === */
#tni-latihan-root {
    --primary-color: #2e4a32;
    --bg-light: #f9f9f9; 
    --text-dark: #1f2937;
    --sidebar-width: 280px;
    
    position: fixed;
    left: 0;
    width: 100%;
    height: 100%; /* Default: Full height */
    top: 0;       /* Default: Top 0 */
    
    background-color: var(--bg-light);
    z-index: 99999;
    display: flex;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-dark);

    /* FIX FOUC: Sembunyikan secara default, lalu tampilkan menggunakan JS */
    opacity: 0;
    transition: opacity 0.3s ease; 
}

/* FIX: ADJUSTMENT WHEN ADMIN BAR IS ACTIVE (Desktop 32px) */
body.admin-bar #tni-latihan-root {
    top: 32px !important; 
    height: calc(100% - 32px) !important; 
}

/* FIX: ADJUSTMENT WHEN ADMIN BAR IS ACTIVE (Mobile 46px) */
@media screen and (max-width: 782px) {
    body.admin-bar #tni-latihan-root {
        top: 46px !important;
        height: calc(100% - 46px) !important; 
    }
}

/* Sidebar Styles */
.tni-sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10001;
    transition: width 0.3s ease, transform 0.3s ease;
    height: 100%;
    white-space: nowrap;
    overflow-x: hidden;
}
.tni-sidebar.desktop-closed { width: 0; border: none; }

.tni-sidebar-header {
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    flex-shrink: 0;
    min-width: var(--sidebar-width);
}

.tni-btn-back {
    text-decoration: none !important;
    color: white !important;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
    cursor: pointer;
}
.tni-btn-back:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }

/* Mengontrol SVG di tombol kembali */
.tni-btn-back svg { 
    width: 1em; /* Mengikuti ukuran font tombol */
    height: 1em;
    display: block;
}

.tni-sidebar-menu { flex: 1; overflow-y: auto; padding: 10px 0; min-width: var(--sidebar-width); }

/* Menu Items */
.tni-menu-cat {
    padding: 12px 20px 6px 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #9ca3af;
    display: flex; align-items: center; gap: 8px; letter-spacing: 0.5px;
}
/* Mengontrol SVG di kategori menu */
.tni-menu-cat svg { 
    width: 14px; 
    height: 14px; 
    color: var(--primary-color); 
    display: block;
}

.tni-menu-group {
    counter-reset: menu-counter;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.tni-menu-item {
    display: flex;
    padding: 8px 20px;
    text-decoration: none !important;
    color: var(--text-dark) !important;
    font-size: 15px;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    align-items: flex-start;
    line-height: 1.4;
}
.tni-menu-item::before {
    counter-increment: menu-counter;
    content: counter(menu-counter) ".";
    font-weight: 600;
    color: #9ca3af;
    margin-right: 10px;
    min-width: 18px;
}
.tni-menu-item:hover { background-color: #f9fafb; color: var(--primary-color) !important; }
.tni-menu-item:hover::before { color: var(--primary-color); }
.tni-menu-item.active {
    background-color: #f0fdf4;
    color: var(--primary-color) !important;
    border-left-color: var(--primary-color);
    font-weight: 700;
}
.tni-menu-item.active::before { color: var(--primary-color); }

/* Main Content */
.tni-main-layout {
    flex: 1; display: flex; flex-direction: column; position: relative;
    background-color: var(--bg-light); overflow: hidden;
}

/* Top Bar */
.tni-top-bar {
    background: white; padding: 0 20px; border-bottom: 1px solid #e5e7eb;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0; z-index: 10000; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    min-height: 45px; height: 50px;
}
.tni-header-left { display: flex; align-items: center; gap: 12px; height: 100%; }
.tni-logo-img { height: 30px; width: auto; display: block; }

.tni-page-title h1 { margin: 0; font-size: 18px; color: var(--primary-color); font-weight: 700; line-height: 1.2; }
.tni-toggle-btn {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--primary-color); display: flex; align-items: center; justify-content: center;
    padding: 4px; border-radius: 4px; transition: background 0.2s;
}
.tni-toggle-btn:hover { background-color: #f0fdf4; }

/* Mengontrol SVG ikon Layar Penuh */
#tniFullscreenBtn svg {
    width: 18px; 
    height: 18px;
    display: block;
}

/* Content Area */
.tni-content-scroll {
    flex: 1; overflow-y: auto; padding: 20px;
    -webkit-overflow-scrolling: touch;
}
.tni-exam-paper {
    background: transparent; box-shadow: none; border-radius: 0; border: none;
    max-width: 900px; margin: 0 auto; padding: 0; min-height: 500px;
}

.tni-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 10000;
}

/* Responsive */
@media (max-width: 768px) {
    .tni-sidebar {
        position: absolute; top: 0; bottom: 0; left: 0;
        transform: translateX(-100%); box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        width: var(--sidebar-width) !important;
    }
    .tni-sidebar.mobile-open { transform: translateX(0); }
    .tni-overlay.show { display: block; }
    .tni-content-scroll { padding: 15px; }
    .tni-header-left { gap: 10px; }
    .tni-page-title h1 { font-size: 16px; }
    .tni-logo-img { height: 28px; }
}