/* =====================================================
   FLASHCARD MODULE - EMU JAPAN ELEGANT DESIGN
===================================================== */

:root {
    --emu-red: #9d0b03;
    --emu-red-dark: #7a0802;
    --emu-red-soft: rgba(157, 11, 3, 0.08);
    --emu-red-border: rgba(157, 11, 3, 0.2);
    --emu-bg-light: #f8f9fa;
    --emu-border: #ececec;
    --emu-text-muted: #6c757d;
    /* Aliasing variabel khusus Flashcard ke tema utama EMU */
    --fc-primary: var(--emu-red);
    --fc-primary-hover: var(--emu-red-dark);
    --fc-bg-card: #ffffff;
    --fc-border: var(--emu-border);
    --fc-text-main: #111111;
    --fc-text-muted: var(--emu-text-muted);
    --fc-radius: 1.25rem;
}


/* Base Container Alignment */

#flashcard-container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--emu-bg-light);
}

.shadow-sm-subtle {
    border: 1px solid var(--emu-border) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.letter-spacing-1 {
    letter-spacing: 0.05em;
}


/* Transisi Progress Bar Global */

.global-progress-bar .progress-bar {
    transition: width 0.4s ease-in-out;
}


/* ============================================================
   ELEGANT & COMPACT DROPDOWN FILTER (EMU STYLE)
   ============================================================ */

.flashcard-filter-bar .card {
    border: 1px solid var(--emu-border) !important;
    background: #ffffff;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.flashcard-filter-bar .card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04) !important;
}

.filter-select-wrapper {
    min-width: 145px;
}

.filter-select-wrapper select {
    font-size: 0.825rem;
    background-color: #f8f9fa;
    border-color: #e9ecef !important;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-select-wrapper select:hover {
    background-color: #ffffff;
    border-color: var(--emu-red-border) !important;
    color: var(--emu-red);
}

.filter-select-wrapper select:focus {
    background-color: #ffffff;
    border-color: var(--emu-red) !important;
    box-shadow: 0 0 0 0.2rem rgba(157, 11, 3, 0.1) !important;
}

.filter-switch-wrapper {
    height: 31px;
}

.filter-switch-wrapper .form-check-input:checked {
    background-color: var(--emu-red);
    border-color: var(--emu-red);
}


/* ==========================================
   1. FLIP MECHANICS & SCENE WRAPPER
========================================== */

.flashcard-wrapper {
    perspective: 1200px;
    width: 100%;
    height: 480px;
    margin: 0 auto;
    clear: both;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: var(--fc-radius);
    user-select: none;
    margin: 0 auto;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}


/* Card Faces General */

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--fc-radius);
    background: var(--fc-bg-card);
    border: 1px solid var(--emu-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 2rem 2.5rem;
}


/* ==========================================
   2. FRONT FACE (SISI DEPAN)
========================================== */

.flashcard-front {
    z-index: 2;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #ffffff;
}

.kanji-display-front {
    font-size: clamp(5rem, 12vw, 7.5rem);
    font-weight: 500;
    color: var(--fc-text-main);
    line-height: 1;
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
    margin-bottom: 0.5rem;
    text-align: center;
}


/* ==========================================
   3. BACK FACE (SISI BELAKANG - 2 KOLOM)
========================================== */

.flashcard-back {
    transform: rotateY(180deg);
    z-index: 1;
    background: #ffffff;
    overflow-y: auto;
}

.flashcard-back::-webkit-scrollbar {
    width: 5px;
}

.flashcard-back::-webkit-scrollbar-thumb {
    background-color: #e9ecef;
    border-radius: 10px;
}


/* Layout 2 Kolom */

.flashcard-back-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    height: 100%;
    align-items: center;
}


/* Kolom Kiri */

.flashcard-left-pane {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-right: 1px solid var(--emu-border);
    padding-right: 1.5rem;
    height: 100%;
}

.kanji-back-display {
    font-size: clamp(3.5rem, 8vw, 4.5rem);
    font-weight: 500;
    color: var(--emu-red);
    line-height: 1;
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
    text-align: center;
}

.hiragana-display {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--emu-red);
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

.meaning-display {
    font-size: 1.35rem;
    font-weight: 600;
}

.reading-section-box {
    background: #fdfdfe;
    border: 1px solid #f1f3f5;
    border-radius: 1rem;
    padding: 1rem;
    margin-top: 0.5rem;
    width: 100%;
}

.reading-val {
    font-size: 1rem;
    font-weight: 600;
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

.label-caps {
    font-size: 0.725rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}


/* Kolom Kanan */

.flashcard-right-pane {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
    padding-left: 0.5rem;
}

.example-list {
    display: flex;
    flex-direction: column;
}

.example-item {
    padding: 0.6rem 0;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.example-item:not(:last-child) {
    border-bottom: 1px solid var(--emu-border);
}

.example-jp {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fc-text-main);
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
    line-height: 1.2;
}

.example-hiragana {
    font-size: 0.9rem;
    color: var(--emu-red);
    font-weight: 600;
    font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

.example-romaji {
    font-size: 0.85rem;
    color: var(--emu-text-muted);
    font-weight: 400;
    font-style: italic;
}

.example-id {
    font-size: 0.85rem;
    color: #495057;
    font-weight: 400;
}


/* ==========================================
   4. MINIMALIST GHOST TTS BUTTON
========================================== */

.tts-ghost-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--emu-red-soft);
    color: var(--emu-red);
    border: 1px solid var(--emu-red-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    outline: none;
}

.tts-ghost-btn:hover {
    background-color: var(--emu-red);
    color: #ffffff !important;
    border-color: var(--emu-red);
    transform: scale(1.08);
}

.tts-ghost-btn.playing {
    background-color: var(--emu-red);
    border-color: var(--emu-red);
    animation: pulse-red 1.5s infinite;
}

.tts-ghost-btn.playing i {
    color: #ffffff !important;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(157, 11, 3, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(157, 11, 3, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(157, 11, 3, 0);
    }
}


/* ==========================================
   5. RESPONSIVE MOBILE ADAPTATION
========================================== */

@media (max-width: 991.98px) {
    .flashcard-wrapper {
        height: 520px;
    }
    .flashcard-back-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        height: auto;
    }
    .flashcard-left-pane {
        border-right: none;
        border-bottom: 1px solid var(--emu-border);
        padding-right: 0;
        padding-bottom: 1.25rem;
    }
}

.flashcard-hero-card {
    border: 1px solid var(--emu-border) !important;
    background: #ffffff;
    /* Bayangan sedikit lebih tebal & halus untuk menyamai halaman lain */
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06) !important;
    transition: box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.flashcard-hero-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08) !important;
}


/* Penyesuaian Warna Teks & Badge pada Hero Banner */

.flashcard-hero-card .snapshot-eyebrow span,
.flashcard-hero-card .snapshot-eyebrow i {
    color: var(--emu-red) !important;
}

.flashcard-hero-card .flashcard-progress-percent {
    color: var(--emu-red) !important;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    line-height: 1;
    letter-spacing: -0.03em;
}

.flashcard-hero-card .progress-bar {
    background-color: var(--emu-red) !important;
}

@media (max-width: 767.98px) {
    .flashcard-wrapper {
        height: 560px;
    }
    .flashcard-face {
        padding: 1.5rem;
    }
}