/**
 * Open Dictation Desktop - V2 Inspired Minimal Dark Mode
 * 
 * Craigslist-inspired aesthetics with beautiful flag cards
 */

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

body {
    background: #000;
    color: #ddd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    color: #66b3ff;
    text-decoration: none;
    cursor: pointer;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 24px;
    font-weight: normal;
    margin-bottom: 8px;
    color: #fff;
}

h2 {
    font-size: 18px;
    font-weight: normal;
    margin: 20px 0 10px 0;
    color: #fff;
}

p {
    margin-bottom: 10px;
    color: #999;
}

/* Header */
header {
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    font-size: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Flag Grid */
.flag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.flag-card {
    background: #111;
    border: 1px solid #333;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.flag-card:hover {
    border-color: #66b3ff;
    background: #1a1a1a;
}

.flag {
    font-size: 32px;
    margin-bottom: 8px;
}

.lang-name {
    font-size: 16px;
    color: #fff;
    display: block;
    margin-bottom: 8px;
}

.stat-line {
    font-size: 12px;
    color: #999;
    margin: 2px 0;
}

.stat-value {
    color: #ddd;
    font-weight: bold;
}

.success-rate {
    color: #66ff66;
}

.r4r-count {
    color: #ffaa66;
}

.session-chevron {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: #2a2a2a;
    color: #888;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1.4;
}

.session-chevron:hover {
    background: #383838;
    color: #bbb;
    border-color: #666;
}

.session-dropdown {
    position: absolute;
    bottom: 34px;
    right: 8px;
    background: #1e1e1e;
    border: 1px solid #555;
    border-radius: 4px;
    z-index: 100;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.session-dropdown button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #ccc;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.session-dropdown button:hover {
    background: #2e2e2e;
    color: #fff;
}

/* Gameplay Screen */
#gameplay-screen {
    max-width: 900px;
    margin: 0 auto;
}

.audio-container {
    text-align: center;
    margin: 30px 0;
}

audio {
    width: 100%;
    max-width: 600px;
    height: 50px;
}

textarea {
    width: 100%;
    max-width: 800px;
    height: 140px;
    min-height: 100px;
    padding: 18px;
    font-size: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: #111;
    color: #fff;
    border: 2px solid #333;
    border-radius: 4px;
    resize: vertical;
    margin: 20px auto;
    display: block;
}

textarea:focus {
    outline: none;
    border-color: #0a84ff;
    background: #0d0d0d;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

/* Buttons */
.button-group {
    text-align: center;
    margin: 20px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

button:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #66b3ff;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button.primary {
    background: #1a4d2e;
    border-color: #2d7a4f;
    font-weight: 500;
    font-size: 18px;
    padding: 16px 28px;
}

button.primary:hover:not(:disabled) {
    background: #2d7a4f;
    border-color: #4caf50;
}

/* Diff View */
.diff-container {
    margin: 20px 0;
    padding: 20px;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
}

.diff-label {
    color: #999;
    font-size: 12px;
    margin-bottom: 5px;
}

.diff-text {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.diff-correct {
    background: #1a4d2e;
    padding: 2px 4px;
}

.diff-error {
    background: #4d1a1a;
    padding: 2px 4px;
}

/* Session Info */
.session-info {
    background: #111;
    border: 1px solid #333;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.session-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-box {
    text-align: center;
}

.stat-number {
    font-size: 32px;
    color: #66ff66;
    font-weight: bold;
}

.stat-label {
    color: #999;
    font-size: 12px;
}

/* Utility */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* Stats View */
#stats-view {
    height: 100vh;
    overflow-y: auto;
}

/* Stats Tab Buttons */
.stats-tab-btn.active {
    border-bottom-color: #0a84ff !important;
    color: #fff !important;
}

/* Mobile */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #gameplay-screen main {
        padding-top: 0 !important;
    }

    .audio-container {
        position: sticky;
        top: 0;
        background: #000;
        margin: 0;
        padding: 6px 0;
        z-index: 10;
        border-bottom: 1px solid #333;
    }

    audio {
        height: 40px;
    }

    #practice-title, #review-title {
        display: none;
    }

    textarea {
        height: 90px;
        font-size: 16px;
        margin: 8px auto;
        padding: 12px;
    }

    #diff-display {
        margin-top: 8px !important;
    }

    #translation-section {
        margin-top: 8px !important;
        padding-top: 8px !important;
    }
}

/* Footer */
footer {
    border-top: 1px solid #333;
    padding-top: 15px;
    margin-top: 40px;
    color: #666;
    font-size: 12px;
    text-align: center;
}
