/* ==========================================================================
   MEDIA PEMBELAJARAN INTERAKTIF - KENAMPAKAN ALAM KULON PROGO
   CSS STYLESHEET (Bootstrap 5 Companion)
   Target: Siswa Kelas 4 SD (Kurikulum Merdeka)
   Author: Yusuf Bahtiyar, S.Pd.
   ========================================================================== */

/* --- ROOT VARIABLES & DESIGN SYSTEM --- */
:root {
    --primary-color: #3B82F6;       /* Bright Sky Blue */
    --primary-hover: #2563EB;
    --secondary-color: #EC4899;     /* Playful Pink */
    --success-color: #10B981;       /* Emerald Green */
    --warning-color: #F59E0B;       /* Sun Yellow */
    --danger-color: #EF4444;        /* Soft Coral Red */
    --info-color: #06B6D4;          /* Cyan */
    
    --bg-main: #F3F4F6;
    --bg-card: #FFFFFF;
    
    --zone-utara: #8B5CF6;          /* Purple for Mountains */
    --zone-tengah: #10B981;         /* Green for Lowlands */
    --zone-selatan: #0EA5E9;        /* Ocean Blue for Coast */

    --font-heading: 'Fredoka', 'Segoe UI', cursive, sans-serif;
    --font-body: 'Nunito', 'Segoe UI', sans-serif;

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;

    --shadow-soft: 0 8px 24px rgba(149, 157, 165, 0.15);
    --shadow-hover: 0 16px 32px rgba(59, 130, 246, 0.2);
}

/* --- GENERAL RESET & BASE STYLES --- */
body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: #1F2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-size: 1.05rem;
}

h1, h2, h3, h4, h5, h6, .brand-title {
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* Touch Friendly Large Target Rule */
button, .btn, .nav-link, .info-summary-card, .option-card {
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* --- NAVBAR STYLING --- */
.custom-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 0;
    transition: all 0.3s ease;
}

.brand-icon {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #64748B;
    font-weight: 600;
}

.btn-nav {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.6rem 1.2rem !important;
    border-radius: var(--radius-lg) !important;
    color: #475569 !important;
    transition: all 0.25s ease;
    border: 2px solid transparent;
}

.btn-nav:hover {
    color: var(--primary-color) !important;
    background: rgba(59, 130, 246, 0.08);
    transform: translateY(-2px);
}

.btn-nav.active {
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-sound-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FEF3C7;
    color: #D97706;
    border: 2px solid #FCD34D;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.25s ease;
}

.btn-sound-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    background: #FDE68A;
}

.btn-sound-toggle.muted {
    background: #F3F4F6;
    color: #9CA3AF;
    border-color: #D1D5DB;
}

/* --- SECTION DISPLAY CONTROLLER --- */
.page-section {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.page-section.active-section {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- HERO BANNER (HOME) --- */
.hero-banner {
    background: linear-gradient(135deg, #E0F2FE 0%, #FEF3C7 50%, #FCE7F3 100%);
    border-radius: var(--radius-md);
    border: 3px solid #FFFFFF;
    box-shadow: var(--shadow-soft);
}

.hero-title {
    font-size: 2.5rem;
    color: #0F172A;
    line-height: 1.25;
}

.highlight-text {
    color: var(--primary-color);
    background: linear-gradient(120deg, #93C5FD 0%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* NARATOR HOME BUTTON */
.btn-narator-home {
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-lg);
    border: 2px solid #A78BFA;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.btn-narator-home:hover {
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.btn-hero-primary {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.9rem 2.2rem;
    border-radius: var(--radius-lg);
    border: none;
    transition: all 0.3s ease;
    animation: pulse-btn 2s infinite;
}

.btn-hero-primary:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
    color: white;
}

.btn-hero-secondary {
    background: white;
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.9rem 2.2rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.btn-hero-secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

@keyframes pulse-btn {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Mascot Card */
.mascot-wrapper {
    position: relative;
    display: inline-block;
}

.mascot-badge {
    position: absolute;
    top: -15px;
    right: -10px;
    background: #F59E0B;
    color: white;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
    z-index: 2;
    animation: bounce-subtle 2.5s infinite;
}

@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.mascot-card {
    background: white;
    border-radius: var(--radius-md);
    border: 3px solid #E2E8F0;
    transition: all 0.3s ease;
}

.hero-illustration-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto;
    background: linear-gradient(135deg, #3B82F6, #10B981);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.zone-mini-card {
    background: #F8FAFC;
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zone-mini-card i {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.zone-mini-card span {
    font-size: 0.75rem;
    font-weight: 700;
    display: block;
}

.zone-mini-card.utara i { color: var(--zone-utara); }
.zone-mini-card.tengah i { color: var(--zone-tengah); }
.zone-mini-card.selatan i { color: var(--zone-selatan); }

.zone-mini-card:hover {
    transform: translateY(-3px);
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- SUMMARY CARDS (HOME) --- */
.info-summary-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.75rem;
    border: 2px solid #E2E8F0;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-summary-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.info-summary-card.card-utara:hover { border-color: var(--zone-utara); }
.info-summary-card.card-tengah:hover { border-color: var(--zone-tengah); }
.info-summary-card.card-selatan:hover { border-color: var(--zone-selatan); }

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.card-utara .card-icon { background: #EDE9FE; color: var(--zone-utara); }
.card-tengah .card-icon { background: #D1FAE5; color: var(--zone-tengah); }
.card-selatan .card-icon { background: #E0F2FE; color: var(--zone-selatan); }

.zone-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 12px;
}

.card-utara .zone-tag { background: #EDE9FE; color: var(--zone-utara); }
.card-tengah .zone-tag { background: #D1FAE5; color: var(--zone-tengah); }
.card-selatan .zone-tag { background: #E0F2FE; color: var(--zone-selatan); }

.card-action {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- MODUL MATERI --- */
.btn-filter {
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: var(--radius-lg);
    padding: 0.6rem 1.4rem;
    background: white;
    color: #475569;
    border: 2px solid #E2E8F0;
    transition: all 0.25s ease;
    font-size: 0.95rem;
}

.btn-filter:hover {
    background: #F1F5F9;
    color: var(--primary-color);
    border-color: #CBD5E1;
}

.btn-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Materi Card */
.materi-card {
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid #E2E8F0;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.materi-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.materi-card-header {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
    overflow: hidden;
}

.materi-card-img-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.materi-card:hover .materi-card-img-thumb {
    transform: scale(1.08);
}

.materi-card-header i {
    font-size: 4rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.materi-card:hover .materi-card-header i {
    transform: scale(1.1);
}

.materi-card-header.bg-utara { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.materi-card-header.bg-tengah { background: linear-gradient(135deg, #10B981, #34D399); }
.materi-card-header.bg-selatan { background: linear-gradient(135deg, #0EA5E9, #38BDF8); }

.materi-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.btn-read-more {
    margin-top: auto;
    background: #F8FAFC;
    color: #334155;
    border: 2px solid #E2E8F0;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: var(--radius-lg);
    padding: 0.6rem 1.2rem;
    transition: all 0.25s ease;
    width: 100%;
}

.btn-read-more:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* --- MODUL KUIS MODE SELECTOR --- */
.btn-quiz-mode {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.75rem 1.8rem;
    border-radius: var(--radius-lg);
    background: white;
    color: #475569;
    border: 2px solid #CBD5E1;
    transition: all 0.3s ease;
}

.btn-quiz-mode:hover {
    background: #F8FAFC;
    color: var(--primary-color);
}

.btn-quiz-mode.active {
    background: linear-gradient(135deg, #EF4444, #F97316);
    color: white;
    border-color: #EF4444;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.3);
}

/* Quiz Container Card */
.quiz-container-card {
    background: white;
    border-radius: var(--radius-md);
    border: 3px solid #E2E8F0;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.custom-progress {
    height: 14px;
    border-radius: 20px;
    background-color: #E2E8F0;
    overflow: hidden;
}

.question-box {
    background: #F8FAFC;
}

/* Answer Option Cards */
.option-btn {
    background: white;
    border: 3px solid #E2E8F0;
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    text-align: left;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    min-height: 64px;
}

.option-badge {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: #F0F9FF;
    transform: translateY(-3px);
}

.option-btn:hover:not(:disabled) .option-badge {
    background: var(--primary-color);
    color: white;
}

.option-btn.correct {
    background: #D1FAE5 !important;
    border-color: var(--success-color) !important;
    color: #065F46 !important;
    transform: scale(1.02);
}

.option-btn.correct .option-badge {
    background: var(--success-color) !important;
    color: white !important;
}

.option-btn.wrong {
    background: #FEE2E2 !important;
    border-color: var(--danger-color) !important;
    color: #991B1B !important;
    animation: shake 0.4s ease;
}

.option-btn.wrong .option-badge {
    background: var(--danger-color) !important;
    color: white !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.explanation-box {
    background: #EFF6FF;
    border: 2px solid #BFDBFE;
    color: #1E40AF;
}

.explanation-box.wrong-mode {
    background: #FEF2F2;
    border-color: #FCA5A5;
    color: #991B1B;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    border: 6px solid var(--primary-color);
}

/* --- TEKA-TEKI SILANG (TTS) STYLES --- */
.tts-board-container {
    max-width: 480px;
}

.tts-grid-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.tts-cell-wrapper {
    position: relative;
    aspect-ratio: 1;
}

.tts-cell-wrapper.empty {
    background: #E2E8F0;
    border-radius: 8px;
}

.tts-cell-num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-color);
    z-index: 2;
    pointer-events: none;
}

.tts-input-cell {
    width: 100%;
    height: 100%;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 2px solid #CBD5E1;
    border-radius: 10px;
    background: white;
    color: #1E293B;
    transition: all 0.2s ease;
    padding: 0;
}

.tts-input-cell:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #EFF6FF;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.tts-input-cell.correct-cell {
    background: #D1FAE5 !important;
    border-color: var(--success-color) !important;
    color: #065F46 !important;
}

.tts-input-cell.wrong-cell {
    background: #FEE2E2 !important;
    border-color: var(--danger-color) !important;
    color: #991B1B !important;
}

.list-clues li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* --- PETUNJUK CARDS --- */
.guide-card {
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid #E2E8F0;
    box-shadow: var(--shadow-soft);
    position: relative;
    transition: all 0.3s ease;
}

.guide-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.guide-step-num {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #64748B;
    font-family: var(--font-heading);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- CUSTOM MODAL & DEDICATED IMAGE CONTAINER --- */
.custom-modal {
    border-radius: var(--radius-md);
    border: 3px solid #E2E8F0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-materi-img {
    max-height: 250px;
    width: 100%;
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.modal-illustration-box {
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

/* --- AUTHOR LOCK STYLING --- */
.author-credit-box {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border: 2px solid #60A5FA;
    background: linear-gradient(135deg, #2563EB, #1D4ED8) !important;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* --- FOOTER STYLING --- */
.custom-footer {
    background: #1E293B;
    color: white;
    margin-top: auto;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .btn-hero-primary, .btn-hero-secondary {
        width: 100%;
        font-size: 1.05rem;
    }

    .btn-filter {
        width: 100%;
        text-align: center;
    }

    .btn-quiz-mode {
        width: 100%;
    }
}
