/* style.css */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --background-card: #ffffff;
    --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-sm: 6px;
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --background: #111827;
    --background-alt: #1b2634;
    --background-card: #1f2937;
    --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    letter-spacing: -0.3px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header Styles */
header {
    margin-bottom: 32px;
}

.header-content {
    text-align: center;
    margin-bottom: 24px;
}

.title-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

h1 {
    color: var(--text-primary);
    font-size: 1.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease;
    letter-spacing: -0.025em;
}

h1:hover {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark-mode-toggle {
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.dark-mode-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .dark-mode-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .dark-mode-toggle .moon-icon {
    display: block;
}

/* Search Styles */
.search-container {
    max-width: 500px;
    margin: 0 auto;
}

.search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 10px 12px 10px 36px;
    font-size: 14px;
    font-weight: 400;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background-card);
    color: var(--text-primary);
    box-shadow: var(--shadow);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

#searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

#searchInput::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Filter Chips */
.filter-chips {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 12px;
    background: var(--background-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-chip:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* View Styles */
.view {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hidden {
    display: none;
}

/* Home View */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-card {
    text-align: center;
    padding: 20px 12px;
    border-right: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.stat-card:last-child {
    border-right: none;
}

.stat-card:hover {
    background: var(--background-alt);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

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

.welcome-section {
    padding: 32px 24px;
    text-align: center;
}

.welcome-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.welcome-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* Search Results */
.results-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.results-count {
    color: var(--text-muted);
    font-weight: 500;
    padding: 2px 8px;
    background: var(--background-alt);
    border-radius: 12px;
    font-size: 0.75rem;
}

.search-results {
    padding: 0;
    min-height: 150px;
}

.word-item {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    text-decoration: none;
    color: inherit;
}

.word-item:hover {
    background: var(--background-alt);
}

.word-item:last-child {
    border-bottom: none;
}

.word-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
    gap: 12px;
}

.word-ibénire {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.word-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.word-english {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Word Detail */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--background-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin: 20px 24px 0;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.word-detail-content {
    padding: 16px 24px 32px;
}

.detail-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-word {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
    letter-spacing: -0.025em;
}

.detail-english {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.detail-type {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.definition-section {
    margin-bottom: 20px;
}

.definition-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.definition-text {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--background-alt);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 48px 24px;
}

.conjugation-section {
    margin-bottom: 24px;
}

.conjugation-tables {
    display: grid;
    gap: 20px;
    margin-top: 12px;
}

.conjugation-table {
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.conjugation-table h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    text-transform: capitalize;
}

.conj-grid {
    display: grid;
    gap: 8px;
}

.conj-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.pronoun {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.examples-list {
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 12px;
}

.example-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.example-item:last-child {
    border-bottom: none;
}

.example-ibenire {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.example-english {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.action-btn {
   display: inline-flex;
   align-items: center;
   gap: 8px;
   padding: 12px 20px;
   background: var(--primary-color);
   color: white;
   border: none;
   border-radius: var(--radius);
   font-size: 0.875rem;
   font-weight: 500;
   cursor: pointer;
   transition: all 0.2s ease;
   font-family: inherit;
   text-decoration: none;
}

.action-btn:hover {
   background: var(--primary-hover);
   transform: translateY(-1px);
   box-shadow: var(--shadow-md);
}

/* Learn View */
.learn-content {
   padding: 20px 24px 32px;
}

.learn-content h2 {
   font-size: 1.5rem;
   font-weight: 600;
   color: var(--text-primary);
   margin-bottom: 8px;
}

.learn-subtitle {
   color: var(--text-secondary);
   font-size: 0.875rem;
   margin-bottom: 24px;
}

.lesson-card {
   background: var(--background-alt);
   border: 1px solid var(--border-color);
   border-radius: var(--radius);
   padding: 20px;
   margin-bottom: 16px;
   transition: all 0.2s ease;
}

.lesson-card:hover {
   box-shadow: var(--shadow-md);
   border-color: var(--primary-color);
}

.lesson-header {
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   margin-bottom: 12px;
   gap: 12px;
}

.lesson-header h3 {
   font-size: 1.125rem;
   font-weight: 600;
   color: var(--text-primary);
}

.lesson-badge {
   background: var(--primary-color);
   color: white;
   padding: 2px 8px;
   border-radius: 12px;
   font-size: 0.625rem;
   font-weight: 600;
   text-transform: uppercase;
   letter-spacing: 0.05em;
   flex-shrink: 0;
}

.lesson-content {
   color: var(--text-secondary);
   font-size: 0.875rem;
   line-height: 1.6;
}

.lesson-content b {
   color: var(--primary-color);
   font-weight: 600;
}

/* Practice View */
.practice-content {
   padding: 20px 24px 32px;
}

.practice-content h2 {
   font-size: 1.5rem;
   font-weight: 600;
   color: var(--text-primary);
   margin-bottom: 8px;
}

.practice-subtitle {
   color: var(--text-secondary);
   font-size: 0.875rem;
   margin-bottom: 24px;
}

.practice-card {
   background: var(--background-alt);
   border: 1px solid var(--border-color);
   border-radius: var(--radius);
   padding: 20px;
   margin-bottom: 16px;
   transition: all 0.2s ease;
}

.practice-card:hover {
   box-shadow: var(--shadow-md);
   border-color: var(--primary-color);
}

.practice-header {
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   margin-bottom: 12px;
   gap: 12px;
}

.practice-header h3 {
   font-size: 1.125rem;
   font-weight: 600;
   color: var(--text-primary);
}

.difficulty-badge {
   background: #10b981;
   color: white;
   padding: 2px 8px;
   border-radius: 12px;
   font-size: 0.625rem;
   font-weight: 600;
   text-transform: uppercase;
   letter-spacing: 0.05em;
   flex-shrink: 0;
}

.difficulty-badge.intermediate {
   background: #f59e0b;
}

.difficulty-badge.advanced {
   background: #ef4444;
}

.practice-card p {
   color: var(--text-secondary);
   font-size: 0.875rem;
   line-height: 1.6;
   margin-bottom: 16px;
}

.start-practice-btn {
   background: var(--primary-color);
   color: white;
   border: none;
   border-radius: var(--radius-sm);
   padding: 8px 16px;
   font-size: 0.75rem;
   font-weight: 500;
   cursor: pointer;
   transition: all 0.2s ease;
   font-family: inherit;
   text-transform: uppercase;
   letter-spacing: 0.05em;
}

.start-practice-btn:hover {
   background: var(--primary-hover);
   transform: translateY(-1px);
}

/* Collapsible Sections */
.collapsible-section {
   margin-bottom: 20px;
}

.collapsible-header {
   width: 100%;
   display: flex;
   justify-content: space-between;
   align-items: center;
   background: var(--background-alt);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-sm);
   padding: 12px 16px;
   cursor: pointer;
   transition: all 0.2s ease;
   font-family: inherit;
   font-size: 0.875rem;
   font-weight: 600;
   color: var(--text-primary);
}

.collapsible-header:hover {
   background: var(--border-color);
}

.collapsible-header.open {
   border-bottom-left-radius: 0;
   border-bottom-right-radius: 0;
   border-bottom-color: transparent;
}

.collapsible-title {
   flex-grow: 1;
   text-align: left;
}

.chevron-icon {
   transition: transform 0.2s ease;
   color: var(--text-muted);
}

.collapsible-header.open .chevron-icon {
   transform: rotate(180deg);
}

.collapsible-content {
   max-height: 0;
   overflow: hidden;
   transition: max-height 0.3s ease;
   border: 1px solid var(--border-color);
   border-top: none;
   border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.collapsible-content.open {
   max-height: 1000px;
}

.collapsible-content .conjugation-tables,
.collapsible-content .examples-list {
   margin: 0;
   background: transparent;
   border: none;
   border-radius: 0;
   padding: 16px;
}

/* Reflexive Styles */
.reflexive-info {
   padding: 16px;
}

.reflexive-note {
   background: #eff6ff;
   border: 1px solid #bfdbfe;
   border-radius: var(--radius-sm);
   padding: 12px;
   font-size: 0.875rem;
   color: #1e40af;
   margin-bottom: 16px;
}

[data-theme="dark"] .reflexive-note {
   background: #1e3a8a;
   border-color: #3730a3;
   color: #93c5fd;
}

.reflexive-examples {
   background: var(--background-alt);
   border: 1px solid var(--border-color);
   border-radius: var(--radius-sm);
   padding: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .stat-card {
        padding: 16px 8px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .word-item, .word-detail-content {
        padding: 12px 16px;
    }
    
    .results-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .word-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .detail-word {
        font-size: 1.75rem;
    }
    
    .back-btn {
        margin: 16px;
    }
    
    .welcome-section {
        padding: 24px 16px;
    }

    .conjugation-tables {
        gap: 16px;
    }
    
    .conjugation-table {
        padding: 12px;
    }

   .action-buttons {
       flex-direction: column;
       align-items: center;
   }
   
   .action-btn {
       width: 100%;
       max-width: 280px;
       justify-content: center;
   }
   
   .lesson-header,
   .practice-header {
       flex-direction: column;
       align-items: flex-start;
       gap: 8px;
   }
   
   .learn-content,
   .practice-content {
       padding: 16px;
   }
   
   .lesson-card,
   .practice-card {
       padding: 16px;
   }
   
   .collapsible-header {
       padding: 10px 12px;
       font-size: 0.8125rem;
   }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .filter-chips {
        gap: 8px;
    }
    
    .filter-chip {
        border-radius: 999px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .detail-word {
        font-size: 1.5rem;
    }
    
    .title-row {
        gap: 12px;
    }

    #searchInput {
        font-size: 16px;
        padding: 12px 12px 12px 40px;
    }
    
    .search-icon {
        left: 14px;
    }

   .difficulty-badge,
   .lesson-badge {
       font-size: 0.5625rem;
       padding: 1px 6px;
   }
   
   .start-practice-btn {
       width: 100%;
       padding: 10px 16px;
       font-size: 0.8125rem;
   }
}

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(255, 255, 255);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.auth-content {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form input {
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.auth-form button {
    padding: 12px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-form button:hover {
    background: var(--primary-hover);
}

.auth-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    text-align: center;
}

[data-theme="dark"] .auth-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

.main-app-hidden {
    display: none;
}