:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a87;
    --accent: #e63946;
    --accent-light: #ff6b6b;
    --bg: #0d1b2a;
    --bg-card: #1b2838;
    --bg-input: #243447;
    --text: #e0e0e0;
    --text-muted: #8b9dc3;
    --border: #2d4a6f;
    --success: #2ecc71;
    --warning: #f39c12;
    --work: #3498db;
    --casual: #9b59b6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: var(--primary);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Navigation */
.nav-bar {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s;
}

.nav-link.active {
    color: var(--accent);
    background: rgba(230, 57, 70, 0.1);
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

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

.card h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-card.accent {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border: none;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-card.accent .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.stat-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    background: var(--primary-light);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--primary);
}

.btn-primary {
    background: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-output {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.action-output.hidden {
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab {
    background: var(--bg-input);
    color: var(--text-muted);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
}

.tab.active {
    background: var(--accent);
    color: white;
}

/* Phrase list */
.phrase-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.phrase-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    border-left: 3px solid var(--border);
}

.phrase-item.translated {
    border-left-color: var(--success);
}

.phrase-english {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.phrase-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.phrase-freq {
    color: var(--accent);
}

.phrase-context {
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
}

.phrase-context.work {
    background: rgba(52, 152, 219, 0.2);
    color: var(--work);
}

.phrase-context.casual {
    background: rgba(155, 89, 182, 0.2);
    color: var(--casual);
}

.phrase-french {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Phrase cards (full list) */
.phrase-list-full {
    display: grid;
    gap: 0.75rem;
}

.phrase-card {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.phrase-card:hover {
    border-color: var(--accent);
}

.phrase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.phrase-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    background: var(--bg-input);
    color: var(--text-muted);
}

.tag.work {
    background: rgba(52, 152, 219, 0.2);
    color: var(--work);
}

.tag.casual {
    background: rgba(155, 89, 182, 0.2);
    color: var(--casual);
}

.tag.translated {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
}

.phrase-preview {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Transcription list */
.transcription-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.transcription-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}

.transcription-text {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.transcription-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* Search */
.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Filters */
.filter-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.filter-group select {
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-meta {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.translation-section {
    margin-top: 1.5rem;
}

.translation-section h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.french-text {
    font-size: 1.25rem;
    color: var(--accent);
}

.not-translated {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    color: var(--text-muted);
}

/* Progress page */
.milestones {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.milestone {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    opacity: 0.5;
}

.milestone.achieved {
    opacity: 1;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--success);
}

.milestone-icon {
    font-size: 1.5rem;
}

.milestone-text {
    font-size: 0.875rem;
}

.translation-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.translation-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}

.translation-english {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.translation-french {
    color: var(--accent);
}

.cefr-progress {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cefr-level {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.cefr-level.locked {
    opacity: 0.5;
}

.cefr-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.cefr-name {
    font-weight: 600;
}

.cefr-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cefr-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar.large {
    height: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    transition: width 0.3s;
}

.weekly-goal {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.count-badge {
    background: var(--accent);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Sync info */
.sync-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    z-index: 1000;
}

.toast.hidden {
    display: none;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--accent);
}

/* Utility */
.loading, .empty, .error {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.error {
    color: var(--accent);
}

.hidden {
    display: none;
}

/* Responsive */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .phrase-list-full {
        grid-template-columns: repeat(2, 1fr);
    }
}
