:root {
    --bg-dark: #0f111a;
    --bg-card: rgba(25, 28, 41, 0.7);
    --text-main: #f0f2f5;
    --text-muted: #9ba1b0;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.4);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.4);
    --warning: #f59e0b;
    --info: #3b82f6;

    --btn-again: #ef4444;
    --btn-hard: #f59e0b;
    --btn-good: #10b981;
    --btn-easy: #3b82f6;
    
    --glass-border: rgba(255, 255, 255, 0.08);
    --border-radius: 16px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1a1c2c, var(--bg-dark));
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.topbar h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-overview {
    display: flex;
    gap: 1rem;
}

.stat-pill {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.stat-pill.overdue { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.stat-pill.new { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }

.actions button {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}
.actions button:hover, .actions button.active {
    color: var(--text-main);
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.view.active {
    display: block;
}

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

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: all 0.2s ease;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Dashboard Hero */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}
.hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}
.hero p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    text-align: center;
}
.stat-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.stat-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Learning View */
.card-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}

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

.direction-badge {
    background: rgba(255,255,255,0.05);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.leech-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.card-front {
    text-align: center;
    margin-bottom: 3rem;
}
.card-front h2 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.card-input-area {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}
.card-input-area input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1.2rem;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}
.card-input-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Feedback */
.card-feedback {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    animation: fadeIn 0.3s ease;
}
.card-feedback.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}
.card-feedback.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}
.correct-answer {
    font-size: 2rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: #fff;
}

/* Rating Area */
.rating-area {
    text-align: center;
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
    animation: fadeIn 0.4s ease;
}
.rating-prompt {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.rating-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.btn-rating {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    padding: 1rem 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}
.btn-rating:hover {
    transform: translateY(-4px);
}
.btn-rating .label {
    font-weight: 700;
    font-size: 1.1rem;
}
.btn-rating .desc {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}
.btn-rating.again:hover { background: var(--btn-again); border-color: var(--btn-again); box-shadow: 0 8px 20px var(--error-glow); }
.btn-rating.hard:hover { background: var(--btn-hard); border-color: var(--btn-hard); box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3); }
.btn-rating.good:hover { background: var(--btn-good); border-color: var(--btn-good); box-shadow: 0 8px 20px var(--success-glow); }
.btn-rating.easy:hover { background: var(--btn-easy); border-color: var(--btn-easy); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3); }

/* Suggestion glow */
.btn-rating.suggested {
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.hidden {
    display: none !important;
}

/* Forms */
.form-container {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}
.form-container h2 {
    margin-bottom: 2rem;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus {
    border-color: var(--primary);
}

.message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}
.message.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success-glow);
}

/* Dashboard Config Section */
.config-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.config-box, .vocab-list-box {
    padding: 2rem;
    border-radius: var(--border-radius);
}

.config-box h3, .vocab-list-box h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

.direction-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.direction-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: rgba(0,0,0,0.2);
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.direction-controls label:hover {
    background: rgba(255,255,255,0.05);
}

.mix-control {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.mix-control label {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.mix-control input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

/* Vocab List */
.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: white;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    outline: none;
}
.search-input:focus {
    border-color: var(--primary);
}

.table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
}

#vocabTable {
    width: 100%;
    border-collapse: collapse;
}

#vocabTable th {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

#vocabTable td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

#vocabTable tr:last-child td {
    border-bottom: none;
}

#vocabTable tr:hover td {
    background: rgba(255,255,255,0.03);
}

.btn-small {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-small:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    animation: fadeIn 0.3s ease;
}

.modal-content h2 {
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}
