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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
    line-height: 1.5;
    --button-selected-bg: #3b82f6;
    --button-selected-border: #3b82f6;
    --button-selected-color: white;
}


.container {
    display: flex;
    min-height: 100dvh;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    width: 350px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.sidebar::-webkit-scrollbar {
    display: none; /* WebKit */
}

.content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
}

.header {
    padding: 18px 18px 0 18px;
}
 

.sticky-preview {
    padding: 0 20px 3px 20px;
    background: white;
}

.scrollable-content {
    padding: 9px 20px 20px 20px;
    background: white;
    border-radius: 12px;
    margin: 6px 10px 0 10px;
}

.navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.category-link {
    border: none;
    appearance: none;
    -webkit-appearance: none;
}

.category-link.home-btn {
    color: #64748b;
    font-size: 0.75em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-link.home-btn:hover {
    color: #374151;
    background: rgba(255, 255, 255, 0.8);
}

.category-link.home-btn.selected {
    color: #1e40af;
    background: #dbeafe;
    text-decoration: none;
    font-weight: 600;
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-link {
    color: #64748b;
    font-size: 0.75em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.category-link:hover {
    color: #374151;
    background: rgba(255, 255, 255, 0.8);
}

.category-link.selected {
    color: #1e40af;
    background: #dbeafe;
    text-decoration: none;
    font-weight: 600;
}

.landing-copy {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    margin: 0 0 24px 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    line-height: 1.65;
}

.landing-copy h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #0f172a;
}

.landing-copy p {
    margin-bottom: 12px;
    color: #1f2937;
}

.landing-copy__list {
    margin: 8px 0 0 18px;
    padding: 0;
    color: #1f2937;
}

.landing-copy__list li {
    margin-bottom: 6px;
}

.filter-section {
    margin-bottom: 12px;
}

.filter-title {
    font-size: 0.8125em;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.collapse-toggle {
    width: 16px;
    height: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    user-select: none;
    border-radius: 3px;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
}

/* Визуальный эффект при автоколлапсе (без прямых стилей из JS) */
.collapse-toggle.collapsing {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    transform: scale(1.04);
}

.collapse-toggle::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #6b7280;
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.collapse-toggle.collapsed::after {
    transform: rotate(-90deg);
}
 
/* Более плавная анимация для содержимого секций */
.filter-section {
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
 
.filter-options, .filter-grid, .age-input {
    transition: opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), 
               max-height 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
               transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}
 
/* Плавная анимация для кнопок */
.filter-option, .filter-btn {
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.section-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.section-content.collapsed {
    display: none;
}

.selected-value {
    font-size: 0.75em;
    color: #6b7280;
    font-weight: 400;
    margin-left: 8px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.filter-option, .filter-btn {
    padding: 3px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.filter-option:hover, .filter-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1e40af;
}

.filter-option.selected, .filter-btn.selected {
    background: var(--button-selected-bg);
    border-color: var(--button-selected-border);
    color: var(--button-selected-color);
}

.filter-option.multiple-selected,
.filter-btn.multiple-selected {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.age-input {
    margin-top: 8px;
}

.age-input input, .age-input select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85em;
}

/* Автодополнение имён */
.autocomplete-list {
    position: relative;
    margin-top: 6px;
}
.autocomplete-list .name-suggestion {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 0.85em;
    cursor: pointer;
    margin-bottom: 6px;
}
.autocomplete-list .name-suggestion:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}
.name-hint {
    font-size: 0.75em;
    color: #94a3b8;
    margin-top: 6px;
}


.selections-preview {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    margin-bottom: 20px;
    font-size: 0.8em;
    color: #475569;
}

.selections-preview h4 {
    font-size: 0.85em;
    color: #334155;
    margin-bottom: 5px;
}

.content-header {
    margin-bottom: 20px;
}

.content-header h2, #preview-text-header {
    font-size: 1.5em;
    color: #1a202c;
    margin-bottom: 5px;
}

.content-placeholder {
    background: white;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #64748b;
    border: 2px dashed #e2e8f0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.content-placeholder .icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.results-area {
    display: none;
}

.results-area.show {
    display: block;
}

.greeting-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 18px 0 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.greeting-text {
    font-size: 1.1em;
    line-height: 1.6;
    color: #1a202c;
}

.group-grid {
    display: grid;
    gap: 12px 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.group-entry {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    background: #f8fafc;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.group-entry a {
    font-weight: 600;
    color: #1a202c;
    text-decoration: none;
}

.group-entry a:hover,
.group-entry a:focus {
    color: #2563eb;
    text-decoration: underline;
}

.group-entry__meta {
    margin-top: 6px;
    font-size: 0.85em;
    color: #64748b;
}

.group-entry:hover {
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
}

.group-section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #1f2937;
    background: linear-gradient(90deg, #eef2ff, #ffffff);
    border: 1px solid #c7d2fe;
    padding: 10px 14px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
}

.group-section-title::before {
    content: '\1F4C2';
    margin-right: 8px;
    font-size: 1.1em;
}

.group-empty {
    padding: 18px;
    text-align: center;
    color: #64748b;
}

/* Поэтическое оформление: отступы между строфами (четверостишьями) */
.greeting-text.poem .stanza {
    margin: 0 0 14px 0;
}
.greeting-text.poem .stanza br {
    line-height: 1.8;
}

/* Проза: по одному предложению на строку с мягким отступом */
.greeting-text.prose .sentence {
    margin: 6px 0;
    text-indent: 1.25em;
}

/* Тост: построчное отображение как маркированный список */
.toast-list {
    margin: 0 0 8px 18px;
    padding: 0;
}
.toast-list li {
    margin: 6px 0;
}

.greeting-meta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.8em;
    color: #64748b;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        min-height: auto;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .content {
        padding: 15px;
    }
}

/* Уважать настройки пользователя на снижение анимаций */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.7em;
    border-radius: 4px;
    margin-left: 5px;
}

.required {
    color: #ef4444;
}

/* Utility visibility class */
.is-hidden { display: none !important; }

/* Focus-visible outlines for accessibility */
.category-link:focus-visible,
.filter-option:focus-visible,
.filter-btn:focus-visible,
.collapse-toggle:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 6px;
}

/* Info box used on home/empty categories */
.info-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-top: 20px;
}
.info-box .icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.6;
}
.info-box h3 {
    color: #64748b;
    margin-bottom: 10px;
    font-size: 1.1em;
}
.info-box p {
    color: #94a3b8;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Small spacing utilities for inline removal of styles */
.mb-8 { margin-bottom: 8px; }
.mt-10 { margin-top: 10px; }
.inline-options { display: flex; gap: 8px; flex-wrap: wrap; }
.section-subtitle { font-size: 0.8125em; font-weight: 600; color: #374151; margin-bottom: 6px; }

/* Компактный вид для возраста при сворачивании: Юбилей + выбранный возраст в одну строку */
.filter-section[data-section="age"].compact .filter-options,
.filter-section[data-section="age"].compact .age-input {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}
.filter-section[data-section="age"].compact #jubilee-buttons {
    display: inline-flex !important;
}

/* Метка + опции в одну строку (для блока Пол) */
.inline-label-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.inline-label-row .section-subtitle { margin: 0; }

.seo-footer {
    margin-top: 24px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #475569;
    font-size: 0.9em;
    line-height: 1.6;
}

.seo-footer p {
    margin: 0;
}

.seo-intro {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 0 0 20px 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.seo-intro h2 {
    font-size: 1.15em;
    margin-bottom: 12px;
    color: #0f172a;
}

.seo-intro p {
    margin-bottom: 10px;
    color: #1f2937;
    line-height: 1.6;
}

.seo-intro p:last-child {
    margin-bottom: 0;
}

.share-block {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
}
