/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============================================================
   LOGIN SECTION
   ============================================================ */
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: #1e293b;
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border: 1px solid #334155;
    text-align: center;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.5px;
}

.login-sub {
    color: #94a3b8;
    font-size: 14px;
    margin-top: 6px;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    align-items: center;
    background: #0f172a;
    border-radius: 12px;
    padding: 0 16px;
    border: 2px solid #334155;
    transition: border-color 0.3s;
}

.input-group:focus-within {
    border-color: #3b82f6;
}

.input-group i {
    color: #64748b;
    font-size: 16px;
    margin-right: 12px;
}

.input-group input {
    background: transparent;
    border: none;
    padding: 14px 0;
    color: #f1f5f9;
    font-size: 15px;
    width: 100%;
    outline: none;
}

.input-group input::placeholder {
    color: #475569;
}

.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 18px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    background: #2563eb;
}

.login-btn:active {
    transform: scale(0.98);
}

.error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

.login-footer {
    margin-top: 20px;
    color: #475569;
    font-size: 12px;
}

/* ============================================================
   MAIN APP
   ============================================================ */
.main-app {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    display: none;
}

.main-app.active {
    display: block;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    padding: 16px 24px;
    border-radius: 16px;
    border: 1px solid #334155;
    margin-bottom: 20px;
}

.app-logo {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    background: #064e3b;
    color: #34d399;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.logout-btn {
    background: #7f1d1d;
    color: #fca5a5;
    border: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-btn:hover {
    background: #991b1b;
}

/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tab-nav {
    display: flex;
    gap: 6px;
    background: #1e293b;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid #334155;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

.tab-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ============================================================
   TAB CONTENT
   ============================================================ */
.tab-content-wrapper {
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid #334155;
    padding: 24px;
    min-height: 400px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #334155;
}

.tab-content h2 i {
    color: #3b82f6;
    margin-right: 10px;
}

/* ============================================================
   GRAMMAR / READING / WRITING CARDS
   ============================================================ */
.qa-card {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #334155;
    transition: border-color 0.3s;
}

.qa-card:hover {
    border-color: #475569;
}

.question-text {
    font-size: 16px;
    font-weight: 500;
    color: #f1f5f9;
    margin-bottom: 12px;
}

.options-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.option-item {
    background: #1e293b;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    color: #cbd5e1;
    border: 1px solid #334155;
}

/* ============================================================
   READING PASSAGE
   ============================================================ */
.reading-passage-card {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #334155;
}

.reading-passage-card h2 {
    font-size: 18px;
    color: #f1f5f9;
    margin-bottom: 10px;
    border-bottom: none;
    padding-bottom: 0;
}

.reading-passage-card div {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ============================================================
   WRITING CARD
   ============================================================ */
.writing-card {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #334155;
}

.writing-tag {
    display: inline-block;
    background: #1e3a5f;
    color: #60a5fa;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.writing-card h3 {
    font-size: 17px;
    color: #f1f5f9;
    margin-bottom: 8px;
}

.prompt-box {
    background: #1e293b;
    padding: 12px 16px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    border-left: 3px solid #3b82f6;
    margin-bottom: 12px;
}

/* ============================================================
   SPEAKING CARD
   ============================================================ */
.speaking-card {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #334155;
}

.speaking-tag {
    display: inline-block;
    background: #1e3a5f;
    color: #60a5fa;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.speaking-card h3 {
    font-size: 16px;
    color: #f1f5f9;
    margin-bottom: 10px;
}

.speaking-prompt {
    background: #1e293b;
    padding: 12px 16px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.vocab-box {
    background: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #94a3b8;
}

.vocab-box span {
    display: inline-block;
    background: #334155;
    padding: 2px 10px;
    border-radius: 12px;
    margin: 2px 4px 2px 0;
    color: #e2e8f0;
    font-size: 12px;
}

.sample-answer-box {
    background: #1e293b;
    padding: 12px 16px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.7;
    margin-top: 4px;
}

/* ============================================================
   LISTENING CARD
   ============================================================ */
.listening-card {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #334155;
}

.listening-tag {
    display: inline-block;
    background: #1e3a5f;
    color: #60a5fa;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.listening-card h3 {
    font-size: 17px;
    color: #f1f5f9;
    margin-bottom: 6px;
}

.audio-player-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: #1e293b;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
}

.audio-player-wrapper audio {
    flex: 1;
    min-width: 200px;
    height: 40px;
}

.play-count-badge {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
}

.play-count-badge.limited {
    color: #f59e0b;
}

.play-count-badge.limited i {
    color: #ef4444;
}

.listening-questions {
    margin-top: 12px;
}

.listening-question-item {
    background: #1e293b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.listening-question-item .q-text {
    font-size: 14px;
    color: #e2e8f0;
    font-weight: 500;
    margin-bottom: 6px;
}

.listening-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.listening-options .opt {
    background: #0f172a;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #cbd5e1;
    border: 1px solid #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.listening-options .opt:hover {
    border-color: #3b82f6;
}

.listening-options .opt.selected {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.listening-options .opt.correct-show {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}

.listening-options .opt.wrong-show {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

.check-answers-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-answers-btn:hover {
    background: #2563eb;
}

.check-answers-btn:disabled {
    background: #334155;
    cursor: not-allowed;
}

/* ============================================================
   EXPLANATION / REVEAL BUTTONS
   ============================================================ */
.reveal-trigger-btn {
    background: #334155;
    color: #e2e8f0;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 6px;
}

.reveal-trigger-btn:hover {
    background: #475569;
}

.explanation-box {
    display: none;
    margin-top: 12px;
    padding: 16px;
    background: #1e293b;
    border-radius: 10px;
    border: 1px solid #334155;
}

.explanation-box.show {
    display: block;
}

.exp-row {
    padding: 6px 0;
    border-bottom: 1px solid #2d3748;
}

.exp-row:last-child {
    border-bottom: none;
}

.exp-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.correct-ans-highlight {
    color: #34d399;
    font-weight: 600;
    font-size: 15px;
}

.correct-ans-highlight i {
    margin-right: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .login-box {
        padding: 28px 20px;
    }

    .app-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .tab-nav {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 6px);
        font-size: 12px;
        padding: 8px 10px;
    }

    .tab-content-wrapper {
        padding: 16px;
    }

    .options-stack {
        flex-direction: column;
    }

    .audio-player-wrapper {
        flex-direction: column;
    }

    .audio-player-wrapper audio {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        flex: 1 1 100%;
        font-size: 13px;
    }

    .login-box h1 {
        font-size: 20px;
    }
}
