/**
 * Scholar - Ancient Language Translations
 * Clean, scholarly design with ancient aesthetic touches
 */

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

:root {
    --bg-primary: #faf8f5;
    --bg-secondary: #f0ebe3;
    --bg-card: #ffffff;
    --text-primary: #2c2416;
    --text-secondary: #5c4d3d;
    --text-muted: #8b7355;
    --border-color: #d4c4a8;
    --border-focus: #8b6914;
    --accent: #8b6914;
    --accent-hover: #6b5010;
    --accent-light: #f5e6c8;
    --link: #5c4d3d;
    --shadow-light: 0 2px 8px rgba(44, 36, 22, 0.08);
    --shadow-medium: 0 4px 16px rgba(44, 36, 22, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --padding-page: 24px;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px var(--padding-page);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.logo:hover {
    color: var(--accent-hover);
}

.nav {
    display: flex;
    gap: 16px;
}

.nav-link {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--accent);
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Home View */
.home-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--padding-page);
    padding-bottom: 100px;
}

.brand {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-style: italic;
}

/* Language Selector */
.language-selector {
    margin-bottom: 24px;
    text-align: center;
}

.selector-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.language-select {
    padding: 12px 24px;
    font-size: 1rem;
    font-family: var(--font-sans);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 280px;
    transition: border-color 0.2s;
}

.language-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Search Form */
.search-form {
    width: 100%;
    max-width: 560px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    padding: 10px 18px;
    transition: all 0.2s;
    box-shadow: var(--shadow-light);
}

.search-box:hover,
.search-box:focus-within {
    box-shadow: var(--shadow-medium);
    border-color: var(--accent);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: transparent;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
    margin-left: 12px;
}

.search-button:hover {
    background: var(--accent-hover);
}

.stats {
    margin-top: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.language-info {
    margin-top: 24px;
    padding: 16px 24px;
    background: var(--accent-light);
    border-radius: var(--radius);
    text-align: center;
    max-width: 480px;
}

.language-info h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

/* Results View */
.results-view {
    flex: 1;
    padding: var(--padding-page);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

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

.back-link {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.back-link a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
}

.back-link a:hover {
    text-decoration: underline;
}

.current-language {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

.search-form-inline {
    margin-bottom: 12px;
}

.search-box-inline {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 16px;
    max-width: 400px;
}

.search-box-inline:focus-within {
    background: var(--bg-card);
    border-color: var(--accent);
}

.search-input-inline {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
}

.search-button-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.search-button-inline:hover {
    color: var(--accent);
}

.results-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Result Items */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-medium);
}

.result-english {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.result-translation {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 4px;
    direction: rtl; /* For Hebrew/Arabic */
}

.result-transliteration {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 8px;
}

.result-definition {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Detail View */
.detail-view {
    flex: 1;
    padding: var(--padding-page);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.detail-header {
    margin-bottom: 24px;
}

.detail-header a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
}

.detail-header a:hover {
    text-decoration: underline;
}

.word-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
}

.word-detail .word-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.word-detail .english-word {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.word-detail .translation-main {
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 8px;
    direction: rtl;
}

.word-detail .transliteration-main {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
}

.word-detail .pronunciation {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.word-detail .section {
    margin-bottom: 24px;
}

.word-detail .section-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.word-detail .section-content {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.word-detail .example {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent);
    padding: 16px;
    margin: 12px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.word-detail .example-original {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* RTL direction for Hebrew and other RTL languages */
.word-detail.rtl-lang .example-original,
.word-detail.rtl-lang .translation-main {
    direction: rtl;
}

.word-detail .example-transliteration {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 4px;
}

.word-detail .example-translation {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.word-detail .example-source {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.word-detail .related-words {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-detail .related-word {
    background: var(--accent-light);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.word-detail .part-of-speech {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px var(--padding-page);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    color: var(--accent);
}

.separator {
    opacity: 0.5;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .brand {
        font-size: 2.5rem;
    }

    .search-form {
        max-width: 100%;
    }

    .word-detail {
        padding: 20px;
    }

    .word-detail .translation-main {
        font-size: 2.2rem;
    }
}
