/* ============================
   Flashcard Quiz – Frontend CSS
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=Inter:wght@400;500&display=swap');

.fcq-quiz-wrap {
    --fcq-bg:          linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    --fcq-card-bg:     #ffffff;
    --fcq-surface:     #DADAF0;
    --fcq-surface-alt: #E2F8FF;
    --fcq-surface-soft:#F3E8FF;
    --fcq-border:      #d7dfef;
    --fcq-text:        #24324a;
    --fcq-subtle:      #66758f;
    --fcq-accent:      #6d6ab3;
    --fcq-accent-strong:#54509a;
    --fcq-knew:        #2f9e8f;
    --fcq-learning:    #c98b52;
    --fcq-radius:      22px;
    --fcq-shadow:      0 18px 48px rgba(84, 80, 154, .12);

    font-family: 'Inter', sans-serif;
    max-width: 680px;
    margin: 0 auto;
    padding: 32px 20px;
    background: var(--fcq-bg);
    border-radius: 24px;
}

/* ---- Progress ---- */
.fcq-progress-wrap {
    margin-bottom: 18px;
}
.fcq-progress-bar {
    height: 8px;
    background: rgba(109, 106, 179, .14);
    border-radius: 99px;
    overflow: hidden;
}
.fcq-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fcq-accent-strong), #8fb8d8, #c8a7eb);
    border-radius: 99px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
    width: 0%;
}
.fcq-progress-text {
    font-size: 13px;
    color: var(--fcq-subtle);
    margin-top: 6px;
    text-align: right;
    font-weight: 500;
}

/* ---- Stats ---- */
.fcq-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.fcq-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.82);
    border: 1px solid var(--fcq-border);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 10px 24px rgba(84, 80, 154, .06);
}
.fcq-stat-icon { font-size: 18px; }
.fcq-stat-label { font-size: 13px; color: var(--fcq-subtle); font-weight: 500; flex: 1; }
.fcq-stat-num { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 700; }
.fcq-stat-knew .fcq-stat-num   { color: var(--fcq-knew); }
.fcq-stat-learning .fcq-stat-num { color: var(--fcq-learning); }

/* ---- Card ---- */
.fcq-card-area {
    perspective: 1200px;
    margin-bottom: 28px;
}
.fcq-card {
    width: 100%;
    min-height: 240px;
    position: relative;
    cursor: default;
}
.fcq-card-inner {
    width: 100%;
    min-height: 240px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .6s cubic-bezier(.4,0,.2,1);
}
.fcq-card-inner.is-flipped {
    transform: rotateY(180deg);
}
.fcq-card-face {
    position: absolute;
    width: 100%;
    min-height: 240px;
    top: 0; left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: var(--fcq-card-bg);
    border: 1px solid var(--fcq-border);
    border-radius: var(--fcq-radius);
    box-shadow: var(--fcq-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 40px;
    box-sizing: border-box;
    text-align: center;
    overflow: hidden;
}
.fcq-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #ffffff 0%, var(--fcq-surface-alt) 52%, var(--fcq-surface-soft) 100%);
    border-color: #cfdaf3;
}
.fcq-card-front::before,
.fcq-card-back::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--fcq-surface), var(--fcq-surface-alt), var(--fcq-surface-soft));
}
.fcq-face-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--fcq-accent-strong);
    margin-bottom: 16px;
    background: rgba(218, 218, 240, .68);
    padding: 4px 12px;
    border-radius: 99px;
}
.fcq-card-back .fcq-face-label {
    background: rgba(226, 248, 255, .88);
    color: #2d7c8f;
}
.fcq-card-text {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--fcq-text);
    line-height: 1.5;
}

/* Card slide animation */
.fcq-card.slide-out {
    animation: fcqSlideOut .35s ease forwards;
}
.fcq-card.slide-in {
    animation: fcqSlideIn .35s ease forwards;
}
@keyframes fcqSlideOut {
    to { opacity: 0; transform: translateX(-60px); }
}
@keyframes fcqSlideIn {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---- Buttons ---- */
.fcq-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.fcq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all .2s ease;
    padding: 14px 32px;
}
.fcq-btn-show {
    background: linear-gradient(135deg, var(--fcq-accent-strong), #7e8fc5);
    color: #fff;
    box-shadow: 0 10px 26px rgba(84, 80, 154, .24);
    width: 100%;
    max-width: 320px;
}
.fcq-btn-show:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(84, 80, 154, .28);
}

.fcq-response-btns {
    display: flex;
    gap: 14px;
    width: 100%;
    justify-content: center;
}
.fcq-btn-knew {
    flex: 1;
    max-width: 240px;
    background: linear-gradient(135deg, #4aa79a, #2f8b80);
    color: #fff;
    box-shadow: 0 10px 24px rgba(47, 139, 128, .24);
}
.fcq-btn-knew:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(47, 139, 128, .3);
}
.fcq-btn-learning {
    flex: 1;
    max-width: 240px;
    background: linear-gradient(135deg, #d7a46f, #b97c47);
    color: #fff;
    box-shadow: 0 10px 24px rgba(185, 124, 71, .22);
}
.fcq-btn-learning:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(185, 124, 71, .28);
}
.fcq-btn:active { transform: scale(.97); }

/* ---- Results ---- */
.fcq-results {
    text-align: center;
    padding: 40px 20px;
    animation: fcqFadeIn .5s ease;
}
@keyframes fcqFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fcq-results-emoji { font-size: 64px; margin-bottom: 12px; }
.fcq-results-title {
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--fcq-text);
    margin: 0 0 24px;
}
.fcq-results-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
}
.fcq-result-item {
    background: rgba(255,255,255,.85);
    border: 1px solid var(--fcq-border);
    border-radius: 16px;
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.fcq-result-num {
    font-family: 'Sora', sans-serif;
    font-size: 42px;
    font-weight: 700;
}
.fcq-result-label { font-size: 14px; color: var(--fcq-subtle); font-weight: 500; }
.fcq-result-knew .fcq-result-num   { color: var(--fcq-knew); }
.fcq-result-learning .fcq-result-num { color: var(--fcq-learning); }

.fcq-btn-restart {
    background: linear-gradient(135deg, var(--fcq-accent-strong), #7e8fc5);
    color: #fff;
    box-shadow: 0 10px 24px rgba(84, 80, 154, .24);
    padding: 16px 40px;
    font-size: 16px;
}
.fcq-btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(84, 80, 154, .3);
}

/* ---- Mobile ---- */
@media (max-width: 500px) {
    .fcq-quiz-wrap { padding: 20px 12px; }
    .fcq-card-face  { padding: 28px 20px; }
    .fcq-card-text  { font-size: 18px; }
    .fcq-response-btns { flex-direction: column; align-items: center; }
    .fcq-btn-knew, .fcq-btn-learning { max-width: 100%; width: 100%; }
    .fcq-lang-bar { flex-direction: column; align-items: stretch; }
    .fcq-lang-field { min-width: 0; width: 100%; }
}

/* ---- Start Screen ---- */
.fcq-start-screen {
    text-align: center;
    padding: 48px 24px;
    animation: fcqFadeIn .4s ease;
    background: rgba(255,255,255,.56);
    border: 1px solid rgba(215, 223, 239, .9);
    border-radius: 24px;
    box-shadow: 0 20px 44px rgba(84, 80, 154, .08);
}
.fcq-start-icon {
    font-size: 24px;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 10px 18px;
    border-radius: 999px;
    color: var(--fcq-accent-strong);
    background: linear-gradient(135deg, rgba(218, 218, 240, .95), rgba(226, 248, 255, .95));
    border: 1px solid rgba(109, 106, 179, .14);
    animation: fcqBounce 1.5s ease infinite;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
@keyframes fcqBounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}
.fcq-start-title {
    font-family: 'Sora', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--fcq-text);
    margin: 0 0 12px;
}
.fcq-start-desc {
    font-size: 16px;
    color: var(--fcq-subtle);
    margin: 0 0 24px;
    line-height: 1.6;
}
.fcq-start-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
    align-items: center;
}
.fcq-start-meta span {
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(226, 248, 255, .7), rgba(243, 232, 255, .7));
    border: 1px solid rgba(215, 223, 239, .95);
    padding: 8px 18px;
    border-radius: 99px;
    color: var(--fcq-text);
}
.fcq-btn-start {
    background: linear-gradient(135deg, var(--fcq-accent-strong), #7e8fc5);
    color: #fff;
    box-shadow: 0 12px 30px rgba(84, 80, 154, .24);
    padding: 18px 52px;
    font-size: 18px;
    border-radius: 14px;
}
.fcq-btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(84, 80, 154, .3);
}

/* ---- Score stat ---- */
.fcq-stat-score .fcq-stat-num { color: var(--fcq-accent-strong); }

@keyframes fcqPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); color: #f59e0b; }
    100% { transform: scale(1); }
}
.fcq-pulse { animation: fcqPulse .4s ease; }

/* ---- Score badge on results ---- */
.fcq-score-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--fcq-accent-strong), #7e8fc5);
    color: #fff;
    border-radius: 20px;
    padding: 20px 48px;
    margin-bottom: 24px;
}
.fcq-score-label { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.fcq-score-value { font-family: 'Sora', sans-serif; font-size: 40px; font-weight: 700; margin-top: 4px; }

/* ---- TTS button outside card ---- */
.fcq-card-area {
    position: relative;
}
.fcq-tts-outside {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0px auto 0;
    background: linear-gradient(135deg, #ffffff, var(--fcq-surface-alt));
    border: 1px solid rgba(215, 223, 239, .95);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 20px;
    color: var(--fcq-accent-strong);
    cursor: pointer;
    transition: all .2s;
    line-height: 1;
    order: -1;
    box-shadow: 0 10px 24px rgba(84, 80, 154, .12);
}
.fcq-tts-outside:hover {
    background: linear-gradient(135deg, var(--fcq-surface-alt), var(--fcq-surface-soft));
    transform: scale(1.12);
    box-shadow: 0 12px 28px rgba(84, 80, 154, .18);
}

/* ---- RTL support for Arabic ---- */
[dir="rtl"] .fcq-quiz-wrap,
.fcq-quiz-wrap.rtl { direction: rtl; text-align: right; }

.fcq-lang-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    padding: 16px 18px;
    border: 1px solid rgba(215, 223, 239, .95);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(226, 248, 255, .64), rgba(243, 232, 255, .72));
    box-shadow: 0 12px 28px rgba(84, 80, 154, .08);
}
.fcq-lang-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fcq-lang-eyebrow {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7a86a0;
    font-weight: 700;
}
.fcq-lang-title {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #24324a;
}
.fcq-lang-help {
    font-size: 12px;
    color: #66758f;
}
.fcq-lang-field {
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(215, 223, 239, .95);
}
.fcq-lang-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(218, 218, 240, .95), rgba(243, 232, 255, .88));
    color: var(--fcq-accent-strong);
    font-family: 'Sora', sans-serif;
    font-weight: 700;
}
.fcq-lang-select {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: transparent;
    cursor: pointer;
    color: #334155;
    font-weight: 600;
}
.fcq-lang-select:focus {
    outline: none;
    box-shadow: none;
}
