/* ========== СБРОС И БАЗОВЫЕ НАСТРОЙКИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== CSS-ПЕРЕМЕННЫЕ (СВЕТЛАЯ ТЕМА ПО УМОЛЧАНИЮ) ========== */
:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --header-bg: #4a90e2;
    --header-text: #fff;
    --nav-bg: #fff;
    --nav-link-bg: #e9e9e9;
    --nav-link-text: #333;
    --nav-link-hover-bg: #4a90e2;
    --nav-link-hover-text: #fff;
    --main-bg: #fff;
    --footer-bg: #ddd;
    --footer-text: #333;
    --button-bg: #4a90e2;
    --button-text: #fff;
    --button-hover-bg: #357ab8;
    --input-bg: #fff;
    --input-border: #ccc;
    --result-bg: #f0f0f0;
}

/* ТЁМНАЯ ТЕМА */
body.dark-theme {
    --bg-color: #222;
    --text-color: #eee;
    --header-bg: #1a1a2e;
    --header-text: #eee;
    --nav-bg: #333;
    --nav-link-bg: #555;
    --nav-link-text: #eee;
    --nav-link-hover-bg: #0f4c75;
    --nav-link-hover-text: #fff;
    --main-bg: #2c2c2c;
    --footer-bg: #111;
    --footer-text: #aaa;
    --button-bg: #0f4c75;
    --button-text: #fff;
    --button-hover-bg: #0a3a5a;
    --input-bg: #444;
    --input-border: #666;
    --result-bg: #3a3a3a;
}

/* ========== ОСНОВНЫЕ СТИЛИ ========== */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* ШАПКА */
header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ЛОГОТИП (ССЫЛКА НА ГЛАВНУЮ) */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.logo-link:hover {
    text-decoration: none;
}

.logo-link:focus {
    outline: none;
}

.logo-img {
    height: 2.2rem;
    width: auto;
    max-width: 40px;
    margin-right: 8px;
}

/* ========== КНОПКИ ПЕРЕКЛЮЧЕНИЯ ТЕМЫ И ЯЗЫКА ========== */
.lang-switcher,
.theme-switcher {
    user-select: none;
}

.lang-switcher button,
.theme-switcher button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 70px;           /* минимальная ширина, чтобы кнопки не прыгали */
    background: #fff;
    color: #4a90e2;
    border: none;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.2s;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body.dark-theme .lang-switcher button,
body.dark-theme .theme-switcher button {
    background: #333;
    color: #eee;
}

.lang-switcher button:hover,
.theme-switcher button:hover {
    background: #e0e0e0;
}

body.dark-theme .lang-switcher button:hover,
body.dark-theme .theme-switcher button:hover {
    background: #555;
}

/* Флаги внутри кнопок языка */
.lang-switcher button img,
.lang-switcher button svg {
    width: 20px;
    height: 14px;
    flex-shrink: 0;
    display: block;
    pointer-events: none;       /* клик проходит на кнопку */
    user-select: none;
    -webkit-user-drag: none;
    object-fit: cover;
}

/* ========== НАВИГАЦИЯ (МЕНЮ ГЕНЕРАТОРОВ) ========== */
nav {
    background: var(--nav-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#generators-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0.5rem;
}

#generators-menu li {
    margin: 0.3rem;
}

#generators-menu a {
    display: block;
    padding: 0.5rem 1rem;
    background: var(--nav-link-bg);
    text-decoration: none;
    color: var(--nav-link-text);
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#generators-menu a:hover,
#generators-menu a.active {
    background: var(--nav-link-hover-bg);
    color: var(--nav-link-hover-text);
}

/* ========== ОСНОВНОЙ КОНТЕЙНЕР ========== */
main {
    flex: 1;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

#generator-container {
    background: var(--main-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background-color 0.3s;
}

/* ========== ФОРМЫ ГЕНЕРАТОРОВ ========== */
.generator-form {
    margin: 1rem 0;
}

.generator-form label {
    display: inline-block;
    margin: 0.5rem 0;
}

input, select, button {
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-color);
}

button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

button:hover {
    background-color: var(--button-hover-bg);
}

/* ========== РЕЗУЛЬТАТ ГЕНЕРАЦИИ ========== */
.result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--result-bg);
    border-radius: 4px;
    border-left: 4px solid var(--button-bg);
    word-break: break-all;
}

/* ========== ПОДВАЛ И СОЦИАЛЬНЫЕ СЕТИ ========== */
footer {
    text-align: center;
    padding: 1rem;
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-top: auto;
    transition: background-color 0.3s, color 0.3s;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 0 10px;
}

.social-links a {
    display: inline-block;
    line-height: 0;          /* убирает лишние отступы */
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s;
}

.social-links a:hover {
    opacity: 0.8;
}

.social-links img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    pointer-events: none;     /* клик идёт на ссылку */
    user-select: none;
}

/* ========== АДАПТИВНОСТЬ ========== */
/* Узкие экраны (до 600px) */
@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    .lang-switcher button,
    .theme-switcher button {
        padding: 0.2rem 0.5rem;
        font-size: 0.9rem;
        min-width: 60px;
    }
    .lang-switcher button img,
    .lang-switcher button svg {
        width: 16px;
        height: 12px;
    }
    .logo-img {
        height: 1.8rem;
    }
    .social-links {
        gap: 8px;
    }
    .social-links img {
        width: 24px;
        height: 24px;
    }
    #generators-menu {
        justify-content: center;
    }
}

/* Очень маленькие экраны (до 400px) */
@media (max-width: 400px) {
    .lang-switcher button {
        font-size: 0.8rem;
        min-width: 50px;
    }
    .social-links {
        gap: 5px;
    }
    .social-links img {
        width: 20px;
        height: 20px;
    }
}

/* Планшеты (601px - 900px) */
@media (min-width: 601px) and (max-width: 900px) {
    .social-links img {
        width: 26px;
        height: 26px;
    }
}

/* ========== УЛУЧШЕНИЕ ДОСТУПНОСТИ (ФОКУС С КЛАВИАТУРЫ) ========== */
:focus-visible {
    outline: 2px solid var(--button-bg);
    outline-offset: 2px;
}

/* Для браузеров без поддержки :focus-visible */
:focus {
    outline: none;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Ссылки в футере на юридические страницы */
.footer-links {
    margin-bottom: 15px;
}
.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    margin: 0 5px;
}
.footer-links a:hover {
    text-decoration: underline;
}

/* Стили для страниц с юридическим текстом */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--main-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.legal-content h1 {
    margin-bottom: 1.5rem;
}
.legal-content h2 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.3rem;
}
.legal-content p {
    margin-bottom: 1rem;
}
.legal-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}