/* English Daily PWA - Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #4338CA;
    --bg: #0F172A;
    --card-bg: #1E293B;
    --card-border: #334155;
    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

#app {
    padding-bottom: 80px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
}

.streak-badge {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    border-top: 1px solid var(--card-border);
    z-index: 100;
}

.nav-btn {
    background: none;
    border: none;
    font-size: 24px;
    padding: 8px 16px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
}

.nav-btn.active {
    opacity: 1;
    transform: scale(1.15);
}

/* Tabs */
.tab-content {
    display: none;
    padding: 16px;
}

.tab-content.active {
    display: block;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--card-border);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--primary-light);
}

.card h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-box {
    text-align: center;
    padding: 12px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 8px;
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Goal Tracker */
.goal-tracker {
    margin-bottom: 12px;
}

.goal-bar {
    height: 12px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.5s ease;
    border-radius: 6px;
}

.goal-text {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* Buttons */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    margin-top: 8px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-small {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
    display: inline-block;
    margin-right: 8px;
}

.btn-send {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.btn-secondary {
    background: var(--card-border);
}

.btn-bad {
    background: var(--danger);
}

.btn-ok {
    background: var(--warning);
}

.btn-good {
    background: var(--success);
}

.btn-play {
    background: var(--primary-light);
    font-size: 18px;
    margin: 16px 0;
}

/* Chat */
.chat-modes {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.mode-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chat-messages {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
}

.chat-msg {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-msg.ai {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chatInput {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
}

#chatInput:focus {
    border-color: var(--primary);
}

/* Flashcards */
.cards-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.badge.due {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.flashcard {
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s;
}

.flashcard:active {
    transform: scale(0.98);
}

.fc-word {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-light);
}

.fc-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

.fc-translation {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 12px;
}

.fc-example {
    font-size: 16px;
    color: var(--text-muted);
    font-style: italic;
}

.review-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.review-buttons .btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 4px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 8px;
}

/* Dictation */
.dictation-area {
    text-align: center;
}

.sentence-display {
    margin: 16px 0;
}

.original-sentence {
    font-size: 18px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    color: var(--text);
}

#dictationInput {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    margin: 12px 0;
    resize: none;
    outline: none;
    font-family: inherit;
}

#dictationInput:focus {
    border-color: var(--primary);
}

.dictation-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
    font-size: 15px;
}

.dictation-result.correct {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.dictation-result.incorrect {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Progress */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.progress-item {
    text-align: center;
    padding: 16px 8px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 8px;
}

.prog-icon {
    font-size: 28px;
}

.prog-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-light);
    margin: 4px 0;
}

.prog-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Week Chart */
.week-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    padding-top: 20px;
}

.week-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.week-bar {
    width: 80%;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.week-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Inputs */
.input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 8px;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
}

/* Lesson */
.lesson-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.lesson-section {
    margin-bottom: 16px;
}

.lesson-section h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.vocab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vocab-item {
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
}

.grammar-box {
    background: var(--bg);
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
}

.exercise-box {
    background: rgba(34, 197, 94, 0.1);
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    border-left: 3px solid var(--success);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Resources */
.resources-list {
    margin-top: 8px;
}

.resource-category {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-light);
    margin: 16px 0 8px;
    text-transform: uppercase;
}

.resource-item {
    display: block;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--card-border);
    transition: border-color 0.2s;
}

.resource-item:active {
    border-color: var(--primary);
}

.resource-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.resource-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 4px;
}