:root {
    --primary-color: #2D5A27; /* Forest Green */
    --primary-light: #4A7C43;
    --secondary-color: #8B5A2B; /* Earthy Brown */
    --background-color: #F4F1EA; /* Warm Off-White */
    --surface-color: #FFFFFF;
    --text-primary: #2C352D;
    --text-secondary: #5A665A;
    --border-color: #D3D0C6;
    --error-color: #B23A48;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(45, 90, 39, 0.08);
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 30px 30px;
}

.app-container {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 700px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 70px; /* Space for bottom nav */
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    border-bottom: 4px solid var(--secondary-color);
}

.header-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 0.5rem;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

header h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5rem; letter-spacing: -0.5px; }
header p { font-size: 1.1rem; opacity: 0.9; font-weight: 400; }

main { padding: 2rem; flex-grow: 1; }

/* Bottom Navigation Tabs */
.bottom-nav { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    display: flex; 
    background-color: var(--surface-color); 
    border-top: 1px solid var(--border-color); 
    border-bottom: none;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.tab-btn { flex: 1; background: none; border: none; padding: 1rem 0.5rem; font-size: 0.9rem; color: var(--text-secondary); cursor: pointer; border-bottom: none; border-top: 3px solid transparent; border-radius: 0; white-space: nowrap; transition: var(--transition); }
.tab-btn:hover { color: var(--primary-color); background-color: rgba(45, 90, 39, 0.05); }
.tab-btn.active { color: var(--primary-color); border-top: 3px solid var(--primary-color); font-weight: 700; background-color: rgba(45, 90, 39, 0.02); }

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

.search-section { 
    margin-bottom: 2rem; 
    position: sticky; 
    top: 0; 
    background-color: var(--background-color); 
    padding: 1rem; 
    margin: -1rem -1rem 2rem -1rem; 
    z-index: 50;
    border-bottom: 1px solid var(--border-color);
}

.input-group { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; position: relative; }
input[type="text"] { flex-grow: 1; padding: 1rem 1.25rem; font-size: 1.1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--background-color); color: var(--text-primary); transition: var(--transition); }
input[type="text"]:focus { outline: none; border-color: var(--primary-color); background-color: var(--surface-color); box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1); }

button { background-color: var(--primary-color); color: white; border: none; padding: 1rem 1.5rem; font-size: 1.1rem; font-weight: 600; border-radius: var(--radius-md); cursor: pointer; transition: var(--transition); }
button:hover { background-color: var(--primary-light); transform: translateY(-1px); }
button:active { transform: translateY(1px); }

/* Auto Suggestions */
.suggestions-container { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-md); z-index: 10; max-height: 200px; overflow-y: auto; margin-top: 4px; }
.suggestions-container.hidden { display: none; }
.suggestion-item { padding: 0.75rem 1rem; cursor: pointer; border-bottom: 1px solid var(--background-color); display: flex; flex-direction: column; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background-color: var(--background-color); }
.suggestion-match { font-weight: bold; color: var(--primary-color); }
.suggestion-sub { font-size: 0.8rem; color: var(--text-secondary); }

.language-info { font-size: 0.85rem; color: var(--text-secondary); text-align: center; }
.results-container { min-height: 200px; }

.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary); opacity: 0.6; padding: 3rem 0; }
.placeholder svg { margin-bottom: 1rem; opacity: 0.5; }

.result-card { background-color: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); animation: fadeIn 0.4s ease forwards; border-left: 5px solid var(--secondary-color); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.bribri-word { font-size: 1.8rem; font-weight: 700; color: var(--primary-color); margin-bottom: 0.25rem; }
.context { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 1.25rem; font-style: italic; }
.translations { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.lang-group { background-color: var(--background-color); padding: 1rem; border-radius: var(--radius-md); }
.lang-label { font-size: 0.8rem; text-transform: uppercase; font-weight: 700; color: var(--secondary-color); margin-bottom: 0.5rem; letter-spacing: 0.5px; }
.lang-words { font-size: 1.1rem; font-weight: 500; }
.hebrew-text { direction: rtl; font-family: Arial, Helvetica, sans-serif; }

.source-link {
    display: block;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--primary-light);
    text-decoration: none;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}
.source-link:hover { text-decoration: underline; }

.error-message { text-align: center; padding: 2rem; color: var(--error-color); background-color: rgba(178, 58, 72, 0.05); border-radius: var(--radius-md); border: 1px dashed var(--error-color); }

/* Categories */
.view-title { margin-bottom: 1.5rem; color: var(--primary-color); }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.category-btn { background-color: var(--background-color); color: var(--text-primary); border: 1px solid var(--border-color); padding: 1rem; text-align: center; border-radius: var(--radius-md); cursor: pointer; transition: var(--transition); }
.category-btn:hover, .category-btn.active { background-color: var(--primary-light); color: white; border-color: var(--primary-light); }
.mt-2 { margin-top: 2rem; }

/* Indexing */
.index-controls { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.index-controls select { padding: 0.5rem; font-size: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); color: var(--text-primary); background-color: var(--background-color); }
.alpha-group { margin-bottom: 1.5rem; }
.alpha-letter { font-size: 1.5rem; color: var(--secondary-color); border-bottom: 2px solid var(--border-color); margin-bottom: 0.5rem; padding-bottom: 0.25rem; text-transform: uppercase; }
.alpha-word { padding: 0.5rem 0; cursor: pointer; transition: color 0.2s; }
.alpha-word:hover { color: var(--primary-color); text-decoration: underline; }

/* Guide */
.guide-content h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--secondary-color); }
.guide-content ul { margin-left: 1.5rem; margin-bottom: 1.5rem; }
.guide-content li { margin-bottom: 0.5rem; }
.tip-box { background-color: rgba(45, 90, 39, 0.1); border-left: 4px solid var(--primary-color); padding: 1rem; border-radius: 0 var(--radius-md) var(--radius-md) 0; margin-top: 2rem; }

footer { text-align: center; padding: 1.5rem; background-color: var(--background-color); color: var(--text-secondary); font-size: 0.9rem; border-top: 1px solid var(--border-color); }

@media (max-width: 600px) {
    header { padding: 2rem 1rem; }
    header h1 { font-size: 2rem; }
    .input-group { flex-direction: column; }
    button { width: 100%; }
    .translations { grid-template-columns: 1fr; }
    .tabs { flex-wrap: wrap; }
    .tab-btn { flex: 1 0 50%; }
}
