/* LinguaFlash - Modern Spanish Learning App */

:root {
    /* Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Neutrals */
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-elevated: #252542;
    --text: #ffffff;
    --text-muted: #9ca3af;
    --border: #374151;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-fire: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    line-height: 1.5;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Allow text selection in inputs */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* App Container */
#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo {
    font-size: 1.5rem;
}

.brand-name {
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-stats {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
}

.stat-icon {
    font-size: 1rem;
}

.stat-badge {
    background: var(--gradient-primary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: var(--space-lg);
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn var(--transition-normal);
}

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

/* Hero Section */
.hero {
    text-align: center;
    padding: var(--space-xl) 0;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.hero p {
    color: var(--text-muted);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-2xl);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-large {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.125rem;
    border-radius: var(--radius-xl);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

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

/* Sections */
.section {
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text-muted);
}

/* Deck Grid */
.deck-grid {
    display: grid;
    gap: var(--space-md);
}

.deck-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
}

.deck-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.deck-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.deck-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.deck-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.deck-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.deck-progress {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.deck-progress-fill {
    height: 100%;
    background: var(--gradient-success);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.deck-stats {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

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

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    display: block;
    margin-bottom: var(--space-xs);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Study View */
.study-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

/* Flashcard */
.card-container {
    perspective: 1000px;
    margin-bottom: var(--space-xl);
}

.flashcard {
    width: 100%;
    aspect-ratio: 3/4;
    max-height: 400px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flashcard.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-front {
    background: var(--gradient-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-back {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    transform: rotateY(180deg);
}

.card-type {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-lg);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    background: rgba(255,255,255,0.2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
}

.card-content {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.card-hint {
    font-size: 0.875rem;
    opacity: 0.8;
    font-style: italic;
}

.tap-hint {
    position: absolute;
    bottom: var(--space-lg);
    font-size: 0.75rem;
    opacity: 0.6;
}

.card-examples {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-md);
}

.card-examples p {
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

/* Answer Buttons */
.answer-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.answer-buttons.visible {
    opacity: 1;
    pointer-events: auto;
}

.btn-answer {
    flex-direction: column;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
}

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

.answer-emoji {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}

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

.btn-again:hover { border-color: var(--danger); }
.btn-hard:hover { border-color: var(--warning); }
.btn-good:hover { border-color: var(--success); }
.btn-easy:hover { border-color: var(--primary); }

/* Results View */
.results-container {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.results-header {
    margin-bottom: var(--space-2xl);
}

.celebration {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.results-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

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

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
}

.result-stat.highlight .result-value {
    background: var(--gradient-fire);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.streak-display {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-2xl);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.streak-fire {
    font-size: 3rem;
}

.streak-number {
    font-size: 3rem;
    font-weight: 800;
    background: var(--gradient-fire);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-elevated);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUp var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.xp { border-left: 4px solid var(--secondary); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: var(--space-2xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== Mobile Optimizations ==================== */

/* Touch-friendly buttons */
.btn {
    min-height: 44px; /* Apple's recommended touch target */
    -webkit-tap-highlight-color: transparent;
}

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

.btn-answer:active {
    transform: scale(0.95);
}

/* Better touch targets */
.deck-card,
.manage-item,
.available-card-item {
    min-height: 60px;
    -webkit-tap-highlight-color: transparent;
}

.deck-card:active,
.manage-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Flashcard touch feedback */
.flashcard:active .card-inner {
    transform: scale(0.98);
}

.flashcard.flipped:active .card-inner {
    transform: rotateY(180deg) scale(0.98);
}

/* Responsive */
@media (max-width: 480px) {
    .main-content {
        padding: var(--space-md);
    }
    
    .card-content {
        font-size: 1.5rem;
    }
    
    .results-stats {
        gap: var(--space-md);
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .btn-large {
        padding: var(--space-md) var(--space-xl);
        font-size: 1rem;
    }
    
    .navbar {
        padding: var(--space-sm) var(--space-md);
    }
    
    .nav-stats {
        gap: var(--space-sm);
    }
    
    .stat-item {
        font-size: 0.875rem;
    }
    
    .answer-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .btn-answer {
        padding: var(--space-sm);
    }
    
    .answer-emoji {
        font-size: 1.25rem;
    }
    
    .flashcard {
        max-height: 350px;
    }
    
    .modal-content {
        margin: var(--space-sm);
        max-height: calc(100vh - var(--space-lg));
        max-height: calc(100dvh - var(--space-lg));
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    :root {
        font-size: 14px;
    }
    
    .brand-name {
        display: none;
    }
    
    .quick-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quick-actions .btn {
        width: 100%;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .flashcard {
        max-height: 250px;
        aspect-ratio: 4/3;
    }
    
    .hero {
        padding: var(--space-md) 0;
    }
    
    .card-content {
        font-size: 1.25rem;
    }
}

/* Dark mode status bar */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card-inner {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border: #6b7280;
        --text-muted: #d1d5db;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}


/* ==================== Management UI ==================== */

/* Quick Actions */
.quick-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
}

.btn-block {
    width: 100%;
    margin-bottom: var(--space-md);
}

/* Manage Header */
.manage-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.manage-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Tabs */
.manage-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--bg-card);
    padding: var(--space-xs);
    border-radius: var(--radius-lg);
}

.tab-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.tab-btn:hover:not(.active) {
    color: var(--text);
}

.tab-content {
    display: none;
}

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

/* Manage List */
.manage-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.manage-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.manage-item:hover {
    border-color: var(--primary);
}

.manage-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.manage-item-info {
    flex: 1;
    min-width: 0;
}

.manage-item-info h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manage-item-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manage-item-actions {
    display: flex;
    gap: var(--space-xs);
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon-only:hover {
    color: var(--text);
    background: var(--border);
}

.btn-icon-only.danger:hover {
    color: var(--danger);
}

/* Card Filters */
.card-filters {
    margin-bottom: var(--space-md);
}

.card-filters select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.875rem;
}

/* Deck Detail */
.deck-detail-info {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.deck-detail-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}

.deck-detail-info h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-xs);
}

.deck-detail-info p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.deck-detail-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.deck-detail-actions .btn {
    flex: 1;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    animation: modalSlideIn var(--transition-normal);
}

.modal-large {
    max-width: 500px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close {
    font-size: 1.5rem;
    line-height: 1;
    padding: var(--space-xs) !important;
}

.modal-body {
    margin-bottom: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

/* Icon & Color Pickers */
.icon-picker,
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.icon-btn,
.color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    background: var(--bg-elevated);
}

.icon-btn:hover,
.color-btn:hover {
    border-color: var(--text-muted);
}

.icon-btn.selected,
.color-btn.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* Search Box */
.search-box {
    margin-bottom: var(--space-md);
}

.search-box input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.9375rem;
}

/* Available Cards List */
.available-cards-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.available-card-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.available-card-item:hover {
    background: var(--border);
}

.available-card-item.in-deck {
    opacity: 0.5;
}

.available-card-item .card-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.available-card-item.in-deck .card-check {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.available-card-item .card-text {
    flex: 1;
    min-width: 0;
}

.available-card-item .card-front-text {
    font-weight: 600;
    font-size: 0.875rem;
}

.available-card-item .card-back-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-right: 4px;
}


/* ==================== Confirm Modal ==================== */

.modal-confirm {
    max-width: 320px;
    text-align: center;
    padding: var(--space-xl);
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.modal-confirm h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.modal-confirm p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: var(--space-xl);
}

.confirm-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 100px;
}

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

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

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


/* ==================== Login Screen ==================== */

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--space-xl);
    text-align: center;
}

.login-logo {
    font-size: 5rem;
    margin-bottom: var(--space-md);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: var(--space-2xl);
}

.login-form {
    width: 100%;
    max-width: 320px;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: var(--space-lg);
}

.login-form input {
    text-align: center;
    font-size: 1.125rem;
    padding: var(--space-md);
}

.login-hint {
    margin-top: var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.login-hint.error {
    color: var(--danger);
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: var(--space-sm);
}


/* ==================== Bulk Import & Button Row ==================== */

.button-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.button-row .btn {
    flex: 1;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.bulk-preview {
    margin-top: var(--space-md);
    max-height: 150px;
    overflow-y: auto;
}

.bulk-preview-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
}

.bulk-preview-item .front {
    font-weight: 600;
}

.bulk-preview-item .back {
    color: var(--text-muted);
}

.bulk-preview-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}


/* ==================== Card Transition Fix ==================== */

.card-container {
    transition: opacity 0.2s ease, transform 0.2s ease;
}


/* ==================== New Card Back Design ==================== */

.card-back {
    justify-content: flex-start !important;
    padding-top: var(--space-xl) !important;
    overflow-y: auto;
}

.card-back-section {
    width: 100%;
    text-align: left;
    margin-bottom: var(--space-md);
}

.card-back-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-light);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.card-back-spanish {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    font-style: italic;
}

.card-back-english {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.card-back-example {
    font-size: 0.95rem;
    color: var(--text-muted);
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}


/* ==================== Settings Tab ==================== */

.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
}

.settings-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.settings-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}
