/* Словари — базовые стили */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
}

/* Header */
header {
    background: #2c3e50;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

header nav {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.search-form {
    display: flex;
    flex: 1;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
}

.search-form button,
.search-hero button {
    padding: 0.4rem 1rem;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.search-form button:hover,
.search-hero button:hover {
    background: #2980b9;
}

/* Main */
main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.hero p {
    color: #666;
    margin-bottom: 1.5rem;
}

.search-hero {
    display: block;
    max-width: 560px;
    margin: 0 auto;
}

.search-input-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.search-input-row input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1.1rem;
}

.search-input-row input:focus {
    outline: none;
    border-color: #3498db;
}

/* Dictionary checkboxes */
.dict-checkboxes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem 1rem;
    margin-top: 0.6rem;
}

.dict-check {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}

.dict-check input {
    cursor: pointer;
}

/* Alphabet */
.alphabet {
    margin-top: 2rem;
}

.alphabet h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #555;
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
}

.letter-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
}

.letter-link:hover {
    background: #ebf5fb;
    border-color: #3498db;
}

.letter-char {
    font-size: 1.3rem;
    font-weight: 700;
}

.letter-count {
    font-size: 0.75rem;
    color: #999;
}

/* Entries */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.entry-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
}

.entry-card h3 {
    margin-bottom: 0.3rem;
}

.entry-card h3 a {
    text-decoration: none;
    color: #2c3e50;
}

.entry-card h3 a:hover {
    color: #3498db;
}

.entry-preview {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.entry-meta,
.entry-meta-detail {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 1rem;
}

/* Entry detail */
.entry-detail {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1.5rem;
}

.entry-detail h1 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.entry-body {
    white-space: pre-wrap;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.entry-meta-detail {
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.pdf-link {
    color: #3498db;
    text-decoration: none;
}

.pdf-link:hover {
    text-decoration: underline;
}

/* Dictionary filter on results page */
.dict-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.3rem 0.75rem;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.filter-btn:hover {
    background: #2980b9;
}

/* Results */
.results-count {
    color: #666;
    margin-bottom: 0.5rem;
}

.no-results {
    color: #666;
    margin-bottom: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination a {
    color: #3498db;
    text-decoration: none;
}

.pagination a:hover {
    text-decoration: underline;
}

.page-info {
    color: #888;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: #3498db;
    text-decoration: none;
}

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

/* Footer */
footer {
    max-width: 800px;
    margin: 3rem auto 1rem;
    padding: 1rem;
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
    border-top: 1px solid #e0e0e0;
}

/* Responsive */
@media (max-width: 600px) {
    header nav {
        flex-wrap: wrap;
    }

    .search-form {
        width: 100%;
    }

    .alphabet-grid {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .search-hero {
        flex-direction: column;
    }
}
