/* =============================================================================
   VocabForge - Spaced Repetition English Learning App
   CSS Stylesheet
   
   Design Philosophy: Industrial-minimal with warm accents
   Mobile-first responsive design for GitHub Pages hosting
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Custom Properties (Variables)
   ----------------------------------------------------------------------------- */
:root {
    /* Color Palette - Industrial warmth */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a24;
    --color-bg-card: #16161e;
    --color-bg-card-hover: #1e1e28;
    
    /* Accent Colors */
    --color-accent-primary: #f59e0b;
    --color-accent-secondary: #fbbf24;
    --color-accent-tertiary: #d97706;
    --color-accent-glow: rgba(245, 158, 11, 0.3);
    
    /* Status Colors */
    --color-success: #10b981;
    --color-success-glow: rgba(16, 185, 129, 0.3);
    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.3);
    --color-info: #3b82f6;
    --color-info-glow: rgba(59, 130, 246, 0.3);
    
    /* Purple for Next Word button */
    --color-purple: #8b5cf6;
    --color-purple-glow: rgba(139, 92, 246, 0.3);
    
    /* Text Colors */
    --color-text-primary: #fafafa;
    --color-text-secondary: #a1a1aa;
    --color-text-tertiary: #71717a;
    --color-text-muted: #52525b;
    
    /* Border & Dividers */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-hover: rgba(255, 255, 255, 0.15);
    
    /* Typography */
    --font-display: 'Space Mono', monospace;
    --font-body: 'Sora', sans-serif;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--color-accent-glow);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Z-index layers */
    --z-base: 1;
    --z-overlay: 100;
    --z-modal: 200;
    --z-toast: 300;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -----------------------------------------------------------------------------
   Background Decorations
   ----------------------------------------------------------------------------- */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.bg-circle-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-accent-primary) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: float 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--color-info) 0%, transparent 70%);
    bottom: 10%;
    left: -150px;
    animation: float 25s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--color-success) 0%, transparent 70%);
    top: 50%;
    right: -100px;
    animation: float 18s ease-in-out infinite 5s;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.05); }
}

/* -----------------------------------------------------------------------------
   App Container
   ----------------------------------------------------------------------------- */
.app-container {
    position: relative;
    z-index: var(--z-base);
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-md);
    padding-bottom: var(--space-2xl);
}

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
    padding: var(--space-md) 0;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--color-accent-primary);
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.time-display {
    text-align: right;
}

.time-label {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.time-value {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent-primary);
}

.time-date {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* -----------------------------------------------------------------------------
   Stats Bar
   ----------------------------------------------------------------------------- */
.stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.stat-due .stat-number {
    color: var(--color-accent-primary);
}

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

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--color-border);
}

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

.btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent-primary) 0%, var(--color-accent-tertiary) 100%);
    color: var(--color-bg-primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 40px var(--color-accent-glow);
}

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

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

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

.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.btn-small svg {
    width: 16px;
    height: 16px;
}

/* Action Buttons Container */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.btn-study {
    position: relative;
}

.btn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-sm);
    background: var(--color-danger);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px var(--color-danger-glow);
}

.btn-badge:empty,
.btn-badge[data-count="0"] {
    display: none;
}

/* -----------------------------------------------------------------------------
   Section Styles
   ----------------------------------------------------------------------------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: var(--space-xs);
}

.filter-tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    color: var(--color-text-secondary);
    border-color: var(--color-border-hover);
}

.filter-tab.active {
    color: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    background: rgba(245, 158, 11, 0.1);
}

/* -----------------------------------------------------------------------------
   Word List
   ----------------------------------------------------------------------------- */
.word-list-section {
    margin-bottom: var(--space-xl);
}

.word-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

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

.word-item:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-border-hover);
    transform: translateX(4px);
}

.word-item.due {
    border-left: 3px solid var(--color-accent-primary);
}

.word-item.learning {
    border-left: 3px solid var(--color-info);
}

.word-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.word-status.due {
    background: var(--color-accent-primary);
    box-shadow: 0 0 10px var(--color-accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

.word-status.learning {
    background: var(--color-info);
}

.word-status.mastered {
    background: var(--color-success);
}

.word-status.new {
    background: var(--color-text-tertiary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.word-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.word-meaning-preview {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.word-meta {
    text-align: right;
    flex-shrink: 0;
}

.word-stage {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.word-next-review {
    font-size: 0.75rem;
    color: var(--color-accent-primary);
}

.word-delete {
    padding: var(--space-sm);
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
}

.word-item:hover .word-delete {
    opacity: 1;
}

.word-delete:hover {
    color: var(--color-danger);
}

.word-delete svg {
    width: 18px;
    height: 18px;
}

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

.empty-state.hidden {
    display: none;
}

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

.empty-state p {
    font-size: 0.9rem;
}

/* -----------------------------------------------------------------------------
   Videos Section
   ----------------------------------------------------------------------------- */
.videos-section {
    margin-bottom: var(--space-xl);
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.video-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.video-item:hover {
    background: var(--color-bg-card-hover);
}

.video-thumbnail {
    width: 80px;
    height: 45px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.video-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-subtitle-status {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.video-subtitle-status.loaded {
    color: var(--color-success);
}

.video-subtitle-status.loading {
    color: var(--color-accent-primary);
}

.video-subtitle-status.error {
    color: var(--color-danger);
}

.video-delete {
    padding: var(--space-sm);
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.video-delete:hover {
    color: var(--color-danger);
}

.video-delete svg {
    width: 18px;
    height: 18px;
}

/* -----------------------------------------------------------------------------
   Modals
   ----------------------------------------------------------------------------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-text-tertiary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

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

.form-group textarea#subtitlesInput {
    min-height: 150px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    line-height: 1.6;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-top: var(--space-md);
}

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

.btn-cancel:hover {
    color: var(--color-text-primary);
    border-color: var(--color-border-hover);
}

/* -----------------------------------------------------------------------------
   Study Modal (Fullscreen)
   ----------------------------------------------------------------------------- */
.modal-fullscreen .modal-content {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.study-content {
    background: var(--color-bg-primary);
}

.study-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}

.btn-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-back:hover {
    color: var(--color-text-primary);
}

.btn-back svg {
    width: 24px;
    height: 24px;
}

.study-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.study-progress span {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: 2px;
    transition: width var(--transition-normal);
    width: 0%;
}

/* Study Views */
.study-view {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

.study-view.hidden {
    display: none;
}

/* Due Words List */
#studyListView h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
    color: var(--color-text-primary);
}

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

.study-list-header h2 {
    margin-bottom: 0;
}

.btn-start-all {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.btn-start-all svg {
    width: 16px;
    height: 16px;
}

.due-words-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.due-word-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.due-word-item:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-accent-primary);
    transform: translateX(4px);
}

.due-word-text {
    font-size: 1.125rem;
    font-weight: 600;
}

.due-word-stage {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
}

/* Single Word Study View */
.word-card {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.word-card .word-stage {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--color-accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-md);
}

.word-main {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
}

.word-meaning {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
}

.word-meaning.hidden {
    display: none;
}

.word-notes {
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
    font-style: italic;
    max-height: 100px;
    overflow-y: auto;
}

.word-notes.hidden {
    display: none;
}

/* Video Player Area */
.video-player-area {
    margin-bottom: var(--space-lg);
}

.video-player-area.hidden {
    display: none;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.video-container iframe,
.video-container #youtubePlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.subtitle-display {
    padding: var(--space-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.8;
    color: var(--color-text-primary);
    text-align: center;
    min-height: 60px;
}

.subtitle-display .highlight {
    background: var(--color-accent-primary);
    color: var(--color-bg-primary);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.subtitle-display .subtitle-time {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--color-accent-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.05em;
}

.subtitle-display .subtitle-text {
    font-size: 1rem;
    line-height: 1.8;
}

.subtitle-display .subtitle-variant-info {
    font-size: 0.75rem;
    color: var(--color-purple);
    margin-top: var(--space-sm);
    font-weight: 500;
}

.subtitle-display .subtitle-counter {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    margin-top: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.video-controls {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.btn-video {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.8rem;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-video:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-border-hover);
}

.btn-video svg {
    width: 16px;
    height: 16px;
}

/* Next Word Button - Special Purple Styling */
.btn-next-word {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--color-purple);
    color: var(--color-purple);
}

.btn-next-word:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--color-purple);
    box-shadow: 0 0 15px var(--color-purple-glow);
}

/* Sequential Mode - Show Meaning Area */
.sequential-meaning-area {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
}

.sequential-meaning-area.hidden {
    display: none;
}

.btn-show-meaning-sequential {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    background: linear-gradient(135deg, var(--color-info) 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn-show-meaning-sequential:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--color-info-glow);
}

.btn-show-meaning-sequential svg {
    width: 20px;
    height: 20px;
}

/* Sequential Mode - Revealed Meaning */
.sequential-meaning-revealed {
    text-align: center;
}

.sequential-meaning-revealed.hidden {
    display: none;
}

.sequential-meaning-text {
    font-size: 1.25rem;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
}

.sequential-notes-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    font-style: italic;
    padding: var(--space-sm);
    max-height: 120px;
    overflow-y: auto;
}

.sequential-notes-text:empty {
    display: none;
}

/* No Video Message */
.no-video-message {
    text-align: center;
    padding: var(--space-xl);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.no-video-message.hidden {
    display: none;
}

.no-video-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.no-video-message p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.no-video-message .hint {
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
}

/* Study Actions */
.study-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.btn-action {
    flex: 1;
    padding: var(--space-md);
    font-size: 0.9rem;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-action:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-border-hover);
}

/* Response Buttons */
.response-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.response-buttons.hidden {
    display: none;
}

.btn-response {
    flex-direction: column;
    padding: var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
}

.btn-response svg {
    width: 28px;
    height: 28px;
    margin-bottom: var(--space-sm);
}

.btn-response .next-review {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.7;
    margin-top: var(--space-xs);
}

.btn-dont-know {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.btn-dont-know:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-know {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.btn-know:hover {
    background: rgba(16, 185, 129, 0.25);
}

/* -----------------------------------------------------------------------------
   Loading Overlay
   ----------------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    gap: var(--space-lg);
}

.loading-overlay.hidden {
    display: none;
}

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

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

.loading-overlay p {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* -----------------------------------------------------------------------------
   Toast Notifications
   ----------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: calc(100% - var(--space-lg) * 2);
    max-width: 400px;
}

.toast {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease forwards;
}

.toast.success {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.15);
}

.toast.error {
    border-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.15);
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

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

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

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* -----------------------------------------------------------------------------
   Responsive Adjustments
   ----------------------------------------------------------------------------- */
@media (max-width: 480px) {
    :root {
        --space-md: 12px;
        --space-lg: 16px;
        --space-xl: 24px;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .time-value {
        font-size: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .word-main {
        font-size: 2rem;
    }
    
    .study-actions {
        flex-direction: column;
    }
    
    .response-buttons {
        grid-template-columns: 1fr;
    }
    
    .video-controls {
        gap: var(--space-xs);
    }
    
    .btn-video {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.7rem;
    }
    
    .btn-video svg {
        width: 14px;
        height: 14px;
    }
}

@media (min-width: 768px) {
    .app-container {
        padding: var(--space-xl);
    }
    
    .modal-fullscreen .modal-content {
        max-width: 800px;
        max-height: 90vh;
        height: auto;
        border-radius: var(--radius-lg);
        margin: auto;
    }
}

/* -----------------------------------------------------------------------------
   File Upload Section
   ----------------------------------------------------------------------------- */
.file-upload-section {
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Hide the actual file input - using proper method for mobile compatibility */
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.btn-file-upload {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    /* Make it work as a label for the file input */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-file-upload:hover,
.btn-file-upload:active {
    background: var(--color-bg-secondary);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-file-upload svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.file-name {
    font-size: var(--font-size-sm);
    color: var(--color-success);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.file-name:empty {
    display: none;
}

.file-name::before {
    content: '✓';
    font-weight: bold;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .btn-file-upload {
        width: 100%;
        justify-content: center;
        padding: var(--space-md);
        font-size: var(--font-size-base);
    }
    
    .file-name {
        width: 100%;
        text-align: center;
    }
}

/* -----------------------------------------------------------------------------
   Scrollbar Styling
   ----------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-tertiary) var(--color-bg-secondary);
}


/* -----------------------------------------------------------------------------
   Data Sync Section
   ----------------------------------------------------------------------------- */
.sync-section {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.btn-sync {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border: 1px dashed var(--color-border);
    font-size: 0.75rem;
    padding: var(--space-sm) var(--space-md);
}

.btn-sync:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

.btn-sync svg {
    width: 14px;
    height: 14px;
}