/* ====================================
   VocabMaster Pro - Styles
   ==================================== */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-hover: #252535;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    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);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.progress-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-bar-mini {
    flex: 1;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    overflow-y: auto;
}

/* View Headers */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.view-header h2 {
    font-size: 28px;
    font-weight: 700;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    width: 300px;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

/* Dashboard Stats */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.stat-card.primary .stat-icon {
    background: rgba(99, 102, 241, 0.2);
}

.stat-card.success .stat-icon {
    background: rgba(16, 185, 129, 0.2);
}

.stat-card.warning .stat-icon {
    background: rgba(245, 158, 11, 0.2);
}

.stat-card.info .stat-icon {
    background: rgba(59, 130, 246, 0.2);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Word of the Day */
.word-of-day {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

.word-of-day h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.wod-card {
    text-align: center;
    padding: 24px;
}

.wod-word {
    font-size: 36px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.wod-category {
    font-size: 12px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.wod-definition {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Quick Actions */
.quick-actions h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.action-btn {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: black;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Flashcard Styles */
.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 350px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.flashcard-front {
    background: var(--accent-gradient);
}

.flashcard-back {
    background: var(--bg-card);
    border: 2px solid var(--accent-primary);
    transform: rotateY(180deg);
}

.card-content {
    text-align: center;
}

.card-word {
    font-size: 42px;
    font-weight: 800;
    display: block;
    margin-bottom: 16px;
}

.card-hint {
    font-size: 14px;
    opacity: 0.8;
}

.card-definition {
    font-size: 24px;
    line-height: 1.5;
    display: block;
    margin-bottom: 16px;
}

.card-category {
    font-size: 12px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flashcard-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.card-counter {
    font-size: 16px;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 12px;
}

.filter-controls {
    display: flex;
    gap: 12px;
}

.filter-controls select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

/* Quiz Styles */
.quiz-setup {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.quiz-setup h3 {
    margin-bottom: 32px;
    font-size: 24px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.option-group {
    text-align: left;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.option-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
}

.quiz-info {
    display: flex;
    gap: 24px;
    font-size: 16px;
}

.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-question {
    text-align: center;
    margin-bottom: 32px;
}

.question-number {
    font-size: 14px;
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.question-text {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.4;
}

/* Quiz Options Grid - 4 Options Clearly Visible */
.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.quiz-option {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.quiz-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.quiz-option.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.quiz-option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.quiz-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.quiz-feedback {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 16px;
}

.quiz-feedback.correct {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.quiz-results {
    text-align: center;
    padding: 48px;
}

.quiz-results h3 {
    font-size: 32px;
    margin-bottom: 32px;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 32px;
}

.result-item {
    text-align: center;
}

.result-value {
    display: block;
    font-size: 48px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-label {
    color: var(--text-secondary);
}

/* Browse View */
.alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.alphabet-nav button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.alphabet-nav button:hover,
.alphabet-nav button.active {
    background: var(--accent-gradient);
    border-color: transparent;
}

.browse-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-item:hover {
    border-color: var(--accent-primary);
}

.word-item .word {
    font-weight: 600;
    font-size: 16px;
}

.word-item .definition {
    color: var(--text-secondary);
    font-size: 14px;
    flex: 1;
    margin-left: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.word-item .actions {
    display: flex;
    gap: 8px;
}

.word-item .actions button {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-item .actions button:hover {
    background: var(--accent-primary);
    border-color: transparent;
    color: white;
}

.browse-search input {
    width: 300px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
}

.category-card h4 {
    font-size: 18px;
    margin-bottom: 8px;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

.category-card .count {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 12px;
    background: var(--accent-gradient);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.words-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Root Words */
.roots-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.root-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.root-item .root {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.root-item .meaning {
    color: var(--text-secondary);
    margin: 8px 0;
}

.root-item .examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.root-item .example {
    padding: 4px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    font-size: 13px;
}

.roots-search input {
    width: 300px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

/* Bookmarks */
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.stats-card h4 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.progress-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-primary) 0%, var(--bg-hover) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--bg-card);
    border-radius: 50%;
}

.progress-circle span {
    position: relative;
    font-size: 28px;
    font-weight: 700;
}

.stats-details p {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.stats-details span {
    font-weight: 600;
    color: var(--accent-primary);
}

.category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-bar .label {
    width: 120px;
    font-size: 13px;
    color: var(--text-secondary);
}

.category-bar .bar {
    flex: 1;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
}

.category-bar .fill {
    height: 100%;
    background: var(--accent-gradient);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.pagination button.active {
    background: var(--accent-gradient);
    border-color: transparent;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar .logo h1,
    .sidebar .nav-item span:not(.nav-icon),
    .sidebar .sidebar-footer {
        display: none;
    }

    .logo {
        justify-content: center;
    }

    .nav-item {
        justify-content: center;
        padding: 14px;
    }

    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box input,
    .browse-search input,
    .roots-search input {
        width: 100%;
    }

    .flashcard {
        height: 280px;
    }

    .card-word {
        font-size: 28px;
    }

    .card-definition {
        font-size: 18px;
    }

    .quiz-options-grid {
        grid-template-columns: 1fr;
    }

    .quiz-option {
        min-height: 60px;
    }

    .results-stats {
        flex-direction: column;
        gap: 24px;
    }
}

/* Mobile Navigation (Bottom) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding-bottom: 70px;
    }

    .sidebar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
    }

    .logo,
    .sidebar-footer {
        display: none;
    }

    .nav-menu {
        display: flex;
        padding: 8px;
        justify-content: space-around;
        overflow-x: auto;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px 12px;
        font-size: 10px;
    }

    .nav-icon {
        font-size: 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}