/* ============================================
   TOEIC Vocabulary Learning - Custom Styles
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);

    --accent: #06b6d4;
    --accent-light: #22d3ee;

    --success: #10b981;
    --success-light: #34d399;
    --success-bg: rgba(16, 185, 129, 0.1);

    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.1);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-light: #475569;

    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ── Navbar ── */
.navbar-custom {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    transition: var(--transition);
    z-index: 1000;
}

.navbar-brand-custom {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none !important;
}

.navbar-brand-custom:hover {
    filter: brightness(1.2);
}

.nav-link-custom {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-link-custom:hover,
.nav-link-custom.active {
    color: var(--text-primary) !important;
    background: rgba(99, 102, 241, 0.1);
}

.navbar-toggler {
    border: 1px solid var(--border) !important;
    padding: 0.4rem 0.6rem;
}

.navbar-toggler-icon {
    filter: invert(1);
}

/* ── Hero Section ── */
.hero-section {
    position: relative;
    padding: 5rem 0 3rem;
    text-align: center;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    font-weight: 400;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* ── Lesson Cards ── */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0 4rem;
    position: relative;
    z-index: 1;
}

.lesson-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none !important;
    color: var(--text-primary) !important;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.lesson-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.lesson-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: var(--bg-card-hover);
}

.lesson-card:hover::before {
    opacity: 1;
}

.lesson-card-day {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.lesson-card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.3px;
}

.lesson-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

.lesson-card-meta svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.lesson-card-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-light);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Learn Page ── */
.learn-header {
    padding: 2.5rem 0 1.5rem;
    position: relative;
    z-index: 1;
}

.learn-header-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.learn-header-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.learn-progress {
    margin: 1.5rem 0;
    position: relative;
    z-index: 1;
}

.progress-bar-wrapper {
    background: var(--bg-secondary);
    border-radius: 50px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 50px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: right;
}

/* ── Vocabulary Item ── */
.vocab-list {
    position: relative;
    z-index: 1;
    padding-bottom: 4rem;
}

.vocab-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.vocab-item:hover {
    border-color: var(--border-light);
}

.vocab-item.correct {
    border-color: var(--success) !important;
    background: var(--success-bg);
}

.vocab-item.incorrect {
    border-color: var(--danger) !important;
    background: var(--danger-bg);
}

.vocab-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.vocab-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.vocab-english {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-light);
    min-width: 160px;
    flex-shrink: 0;
}

.vocab-input-wrapper {
    flex: 1;
    min-width: 200px;
}

.vocab-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.vocab-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.vocab-input.is-correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.vocab-input.is-incorrect {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.vocab-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.vocab-answer {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    display: none;
    animation: slideDown 0.3s ease;
}

.vocab-answer.show {
    display: block;
}

.vocab-answer-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.vocab-answer-text {
    font-size: 1rem;
    color: var(--accent-light);
    font-weight: 500;
}

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

/* ── Buttons ── */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--primary-glow);
    color: #fff;
}

.btn-outline-custom {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-outline-custom:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.08);
}

.btn-success-custom {
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-success-custom:hover {
    background: linear-gradient(135deg, var(--success-light), var(--success));
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger-custom {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-danger-custom:hover {
    background: var(--danger);
    color: #fff;
}

.btn-reveal {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-reveal:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-reveal.revealed {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

/* ── Control Bar ── */
.control-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 1rem;
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Nav buttons ── */
.lesson-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0 0;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

/* ── Login Page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.form-group-custom {
    margin-bottom: 1.25rem;
}

.form-label-custom {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    display: block;
}

.form-input-custom {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-input-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-login {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
}

/* ── Admin Dashboard ── */
.admin-header {
    padding: 2rem 0 1rem;
    position: relative;
    z-index: 1;
}

.admin-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Admin Table */
.admin-table-wrapper {
    position: relative;
    z-index: 1;
    margin: 1.5rem 0 3rem;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table thead th {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

/* ── Import Page ── */
.import-wrapper {
    position: relative;
    z-index: 1;
    padding: 2rem 0 4rem;
}

.import-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.import-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.import-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.dropzone-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dropzone-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.file-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ── Alerts ── */
.alert-custom {
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid;
    position: relative;
    z-index: 1;
}

.alert-success-custom {
    background: var(--success-bg);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success-light);
}

.alert-danger-custom {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger-light);
}

.alert-warning-custom {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

/* ── Footer ── */
.footer-custom {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
}

/* ── Score Modal ── */
.score-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.score-overlay.show {
    display: flex;
}

.score-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.score-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.score-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.score-detail {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .lessons-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .lesson-card {
        padding: 1.25rem;
    }

    .learn-header-title {
        font-size: 1.5rem;
    }

    .vocab-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .vocab-english {
        min-width: auto;
        font-size: 1rem;
    }

    .vocab-input-wrapper {
        width: 100%;
        min-width: auto;
    }

    .vocab-actions {
        width: 100%;
    }

    .vocab-actions .btn-reveal {
        flex: 1;
        text-align: center;
    }

    .control-bar {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .control-bar .btn-primary-custom,
    .control-bar .btn-outline-custom,
    .control-bar .btn-success-custom {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .import-card {
        padding: 1.5rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-value {
        font-size: 2rem;
    }

    .admin-title {
        font-size: 1.5rem;
    }

    .score-card {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .lesson-nav {
        flex-direction: column;
    }

    .lesson-nav a {
        width: 100%;
        text-align: center;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ── Utilities ── */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

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