/* Root Variables - Modern Palette & CAT Colors */
:root {
    --primary-color: #0F52BA;
    /* Sapphire Blue */
    --secondary-color: #F4D03F;
    /* Gold */
    --accent-color: #E74C3C;
    /* Red */
    --bg-color: #F8F9FA;
    --text-color: #2C3E50;
    --white: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.95);

    /* CAT BKN Specific Colors */
    --cat-header: #2980B9;
    --cat-sidebar: #ECF0F1;
    --cat-active: #3498DB;
    --cat-answered: #27AE60;
    --cat-text: #000000;
    --cat-twk: #E67E22;
    --cat-tiu: #2980B9;
    --cat-tkp: #27AE60;
    --success-color: #27ae60;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- HEADER & NAVIGATION --- */
.landing-header {
    background: var(--glass-bg);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo-img,
.nav-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.nav-links button,
.nav-links a {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-color);
    margin-left: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.3s;
    text-decoration: none;
}

.nav-links button:hover,
.nav-links a:hover {
    color: var(--primary-color);
}

.btn-primary {
    background: #a8d5e2;
    /* Pastel Blue */
    color: #2c3e50;
    /* Darker text for contrast */
    padding: 10px 25px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
}

.btn-primary:hover {
    background: #8fcaca;
    /* Slightly darker pastel on hover */
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(135, 206, 235, 0.4);
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    display: flex;
    align-items: center;
    padding: 8rem 8% 6rem;
    gap: 60px;
    min-height: 90vh;
    background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(15, 82, 186, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
}

.hero-content {
    flex: 1;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 25px;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, var(--primary-color), #2980b9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.2rem;
    color: #5d6d7e;
    margin-bottom: 40px;
    max-width: 95%;
}

.hero-image {
    flex: 1;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    max-width: 550px;
    border-radius: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s ease;
    border: 8px solid rgba(255, 255, 255, 0.8);
}

.hero-image img:hover {
    transform: perspective(1000px) rotateY(0deg) scale(1.02);
}

/* --- STATS SECTION --- */
.stats-section {
    background: var(--primary-color);
    padding: 60px 8%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    color: white;
    text-align: center;
    gap: 30px;
}

.stat-item {
    flex: 1;
    min-width: 200px;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* --- FEATURES SECTION --- */
.features-section {
    padding: 6rem 8%;
    background: #ffffff;
    text-align: center;
}

.features-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card-modern {
    background: #fdfdfd;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    align-items: flex-start;
    gap: 25px;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #eee;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    text-align: left;
}

.feature-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    background: white;
}

.f-icon-bg {
    background: #EAF2FF;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.f-content h3 {
    margin: 0 0 15px;
    font-size: 1.35rem;
    color: var(--primary-color);
    font-weight: 700;
}

.f-content p {
    color: #636e72;
    margin: 0;
}

/* --- FAQ SECTION --- */
.faq-section {
    padding: 80px 8%;
    background: #f8f9fa;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: white;
    border-radius: 10px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.2s;
}

.faq-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.faq-item summary {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.1rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--secondary-color);
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    margin-top: 15px;
    color: #636e72;
    border-top: 1px solid #f1f2f6;
    padding-top: 15px;
}

/* --- PRODUCTS PAGE LAYOUT --- */
.products-container {
    padding: 4rem 8%;
    min-height: 80vh;
}

.section-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.product-section {
    margin-bottom: 4rem;
}

.section-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--text-color);
}

.badge-free {
    background: var(--success-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.product-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.product-card.bimbel {
    border-top: 5px solid var(--cat-header);
}

.card-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.product-card h3 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.25rem;
}

.product-card p {
    color: #666;
    margin-bottom: 25px;
    flex: 1;
    font-size: 0.95rem;
}

.price-tag {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Level Grid */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.level-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #eee;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.level-card:hover {
    transform: translateY(-3px);
}

.level-card.available {
    border-color: var(--cat-answered);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.1);
}

.level-card.locked {
    background: #f8f9fa;
    opacity: 0.7;
}

.level-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #ccc;
}

.level-card.available .level-badge {
    color: var(--primary-color);
}

.level-card .price {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 15px 0 5px;
    color: var(--text-color);
}

.level-card .status {
    font-size: 0.85rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.level-card.available .status {
    color: var(--cat-answered);
}

.level-card.locked .status {
    color: #e74c3c;
}

/* Buttons in Products */
.btn-product,
.btn-level {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    margin-top: auto;
}

.btn-product:hover,
.btn-level:hover {
    background: #0b3d8c;
}

.btn-product[disabled] {
    background: #ccc;
    cursor: not-allowed;
}

/* Mini Group Buttons */
.mini-btn-grid {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 15px;
}

.btn-mini {
    flex: 1;
    background: white;
    color: var(--primary-color);
    padding: 10px 5px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-mini:hover {
    background: var(--primary-color);
    color: white;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content,
.product-modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    text-align: left;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.close-modal:hover {
    color: var(--accent-color);
}

.modal h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.modal-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cat-answered);
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #edeff1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.pin-input-group {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: #d7bde2;
    /* Pastel Purple */
    color: #4a235a;
    border: none;
    padding: 0 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #c39bd3;
}

.pin-help {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.full-width {
    width: 100%;
}

/* --- EXAM INTERFACE (CAT) --- */
.cat-body {
    background: #ecf0f1;
}

.cat-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    cursor: pointer;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 15px;
    border-radius: 4px;
    color: white;
}

.btn-exit {
    background: #f1948a;
    /* Pastel Red */
    border: none;
    color: #7b241c;
    padding: 8px 15px;
    border-radius: 50px;
    /* Rounded */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    transition: background 0.2s;
}

.btn-exit:hover {
    background: #ec7063;
}

/* Control Buttons (Prev/Next/Start) in Exam */
.btn-control {
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.btn-prev {
    background: #f9e79f;
    /* Pastel Yellow */
    color: #7d6608;
}

.btn-prev:hover {
    background: #f7dc6f;
}

.btn-next {
    background: #a9dfbf;
    /* Pastel Green */
    color: #145a32;
}

.btn-next:hover {
    background: #7dcea0;
}

.btn-finish {
    background: #aed6f1;
    /* Pastel Blue */
    color: #154360;
}

.btn-finish:hover {
    background: #85c1e9;
}

.cat-container {
    display: flex;
    margin-top: 60px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    z-index: 999;
}

.sidebar-header {
    padding: 15px;
    background: #f1f2f6;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
}

.question-grid {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    align-content: start;
}

.q-nav-btn {
    aspect-ratio: 1/1;
    background: white;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    cursor: pointer;
}

.q-nav-btn.active {
    background: var(--cat-active);
    color: white;
    border-color: var(--cat-active);
}

.q-nav-btn.answered {
    background: var(--cat-answered);
    color: white;
    border-color: var(--cat-answered);
}

.q-nav-btn.cat-twk {
    border-bottom: 3px solid var(--cat-twk);
}

.q-nav-btn.cat-tiu {
    border-bottom: 3px solid var(--cat-tiu);
}

.q-nav-btn.cat-tkp {
    border-bottom: 3px solid var(--cat-tkp);
}

.main-area {
    flex: 1;
    background: #ecf0f1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question-card,
.discussion-card {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f2f6;
    margin-bottom: 20px;
}

.badge-category {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.q-text {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: #2c3e50;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 10px;
}

.option-label:hover {
    border-color: var(--cat-active);
    background: #fdfdfd;
}

.controls-area {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    position: sticky;
    bottom: 0;
}

.mobile-toggle,
.close-sidebar {
    display: none;
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {

    /* Header & Nav */
    .landing-header {
        padding: 1rem 5%;
        flex-wrap: wrap;
        /* Allow wrapping */
        justify-content: space-between;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: center;
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
        gap: 20px;
        border-top: 1px solid #f0f0f0;
        animation: slideDown 0.3s ease forwards;
        z-index: 1001;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links button,
    .nav-links a {
        margin: 0;
        /* Remove left margin */
        width: 80%;
        text-align: center;
        padding: 10px;
        display: block;
    }

    .nav-links .btn-primary {
        width: 80%;
        /* Consistent width */
        margin-top: 10px;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Hero Section */
    .hero-section {
        flex-direction: column-reverse;
        /* Image on top usually looks nice, or text. Let's try column (text top) first. Wait user code has text first. `column-reverse` puts image first. Let's do column so text is first, consistent with HTML order. Wait, HTML is Text then Image. So flex-direction: column. */
        flex-direction: column;
        padding: 6rem 5% 4rem;
        /* Reduced padding */
        text-align: center;
        min-height: auto;
        gap: 40px;
    }

    .hero-content h1 {
        font-size: 2.2rem;
        /* Smaller font */
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-content div {
        justify-content: center;
        /* Center the buttons */
    }

    .hero-image img {
        max-width: 100%;
        /* Full width on mobile */
        transform: none !important;
        /* Remove 3D effect on mobile for performance/layout */
    }

    /* Features */
    .features-grid-modern {
        grid-template-columns: 1fr;
        /* Single column */
    }

    .feature-card-modern {
        padding: 25px;
        /* Smlaller padding */
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .f-icon-bg {
        margin-bottom: 15px;
    }

    /* Stats */
    .stat-item {
        min-width: 40%;
        margin-bottom: 20px;
    }
}

/* Start Screen Styling (New) */
.start-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.start-screen-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    text-align: center;
    background: white;
    max-height: 90vh;
    overflow-y: auto;
}

/* Existing Media Query (modified to include previous CAT responsiveness) */
@media (max-width: 768px) {
    .cat-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
        margin-top: 60px;
        /* Ensure content is below fixed header */
    }

    .sidebar {
        position: fixed;
        top: 60px;
        bottom: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        transition: left 0.3s;
        z-index: 2001;
        /* Higher than overlay (1999) */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-toggle {
        display: block;
        width: 100%;
        padding: 15px;
        background: white;
        border: none;
        text-align: left;
        font-weight: bold;
        color: var(--primary-color);
        border-bottom: 1px solid #eee;
        position: sticky;
        /* Sticky toggle */
        top: 60px;
        /* Below navbar */
        z-index: 900;
        cursor: pointer;
    }

    .close-sidebar {
        display: block;
        border: none;
        background: none;
        font-size: 2rem;
        padding: 0 10px;
        color: #e74c3c;
    }

    .question-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
        /* Better grid for mobile */
        gap: 8px;
    }

    .q-nav-btn {
        height: 45px;
        /* Larger touch target */
        width: 100%;
        font-size: 1rem;
    }

    .cat-navbar {
        padding: 0 15px;
    }

    .timer-display {
        font-size: 1rem;
        padding: 4px 8px;
    }

    .desktop-only {
        display: none;
    }

    .controls-area {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 100;
        padding: 10px 15px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        border-radius: 20px 20px 0 0;
    }

    .main-area {
        padding: 15px;
        padding-bottom: 80px;
        /* Ensure space for sticky footer controls */
    }
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.score-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.score-val {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}