/* ============================================
   English Buddy - Index Page Styles
   ============================================ */

/* Inline header with tabs */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1em;
    flex-shrink: 0;
}

h1 {
    font-size: 1.3em;
    text-shadow: 0.1em 0.1em 0 rgba(0,0,0,0.1);
    margin: 0;
    white-space: nowrap;
}

.word-lists {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5em;
    flex: 1;
    align-content: start;
}

.list-card {
    background: var(--card-bg);
    border-radius: 1.2em;
    padding: 1.5em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.list-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0.3em;
    background: var(--card-color, #667eea);
}

.list-card:active {
    transform: scale(0.98);
}

.list-card:hover {
    transform: translateY(-0.3em) scale(1.01);
    box-shadow: var(--shadow-lg);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.6em;
    flex-wrap: wrap;
}

.card-count {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    background: var(--bg-light);
    padding: 0.4em 0.8em;
    border-radius: 1em;
    font-size: 0.8em;
    font-weight: 700;
    color: var(--text-muted);
}

.card-count::before {
    content: '📚';
}

/* Smart Review Card */
.smart-review-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.08) 100%);
    border: 2px solid rgba(16, 185, 129, 0.2);
}

.smart-review-card .card-count::before {
    content: '';
}

.smart-review-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.15);
}

/* Mastery Stats on Cards */
.mastery-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-size: 0.75em;
    cursor: help;
}

.mastery-stats span {
    opacity: 0.9;
}

.mastery-known {
    color: #48bb78;
}

.mastery-learning {
    color: #ed8936;
}

.mastery-new {
    color: #e53e3e;
}

.card-level {
    display: inline-block;
    background: var(--card-color, #667eea);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    padding: 0.3em 0.6em;
    border-radius: 0.5em;
}

.group-title {
    color: white;
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1.2em;
}

.group-header {
    background: rgba(255,255,255,0.1);
    border-radius: 1em;
    padding: 1em 1.5em;
    margin-bottom: 1.5em;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 1em;
}

.group-header-icon {
    font-size: 2.5em;
}

.group-header-info h2 {
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1.5em;
    color: white;
    margin-bottom: 0.2em;
}

.group-header-info p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9em;
}

.group-header-meta {
    margin-left: auto;
    text-align: right;
}

.group-header-meta .level-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.3em 0.8em;
    border-radius: 1em;
    font-weight: 700;
    font-size: 0.85em;
    display: block;
    margin-bottom: 0.5em;
}

.practice-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85em;
    font-weight: 700;
    padding: 0.6em 1.2em;
    border: none;
    border-radius: 2em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.3em 1em rgba(72, 187, 120, 0.4);
}

.practice-all-btn:hover {
    transform: translateY(-0.15em);
    box-shadow: 0 0.5em 1.5em rgba(72, 187, 120, 0.5);
}

.quiz-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85em;
    font-weight: 700;
    padding: 0.6em 1.2em;
    border: none;
    border-radius: 2em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.3em 1em rgba(237, 137, 54, 0.4);
    text-decoration: none;
}

.quiz-all-btn:hover {
    transform: translateY(-0.15em);
    box-shadow: 0 0.5em 1.5em rgba(237, 137, 54, 0.5);
}

.card-actions {
    display: flex;
    gap: 0.5em;
    margin-top: 0.8em;
    flex-wrap: wrap;
}

.card-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.75em;
    font-weight: 700;
    padding: 0.5em 1em;
    border: none;
    border-radius: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.card-btn-learn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 0.2em 0.6em rgba(72, 187, 120, 0.3);
}

.card-btn-learn:hover {
    transform: translateY(-0.1em);
    box-shadow: 0 0.3em 0.8em rgba(72, 187, 120, 0.4);
}

.card-btn-quiz {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 0.2em 0.6em rgba(237, 137, 54, 0.3);
}

.card-btn-quiz:hover {
    transform: translateY(-0.1em);
    box-shadow: 0 0.3em 0.8em rgba(237, 137, 54, 0.4);
}

.group-header-buttons {
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

/* Tab buttons */
.tabs {
    display: flex;
    gap: 0.6em;
    justify-content: center;
    flex-shrink: 0;
}

.tab-btn {
    padding: 0.2em 0.6em;
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1em;
    color: white;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 2em;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.tab-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-0.1em);
}

.tab-btn.active {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 0.3em 1em rgba(255,255,255,0.2);
}

/* ============================================
   Header Left (Title + Hamburger inline)
   ============================================ */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

/* ============================================
   Hamburger Menu (Inline with title)
   ============================================ */
.hamburger-menu {
    position: relative;
    z-index: 100;
}

.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.8em;
    height: 1.8em;
    font-size: 1em;
    color: white;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 0.5em;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.hamburger-icon {
    font-size: 1.5em;
    line-height: 0;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
}

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

.hamburger-btn[aria-expanded="true"] {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

/* Dropdown Menu */
.hamburger-dropdown {
    position: absolute;
    top: calc(100% + 0.3em);
    left: 0;
    min-width: 160px;
    background: var(--card-bg);
    border-radius: 0.8em;
    box-shadow: 0 0.4em 1.5em rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s ease;
    overflow: hidden;
}

.hamburger-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6em;
    width: 100%;
    padding: 0.8em 1em;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'Nunito', system-ui, sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.dropdown-icon {
    font-size: 1.1em;
}

.dropdown-text {
    flex: 1;
    text-align: left;
}

/* Test configuration styles */
.test-config {
    background: var(--card-bg);
    border-radius: 1.2em;
    padding: 2em;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    width: 100%;
}

.test-config.quick-test {
    align-self: start;
}

.test-config.custom-test {
    height: 100%;
}

.test-config-title {
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 2em;
    color: var(--text);
    margin-bottom: 1em;
    text-align: center;
}

.test-config-section {
    margin-bottom: 1.5em;
}

.test-config-label {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5em;
    display: block;
    font-size: 1em;
}

.test-config-select,
.test-config-radio-group {
    width: 100%;
}

.test-config-select {
    padding: 0.8em 1em;
    border: 2px solid var(--border);
    border-radius: 0.8em;
    font-size: 1em;
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.test-config-select:hover {
    border-color: #667eea;
}

.test-config-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.test-config-radio-group {
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
}

.test-config-radio {
    flex: 1;
    min-width: 8em;
}

.test-config-radio input[type="radio"] {
    display: none;
}

.test-config-radio label {
    display: block;
    padding: 0.8em 1.2em;
    border: 2px solid var(--border);
    border-radius: 0.8em;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--card-bg);
}

.test-config-radio input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 0.3em 0.8em rgba(102, 126, 234, 0.3);
}

.test-config-radio label:hover {
    border-color: #667eea;
    transform: translateY(-0.1em);
}

.test-start-btn {
    width: 100%;
    padding: 1em 2em;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 1em;
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.4em 1em rgba(72, 187, 120, 0.4);
    margin-top: 1em;
}

.test-start-btn:hover {
    transform: translateY(-0.15em);
    box-shadow: 0 0.6em 1.5em rgba(72, 187, 120, 0.5);
}

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

/* Grammar Filter Styles */
.filter-bar {
    background: rgba(255,255,255,0.15);
    border-radius: 1em;
    padding: 1em 1em;
    margin-bottom: 1em;
    backdrop-filter: blur(5px);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.8em;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 700;
    color: white;
    font-size: 0.9em;
    min-width: 4em;
}

.filter-pills {
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 0.2em 0.4em;
    border-radius: 2em;
    font-size: 0.9em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
}

.filter-pill:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-0.1em);
}

.filter-pill.active {
    background: white;
    color: #2d3748;
    border-color: white;
    box-shadow: 0 0.2em 0.8em rgba(255,255,255,0.3);
}

.filter-pill.level-basic.active {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

.filter-pill.level-intermediate.active {
    background: #ed8936;
    color: white;
    border-color: #ed8936;
}

.filter-pill.level-advanced.active {
    background: #9f7aea;
    color: white;
    border-color: #9f7aea;
}

.grammar-level-badge {
    display: inline-block;
    font-size: 0.7em;
    font-weight: 700;
    padding: 0.3em 0.6em;
    border-radius: 0.5em;
    margin-left: 0.5em;
    color: white;
}

.grammar-level-badge.basic { background: #48bb78; }
.grammar-level-badge.intermediate { background: #ed8936; }
.grammar-level-badge.advanced { background: #9f7aea; }

.card-category {
    display: inline-block;
    background: var(--bg-light);
    color: var(--text-muted);
    font-size: 0.75em;
    font-weight: 700;
    padding: 0.3em 0.6em;
    border-radius: 0.5em;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3em;
    color: white;
}

.no-results-icon {
    font-size: 4em;
    margin-bottom: 0.5em;
}

.no-results-text {
    font-size: 1.2em;
    opacity: 0.8;
}

/* Offline message */
.offline-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3em 2em;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 1.5em;
    box-shadow: 0 1em 3em rgba(0, 0, 0, 0.2);
    max-width: 400px;
    margin: 2em auto;
}

.offline-icon {
    font-size: 4em;
    margin-bottom: 0.3em;
    animation: pulse 2s ease-in-out infinite;
}

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

.offline-message h2 {
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1.8em;
    color: var(--text);
    margin-bottom: 0.5em;
}

.offline-message p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.5em;
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    margin-top: 1.5em;
    padding: 0.8em 2em;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 2em;
    font-family: 'Fredoka One', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0.4em 1em rgba(102, 126, 234, 0.4);
}

.retry-btn:hover {
    transform: translateY(-0.15em);
    box-shadow: 0 0.6em 1.5em rgba(102, 126, 234, 0.5);
}

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

/* ============================================
   Portrait Mode
   ============================================ */
@media (orientation: portrait) {
    .header-row {
        flex-direction: column;
        gap: 0.8em;
        text-align: center;
    }

    .header-left {
        justify-content: center;
    }

    h1 {
        font-size: 1.5em;
    }

    .tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .tab-btn {
        font-size: 0.9em;
    }

    .word-lists {
        grid-template-columns: 1fr !important;
        gap: 1em;
    }

    .list-card {
        padding: 1.2em;
    }

    .group-header {
        flex-direction: column;
        text-align: center;
        padding: 1em;
    }

    .group-header-meta {
        margin-left: 0;
        margin-top: 0.8em;
        text-align: center;
    }

    .group-header-buttons {
        justify-content: center;
    }

    /* Test Configuration Cards */
    .test-config {
        padding: 1.2em;
    }

    .test-config.quick-test {
        align-self: stretch;
    }

    .test-config.custom-test {
        height: auto;
    }

    .test-config-title {
        font-size: 1.4em;
        margin-bottom: 0.8em;
    }

    .test-config-section {
        margin-bottom: 1em;
    }

    .test-config-label {
        font-size: 0.9em;
    }

    .test-config-select {
        padding: 0.6em 0.8em;
        font-size: 0.9em;
    }

    .test-config-radio-group {
        flex-direction: column;
        gap: 0.5em;
    }

    .test-config-radio {
        min-width: 100%;
    }

    .test-config-radio label {
        padding: 0.6em 1em;
        font-size: 0.9em;
    }

    .test-start-btn {
        padding: 0.8em 1.5em;
        font-size: 1.1em;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-label {
        min-width: auto;
        margin-bottom: 0.3em;
    }

    .filter-pills {
        justify-content: center;
    }
}

