:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #10b981;
    --accent-dark: #059669;
    --accent-light: #34d399;
    --error: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

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

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

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--bg-tertiary);
}

.header h1 {
    font-size: 28px;
    color: var(--accent);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

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

.btn-dashboard:hover {
    background: var(--accent-dark);
}

.btn-success {
    background: var(--success);
    color: var(--bg-primary);
}

.btn-success:hover {
    background: var(--accent-dark);
}

.btn-error {
    background: var(--error);
    color: white;
}

.btn-error:hover {
    background: #dc2626;
}

.btn-logout {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-reset {
    background: var(--warning);
    color: var(--bg-primary);
}

.btn-reset:hover {
    background: #d97706;
}

/* Auth Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

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

.auth-container h1 {
    font-size: 32px;
    margin-bottom: 40px;
    color: var(--accent);
}

.auth-box {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin: 0 auto;
}

.auth-box h2 {
    margin-bottom: 25px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
}

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

.auth-footer {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    color: var(--error);
    font-size: 14px;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h2 {
    color: var(--accent);
    margin-bottom: 10px;
}

.help-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-table {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--bg-tertiary);
}

tr:hover {
    background: var(--bg-tertiary);
}

.category-name {
    color: var(--accent);
    font-weight: 500;
}

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

.box-link {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
}

.box-link:hover {
    transform: scale(1.1);
}

.box-1 { background: #ef4444; color: white; }
.box-2 { background: #f59e0b; color: var(--bg-primary); }
.box-3 { background: #eab308; color: var(--bg-primary); }
.box-4 { background: #84cc16; color: var(--bg-primary); }
.box-5 { background: var(--success); color: var(--bg-primary); }

.box-empty {
    color: var(--text-secondary);
}

.total-cell {
    font-weight: bold;
    color: var(--text-primary);
}

.box-legend {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
}

.box-legend h3 {
    color: var(--accent);
    margin-bottom: 15px;
}

.box-legend ul {
    list-style: none;
}

.box-legend li {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.legend-box {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 8px;
    font-size: 12px;
}

/* Trainer */
.trainer-container {
    max-width: 800px;
}

.trainer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.trainer-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.box-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    color: var(--bg-primary);
}

.direction-badge {
    background: var(--accent);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--bg-primary);
}

.trainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 40px 0;
}

.card-container {
    width: 100%;
    perspective: 1000px;
}

.card {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.card-front, .card-back {
    width: 100%;
}

.card-front .word {
    font-size: 48px;
    font-weight: bold;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-back .answer {
    font-size: 42px;
    color: var(--accent);
    font-weight: bold;
}

.loading, .done, .error {
    color: var(--text-secondary);
    font-size: 18px;
}

.loading::before {
    content: '⏳ ';
}

.done::before {
    content: '🎉 ';
}

.error::before {
    content: '❌ ';
}

.answer-section, .rating-section {
    width: 100%;
    text-align: center;
}

.answer-buttons, .rating-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.answer-buttons .btn, .rating-buttons .btn {
    min-width: 150px;
    padding: 15px 30px;
    font-size: 16px;
}

.rating-prompt {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 16px;
}

/* Korean Keyboard */
.korean-keyboard {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
}

.keyboard-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: center;
}

.korean-keyboard button {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
}

.korean-keyboard button:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.progress-info {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Admin */
.admin-header {
    margin-bottom: 30px;
}

.users-table {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    color: var(--accent);
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--bg-tertiary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-buttons .btn {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header h1 {
        font-size: 22px;
    }

    .dashboard-table {
        overflow-x: auto;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px 8px;
    }

    .card {
        min-height: 300px;
        padding: 20px;
    }

    .card-front .word {
        font-size: 32px;
    }

    .card-back .answer {
        font-size: 28px;
    }

    .korean-keyboard {
        max-width: 100%;
    }

    .keyboard-row {
        flex-wrap: wrap;
    }

    .korean-keyboard button {
        padding: 10px 12px;
        font-size: 16px;
    }

    .answer-buttons, .rating-buttons {
        flex-direction: column;
    }

    .answer-buttons .btn, .rating-buttons .btn {
        width: 100%;
    }
}
