@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Gujarati:wght@400;600;700&display=swap');

:root {
    --bg: #fcfcfa;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #2563eb;
    --row-hover: #f3f4f6;
    --input-bg: #ffffff;
    --btn-bg: #2563eb;
    --btn-text: #ffffff;
    --auth-glass: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --text: #f8fafc;
    --border: #1e293b;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --row-hover: #1e293b;
    --input-bg: #1e293b;
    --btn-bg: #38bdf8;
    --btn-text: #0f172a;
    --auth-glass: rgba(15, 23, 42, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

header h1 span {
    color: var(--muted);
    font-weight: 400;
}

/* Shared Premium Card Theme */
.curriculum-section, .word-table {
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--input-bg);
    transition: all 0.3s ease;
}

/* Curriculum Roadmap Specifics */
.curriculum-section {
    /* Transitions handled by shared class */
}

.curriculum-toggle {
    width: 100%;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.curriculum-toggle:hover {
    background: rgba(37, 99, 235, 0.05);
}

.curriculum-toggle .toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: var(--muted);
}

.curriculum-section.expanded .toggle-icon {
    transform: rotate(45deg);
}

.curriculum-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
}

.curriculum-section.expanded .curriculum-content {
    max-height: 800px;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.curriculum-level-group {
    margin-top: 1.5rem;
}

.curriculum-level-group:first-child {
    margin-top: 0.5rem;
}

.curriculum-level-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.curriculum-level-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    opacity: 0.2;
    margin-left: 0.5rem;
}

/* Level Progress Bars */
.level-progress-outer {
    flex: 1;
    max-width: 120px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin: 0 0.75rem;
    overflow: hidden;
    opacity: 0.6;
}

.level-progress-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-progress-text {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.curriculum-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.curriculum-item {
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.curriculum-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.curriculum-item.active {
    background: var(--accent) !important;
    border-color: var(--accent);
    color: white !important;
}

[data-theme="dark"] .curriculum-item {
    background: #1e1e1e;
}

/* Mastery Colors */
.curriculum-item.mastered {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.45);
    color: #059669;
}
.curriculum-item.learning {
    background: rgba(245, 158, 11, 0.08) !important;
    border-color: rgba(245, 158, 11, 0.45);
    color: #d97706;
}
.curriculum-item.focus {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.45);
    color: #dc2626;
}

[data-theme="dark"] .curriculum-item.mastered { background: rgba(16, 185, 129, 0.05) !important; color: #34d399; }
[data-theme="dark"] .curriculum-item.learning { background: rgba(245, 158, 11, 0.05) !important; color: #fbbf24; }
[data-theme="dark"] .curriculum-item.focus { background: rgba(239, 68, 68, 0.05) !important; color: #f87171; }

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.action-row-secondary {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 240px;
    transition: all 0.3s ease;
}

.main-search {
    width: 100%;
    height: 36px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0 1rem 0 2.5rem;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.main-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    min-width: 320px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    width: 16px;
    height: 16px;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s;
}

.clear-search {
    position: absolute;
    right: 0.8rem;
    background: var(--border);
    border: none;
    color: var(--muted);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
}

.clear-search:hover {
    background: var(--muted);
    color: var(--bg);
}

.search-container:hover .clear-search.show {
    display: flex;
}

.main-search:focus + .search-icon {
    color: var(--accent);
}

.btn-auth {
    background: var(--auth-glass);
    border: 1px solid var(--border);
    color: var(--text);
    height: 36px;
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.btn-auth img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-auth:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-auth.logged-in {
    background: rgba(16, 185, 129, 0.05);
    border-color: var(--border);
    color: var(--text);
    padding-left: 6px; /* Less padding since photo is there */
}

.btn-auth.logged-in:hover {
    background: var(--row-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.practice-container {
    position: relative;
}

.btn-practice {
    background: var(--accent);
    color: white;
    border: none;
    height: 36px;
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-practice:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

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

.practice-dropdown, .lang-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 140px;
    display: none;
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.2s ease-out;
}

.practice-dropdown.show, .lang-dropdown.show {
    display: block;
}

.practice-dropdown button, .lang-dropdown button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    text-align: left;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
}

.practice-dropdown button:hover, .lang-dropdown button:hover {
    background: var(--row-hover);
    color: var(--accent);
}

.btn-lang {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    height: 36px;
    padding: 0 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-lang:hover {
    background: var(--row-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-lang::after {
    content: "▼";
    font-size: 0.6rem;
    opacity: 0.6;
}

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

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
    background: var(--row-hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.icon-btn svg, .page-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}



/* Refined Table Section */
.word-table {
    /* Shared styles handled above */
    margin-bottom: 0; /* Clear bottom margin if at end */
}

.table-header {
    display: grid;
    grid-template-columns: 40px minmax(0, 2.3fr) minmax(0, 1.5fr) minmax(0, 1.8fr) 68px 100px;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem; /* Matched to row padding */
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(37, 99, 235, 0.02);
}

.table-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 2.3fr) minmax(0, 1.5fr) minmax(0, 1.8fr) 68px 100px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem; /* Unified padding */
    transition: all 0.2s ease-out;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background: var(--row-hover);
    transform: translateX(4px);
}

.col-french {
    font-weight: 600;
    font-size: 1rem;
}

.col-guj, .col-pron {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 500;
}

.col-guj, .lang-gujarati {
    font-family: 'Noto Sans Gujarati', sans-serif;
}

.col-eng {
    color: var(--muted);
    font-size: 0.9rem;
}

.col-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.col-progress {
    display: flex;
    gap: 4px;
    align-items: center;
}

.skill-indicator {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--muted);
    opacity: 0.4;
    transition: all 0.2s;
}

.skill-indicator.active {
    opacity: 1;
    color: white;
}

.skill-indicator.hard {
    background: #ef4444;
}

.skill-indicator.easy {
    background: #10b981;
}

.skill-indicator.neutral {
    background: #9ca3af;
}

.tag-pill {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--border);
    color: var(--muted);
    border: 1px solid transparent;
    white-space: nowrap;
}

[data-theme="dark"] .tag-pill {
    background: #1e1e1e;
}

.tag-active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(37, 99, 235, 0.1);
}

/* Play & Action Buttons */
.level-badge-small {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
}

[data-theme="dark"] .level-badge-small {
    background: var(--accent);
    color: var(--bg);
}

.level-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s;
}

.level-badge.active {
    background: var(--accent);
    color: white;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.icon-btn:active {
    transform: translateY(1px);
}

.icon-btn-big {
    width: 80px;
    height: 80px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-big:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.icon-btn-big:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.play-btn {
    color: var(--text);
    position: relative;
}

.play-btn svg {
    opacity: 0.8;
}

/* Loading Spinner for Buttons */
.icon-btn.loading, .icon-btn-big.loading {
    pointer-events: none;
    opacity: 0.7;
}

.icon-btn.loading svg, .icon-btn-big.loading svg {
    visibility: hidden;
}

.icon-btn.loading::after, .icon-btn-big.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    left: calc(50% - 8px);
    top: calc(50% - 8px);
    visibility: visible;
}

.icon-btn-big.loading::after {
    width: 32px;
    height: 32px;
    border-width: 3px;
    left: calc(50% - 16px);
    top: calc(50% - 16px);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 0;
}

.page-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-text {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-text:hover {
    background: var(--row-hover);
    color: var(--text);
    border-color: var(--muted);
}

/* Modal System */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-header h2 {
    font-size: 1.1rem;
    text-transform: capitalize;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
}

/* Practice Settings Container */
.practice-settings-container {
    background: var(--row-hover);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    border: 1px solid var(--border);
}

.setting-label {
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-hint {
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Tag Selection */
.tag-selection {
    position: relative;
}

.tag-search-box {
    position: relative;
}

#modalTagSearch, #modalLevelSearch {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    outline: none;
}

#modalTagSearch:focus, #modalLevelSearch:focus {
    border-color: var(--accent);
}

.tag-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 2100;
    display: none;
}

.tag-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.suggestion-item:hover {
    background: var(--row-hover);
    color: var(--accent);
}

.mastery-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
}

.mastery-dot.mastered { background-color: #10b981; }
.mastery-dot.learning { background-color: #f59e0b; }
.mastery-dot.focus { background-color: #ef4444; }

.active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.modal .tag-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-right: 6px;
    cursor: pointer;
}

.tag-pill .remove-tag {
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.2s;
}

.tag-pill:hover .remove-tag {
    opacity: 1;
    color: #ef4444;
}

/* Practice Area */
.practice-area {
    padding: 2.5rem 1.5rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    text-align: center;
    width: 100%;
}

.card-prompt {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text);
}

.answer-details {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--row-hover);
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

.answer-french {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.answer-pron {
    font-family: 'Noto Sans Gujarati', sans-serif;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.answer-meaning {
    font-size: 1rem;
    opacity: 0.9;
}

.input-area input {
    width: 100%;
    padding: 1rem;
    font-size: 16px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.input-area input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


.btn-reveal, .btn-next {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-next {
    background: #10b981;
    color: white;
}

/* Difficulty */
.difficulty-wrap {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.difficulty-wrap span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-bottom: 0.75rem;
}

.difficulty-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.difficulty-buttons button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-1:hover { background: #d1fae5; color: #065f46; border-color: #10b981; }
.diff-2:hover { background: #ecfdf5; color: #065f46; border-color: #10b981; }
.diff-3:hover { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.diff-4:hover { background: #ffedd5; color: #9a3412; border-color: #f97316; }
.diff-5:hover { background: #fee2e2; color: #991b1b; border-color: #ef4444; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Auth Modal Specifics */
.auth-modal-content {
    max-width: 400px;
}

.auth-body {
    padding: 2rem;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: center;
}

.auth-input-group {
    margin-bottom: 1.25rem;
}

.auth-input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
}

.auth-input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Profile Modal Specifics */
.profile-modal-content {
    max-width: 450px;
}

.profile-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem 2rem 2rem;
}

.profile-photo-section {
    position: relative;
}

.photo-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 3px solid var(--accent);
    background: var(--border);
    cursor: pointer;
}

.photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-container:hover .photo-overlay {
    opacity: 1;
}

.profile-details-form {
    width: 100%;
}

.name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-outline {
    background: transparent;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: rgba(255, 68, 68, 0.1);
}

.auth-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

.auth-input-group input,
.auth-input-group select {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    box-sizing: border-box;
    font-size: 0.9rem;
}

.auth-input-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.auth-input-group input:focus,
.auth-input-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider:not(:empty)::before {
    margin-right: .75em;
}

.auth-divider:not(:empty)::after {
    margin-left: .75em;
}

.auth-submit {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.8rem !important;
}

.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-switch button {
    background: transparent;
    border: none;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    margin-left: 0.25rem;
    padding: 0;
}

.auth-switch button:hover {
    text-decoration: underline;
}

/* Dictionary Tooltip Styling */
.dict-tooltip {
    position: fixed;
    z-index: 9999;
    width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 1.25rem;
    display: none;
    pointer-events: auto;
    animation: dictIn 0.2s ease-out;
    max-height: none;
    overflow-y: visible;
}

[data-theme="dark"] .dict-tooltip {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
}

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

.dict-loading {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    padding: 1rem;
}

.dict-loading {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    padding: 0.5rem;
}

.dict-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.dict-word {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}

.dict-phonetic {
    font-size: 0.8rem;
    color: var(--accent);
    font-family: monospace;
}

.dict-meanings {
    margin-bottom: 1rem;
}

.dict-meaning {
    margin-bottom: 0.75rem;
}

.dict-pos {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-bottom: 0.2rem;
}

.dict-definition {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
}

.dict-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.dict-examples-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dict-example-item {
    font-size: 0.75rem;
    padding: 0.5rem;
    background: rgba(37, 99, 235, 0.05);
    border-left: 2px solid var(--accent);
    border-radius: 4px;
}

.dict-ex-fr {
    font-weight: 600;
    display: block;
    margin-bottom: 0.1rem;
}

.dict-ex-en {
    color: var(--muted);
    font-style: italic;
}

/* Responsive Refinements */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    header {
        margin-bottom: 2rem; /* Restore some margin */
        padding-bottom: 1.2rem;
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
    }

    header h1 {
        font-size: 1.2rem;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-container {
        width: 100%;
        min-width: 0;
    }

    .main-search:focus {
        min-width: 0; /* Don't expand on mobile */
    }

    .action-row-secondary {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        justify-content: center;
    }

    .practice-container { 
        flex: 1 0 auto; 
    }
    
    .btn-practice {
        width: 100%;
        height: 38px;
    }

    .lang-selector, .btn-auth {
        height: 38px;
        flex: 0 1 auto;
        font-size: 0.75rem;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

    .table-header {
        display: none; 
    }

    .table-row {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-areas: 
            "french actions"
            "guj actions"
            "eng eng"
            "footer footer";
        gap: 0.5rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: var(--bg-card);
        box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    }

    .table-row:hover {
        transform: none;
        background: var(--bg-card);
    }

    /* Fix for the wide speech button background */
    .table-row > div:first-child { 
        grid-area: actions; 
        align-self: center;
        justify-self: end; /* This prevents the box from stretching too wide */
        background: var(--row-hover);
        padding: 12px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .col-french { 
        grid-area: french; 
        font-size: 1.15rem; 
        font-weight: 800;
        color: var(--accent);
        line-height: 1.2;
    }
    
    .col-guj { 
        grid-area: guj; 
        font-size: 0.9rem; 
        opacity: 0.8;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .col-eng { 
        grid-area: eng; 
        display: block; 
        border-top: 1px solid var(--border); 
        padding-top: 0.6rem; 
        margin-top: 0.2rem;
        font-size: 0.9rem;
        color: var(--text);
        opacity: 0.9;
    }
    
    /* Footer Area (Skills and Tags) */
    .col-progress {
        grid-row: 4;
        grid-column: 1;
        margin-top: 0.5rem;
        display: flex;
        gap: 4px;
        align-items: center;
    }

    .col-actions {
        grid-row: 4;
        grid-column: 2;
        margin-top: 0.5rem;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .word-table {
        border: none;
        background: transparent;
    }

    /* Full-screen Modals */
    .modal.show {
        align-items: flex-end; /* Mobile: start from bottom */
    }

    .modal-content {
        width: 100%;
        max-width: none;
        height: 100%; /* Default to full height */
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    /* Override for specific modals that shouldn't be full height but should be bottom sheets */
    .auth-modal-content {
        height: auto;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
    }

    @keyframes modalInMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-content {
        animation: modalInMobile 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .modal-header {
        padding: 1.25rem;
    }

    .practice-area {
        padding: 1.5rem;
        flex: 1;
    }

    .card-prompt {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .answer-details {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .difficulty-buttons button {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    .dict-tooltip {
        width: 90%;
        left: 5% !important;
        bottom: 20px;
        top: auto !important;
        transform: none !important;
        max-height: 50vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    header h1 { font-size: 1rem; }
    .btn-auth { font-size: 0.7rem; padding: 0.4rem 0.75rem; }
    .curriculum-item { font-size: 0.8rem; padding: 0.35rem 0.75rem; }
}

.lang-selector {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.lang-selector:hover {
    border-color: var(--accent);
}
.lang-selector:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Magic Button for Gemini Generation */
.magic-btn {
    opacity: 0.6;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    padding: 2px 4px;
    cursor: pointer;
}
.magic-btn:hover {
    opacity: 1;
    transform: scale(1.2) rotate(10deg);
    color: var(--accent);
}
.magic-btn:active {
    transform: scale(0.9);
}


/* Toast System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 10000;
    pointer-events: none;
    width: 100%;
    max-width: 400px;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 1.75rem;
    border-radius: 50px; /* Pill shape */
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

[data-theme="dark"] .toast {
    background: rgba(30, 41, 59, 0.95);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

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

.toast.removing {
    animation: toastOut 0.3s forwards cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

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

@media (max-width: 768px) {
    .toast-container {
        padding: 0 1.5rem;
        bottom: 1.5rem;
    }
}

/* Add Word Feature */
.btn-add {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
    height: 36px;
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-add:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

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

.add-word-modal-content {
    max-width: 500px !important;
}

.row-flex {
    margin-bottom: 0;
}

.pron-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.section-subtitle {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.pron-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 600px) {
    .pron-grid {
        grid-template-columns: 1fr;
    }
    .btn-add {
        width: 100%;
        justify-content: center;
        height: 38px;
    }
}

/* Subtle Actions */
.col-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-row:hover .col-actions {
    opacity: 0.6;
}

.col-actions:hover {
    opacity: 1 !important;
}

.col-actions .icon-btn {
    color: var(--muted);
    transition: all 0.2s;
}

.col-actions .icon-btn:hover {
    background: var(--border);
}

.col-actions .icon-btn[title="Edit"]:hover {
    color: var(--accent);
}

.col-actions .icon-btn[title="Delete"]:hover {
    color: #ef4444;
}

/* Ensure icons are smaller and cleaner */
.col-actions svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.col-actions-header {
    opacity: 0.4;
    font-size: 0.65rem;
    padding-left: 1.5rem;
}

.col-actions {
    padding-left: 1.5rem;
}
