:root {
    /* Основные цвета */
    --color-white: #ffffff;
    --color-blue: #0039A6;
    --color-red: #D52B1E;
    --color-gold: #bfa060;
    --color-dark-text: #212529;
    --color-light-bg: #f8f9fa;
    --color-empire-yellow: #FFD700;
    --color-empire-black: #000000;
    --color-ussr-red: #CC0000;
    --color-military-red: #8B0000;
    --color-military-dark: #4A0404;
    --color-writers-green: #2E8B57;
    --color-writers-dark: #1D5B3E;
    
    /* Дополнительные цвета */
    --color-blue-light: #e6f0ff;
    --color-red-light: #ffe6e6;
    --color-green-light: #e8f5e9;
    
    /* Размеры */
    --header-height: 60px;
    --header-height-mobile: 55px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    
    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    
    /* Анимации */
    --transition: all 0.3s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--color-dark-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--color-light-bg);
}

/* ===== ФОНОВЫЕ ФЛАГИ ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 1;
    transition: background 0.5s ease;
    pointer-events: none;
}

body.bg-rf::before {
    background: linear-gradient(to bottom, var(--color-white) 33.3%, var(--color-blue) 33.3%, var(--color-blue) 66.6%, var(--color-red) 66.6%);
}

body.bg-empire::before {
    background: linear-gradient(to bottom, var(--color-white) 33.3%, var(--color-empire-yellow) 33.3%, var(--color-empire-yellow) 66.6%, var(--color-empire-black) 66.6%);
}

body.bg-ussr::before {
    background-color: var(--color-ussr-red);
}

/* ===== ШАПКА САЙТА ===== */
header {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--color-white) 33.3%, var(--color-blue) 33.3%, var(--color-blue) 66.6%, var(--color-red) 66.6%);
    z-index: 1001;
}

.header-content {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    height: 60px;
}

.logo {
    height: 40px;
    transition: var(--transition);
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.05);
}

.header-title {
    display: none;
}

/* ===== ЖИРНОЕ МЕНЮ С УЛУЧШЕННЫМ ДИЗАЙНОМ ===== */
nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 20px;
    flex: 1;
    justify-content: center;
}

nav a {
    color: var(--color-dark-text);
    text-decoration: none;
    font-weight: 700; /* Жирный шрифт */
    font-size: 1.05rem; /* Немного увеличенный размер */
    padding: 8px 18px;
    border-radius: 30px; /* Более округлые края */
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    letter-spacing: 0.3px; /* Небольшой интервал между буквами */
    text-transform: uppercase; /* Заглавные буквы для большей выразительности */
    border: 1px solid transparent; /* Подготовка для эффекта при наведении */
}

/* Эффект при наведении */
nav a:hover {
    transform: translateY(-2px);
    background-color: rgba(0, 57, 166, 0.08);
    border-color: rgba(0, 57, 166, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Цвета при наведении для разных страниц */
body:not(.page-military):not(.page-writers) nav a:hover {
    color: var(--color-blue);
    background-color: rgba(0, 57, 166, 0.08);
    border-color: rgba(0, 57, 166, 0.2);
}

body.page-military nav a:hover {
    color: var(--color-military-red);
    background-color: rgba(139, 0, 0, 0.08);
    border-color: rgba(139, 0, 0, 0.2);
}

body.page-writers nav a:hover {
    color: var(--color-writers-green);
    background-color: rgba(46, 139, 86, 0.08);
    border-color: rgba(46, 139, 86, 0.2);
}

/* Активная ссылка */
nav a.active {
    color: var(--color-white) !important;
    pointer-events: none;
    font-weight: 800; /* Еще жирнее для активной */
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body:not(.page-military):not(.page-writers) nav a.active {
    background-color: var(--color-blue);
    box-shadow: 0 4px 12px rgba(0, 57, 166, 0.4);
}

body.page-military nav a.active {
    background-color: var(--color-military-red);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
}

body.page-writers nav a.active {
    background-color: var(--color-writers-green);
    box-shadow: 0 4px 12px rgba(46, 139, 86, 0.4);
}

/* Подчеркивание при наведении (дополнительный эффект) */
nav a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    transition: width 0.3s ease;
    opacity: 0.7;
}

nav a:hover::after {
    width: 40%;
}

body:not(.page-military):not(.page-writers) nav a::after { background-color: var(--color-blue); }
body.page-military nav a::after { background-color: var(--color-military-red); }
body.page-writers nav a::after { background-color: var(--color-writers-green); }

nav a.active::after { display: none; }

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ФЛАГОВ ===== */
.bg-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.bg-switcher-btn {
    width: 28px;
    height: 20px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border-radius: 4px;
}

.bg-switcher-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    border-color: var(--color-gold);
}

.bg-switcher-btn.active {
    border: 2px solid var(--color-gold);
    box-shadow: 0 0 12px rgba(191, 160, 96, 0.6);
    transform: scale(1.05);
}

#btn-rf, #mobile-btn-rf {
    background: linear-gradient(to bottom, var(--color-white) 33.3%, var(--color-blue) 33.3%, var(--color-blue) 66.6%, var(--color-red) 66.6%);
}

#btn-empire, #mobile-btn-empire {
    background: linear-gradient(to bottom, var(--color-white) 33.3%, var(--color-empire-yellow) 33.3%, var(--color-empire-yellow) 66.6%, var(--color-empire-black) 66.6%);
}

#btn-ussr, #mobile-btn-ussr {
    background-color: var(--color-ussr-red);
}

/* ===== АНИМИРОВАННЫЙ ГАМБУРГЕР ===== */
.mobile-menu-toggle {
    width: 40px;
    height: 40px;
    position: relative;
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
}

.mobile-menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 5px auto;
    transition: var(--transition);
    border-radius: 3px;
}

body:not(.page-military):not(.page-writers) .mobile-menu-toggle span { background-color: var(--color-blue); }
body.page-military .mobile-menu-toggle span { background-color: var(--color-military-red); }
body.page-writers .mobile-menu-toggle span { background-color: var(--color-writers-green); }

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}
.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== МОБИЛЬНОЕ МЕНЮ ===== */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--color-white);
    padding: 70px 20px 30px;
    transition: right 0.3s ease;
    z-index: 1001;
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    flex-direction: column;
    border-left: 3px solid var(--color-gold);
}

.mobile-menu.active {
    display: flex !important;
    right: 0;
}

.mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
    border-radius: 50%;
    transition: var(--transition);
    z-index: 1002;
}

.mobile-menu-close:hover { transform: rotate(90deg); }

body:not(.page-military):not(.page-writers) .mobile-menu-close { color: var(--color-blue); }
body.page-military .mobile-menu-close { color: var(--color-military-red); }
body.page-writers .mobile-menu-close { color: var(--color-writers-green); }

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
    width: 100%;
}

.mobile-nav a {
    color: var(--color-dark-text);
    text-decoration: none;
    font-weight: 600;
    padding: 15px 20px;
    border-radius: 12px;
    transition: var(--transition);
    font-size: 1.1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: block;
    text-align: left;
    background-color: rgba(255, 255, 255, 0.5);
}

.mobile-nav a:last-child { border-bottom: none; }

.mobile-nav a:hover {
    padding-left: 25px;
    transform: translateX(5px);
}

body:not(.page-military):not(.page-writers) .mobile-nav a:hover {
    background-color: rgba(0, 57, 166, 0.1);
    color: var(--color-blue);
    border-color: rgba(0, 57, 166, 0.2);
}

body.page-military .mobile-nav a:hover {
    background-color: rgba(139, 0, 0, 0.1);
    color: var(--color-military-red);
    border-color: rgba(139, 0, 0, 0.2);
}

body.page-writers .mobile-nav a:hover {
    background-color: rgba(46, 139, 86, 0.1);
    color: var(--color-writers-green);
    border-color: rgba(46, 139, 86, 0.2);
}

.mobile-nav a.active {
    font-weight: 700;
    border-left: 4px solid var(--color-gold);
}

body:not(.page-military):not(.page-writers) .mobile-nav a.active {
    background-color: var(--color-blue);
    color: var(--color-white) !important;
}

body.page-military .mobile-nav a.active {
    background-color: var(--color-military-red);
    color: var(--color-white) !important;
}

body.page-writers .mobile-nav a.active {
    background-color: var(--color-writers-green);
    color: var(--color-white) !important;
}

.mobile-bg-switcher {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
}

.mobile-bg-switcher-title {
    font-weight: 600;
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

body:not(.page-military):not(.page-writers) .mobile-bg-switcher-title { color: var(--color-blue); }
body.page-military .mobile-bg-switcher-title { color: var(--color-military-red); }
body.page-writers .mobile-bg-switcher-title { color: var(--color-writers-green); }

.mobile-bg-switcher-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-bg-switcher-btn {
    width: 100%;
    height: 40px;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.mobile-bg-switcher-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.mobile-bg-switcher-btn.active {
    border: 3px solid var(--color-gold);
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(191, 160, 96, 0.4);
}

.mobile-menu-footer {
    margin-top: auto;
    padding-top: 30px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Оверлей */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: block !important;
    opacity: 1;
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1500px;
    margin: 20px auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.content-wrapper {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 8px;
    padding: 25px 20px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: fadeIn 0.6s ease-out;
}

body:not(.page-military):not(.page-writers) .content-wrapper { border-top: 4px solid var(--color-gold); }
body.page-military .content-wrapper { border-top: 4px solid var(--color-military-red); }
body.page-writers .content-wrapper { border-top: 4px solid var(--color-writers-green); }

/* Секции */
.section-style,
.military-section,
.writers-section {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: var(--color-white);
    transition: var(--transition);
}

.section-style:hover,
.military-section:hover,
.writers-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.military-section { border-left: 4px solid var(--color-military-red); }
.writers-section { border-left: 4px solid var(--color-writers-green); }

/* Заголовки */
h1 {
    font-size: 2.5rem;
    text-align: center;
    margin: 15px 0 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    font-family: 'Merriweather', serif;
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #bfa060 0%, #d4b87a 100%);
    border-radius: 3px;
}

body:not(.page-military):not(.page-writers) h1 { color: var(--color-blue); }
body.page-military h1 { color: var(--color-military-red); }
body.page-writers h1 { color: var(--color-writers-green); }

h2 {
    font-size: 2rem;
    margin: 20px 0;
    color: var(--color-dark-text);
}
h3 {
    font-size: 1.5rem;
    margin: 15px 0;
    color: var(--color-dark-text);
}

/* ===== ФОРМЫ ===== */
.input-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px 15px;
    align-items: center;
    margin-bottom: 20px;
}

.input-container label {
    font-weight: 500;
    color: var(--color-dark-text);
    white-space: nowrap;
    font-size: 1.1rem;
}

.input-with-button {
    display: flex;
    gap: 10px;
    width: 100%;
}

.input-with-button input,
select {
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--color-white);
}

.input-with-button input { flex: 1; }
select { width: 100%; }

.input-with-button input:hover,
select:hover {
    border-color: #b0b0b0;
}

.input-with-button input:focus,
select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(0, 57, 166, 0.1);
}

body.page-military .input-with-button input:focus,
body.page-military select:focus {
    border-color: var(--color-military-red);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

body.page-writers .input-with-button input:focus,
body.page-writers select:focus {
    border-color: var(--color-writers-green);
    box-shadow: 0 0 0 3px rgba(46, 139, 86, 0.1);
}

.input-with-button button {
    padding: 10px 20px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    transition: var(--transition);
    white-space: nowrap;
    min-width: 90px;
    font-size: 0.9rem;
}

.input-with-button button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.input-with-button button:active { transform: translateY(0); }

body:not(.page-military):not(.page-writers) .input-with-button button:not(#reset-button) {
    background-color: var(--color-blue);
}
body:not(.page-military):not(.page-writers) .input-with-button button:not(#reset-button):hover {
    background-color: #002d7a;
}

body.page-military .input-with-button button:not(#reset-button) {
    background-color: var(--color-military-red);
}
body.page-military .input-with-button button:not(#reset-button):hover {
    background-color: var(--color-military-dark);
}

body.page-writers .input-with-button button:not(#reset-button) {
    background-color: var(--color-writers-green);
}
body.page-writers .input-with-button button:not(#reset-button):hover {
    background-color: var(--color-writers-dark);
}

#reset-button {
    background-color: #6c757d;
}
#reset-button:hover {
    background-color: #5a6268;
}

/* ===== РЕЗУЛЬТАТЫ ПОИСКА ===== */
.result-container {
    background: linear-gradient(135deg, var(--color-light-bg) 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    transition: var(--transition);
}

.result-container:hover { box-shadow: var(--shadow-md); }

body:not(.page-military):not(.page-writers) .result-container { border-left: 5px solid var(--color-gold); }
body.page-military .result-container { border-left: 5px solid var(--color-military-red); }
body.page-writers .result-container { border-left: 5px solid var(--color-writers-green); }

.result-container.error {
    border-left-color: var(--color-red);
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 4px;
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
    min-height: 100px;
}

.search-result-item:nth-child(1) { animation-delay: 0.1s; }
.search-result-item:nth-child(2) { animation-delay: 0.15s; }
.search-result-item:nth-child(3) { animation-delay: 0.2s; }
.search-result-item:nth-child(4) { animation-delay: 0.25s; }
.search-result-item:nth-child(5) { animation-delay: 0.3s; }

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.result-field {
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    min-height: 50px;
}

.result-field:last-child { border-bottom: none; }

.result-label {
    font-weight: 600;
    color: #6c757d;
    min-width: 120px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.result-value {
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--color-dark-text);
}

.result-value a {
    color: var(--color-blue);
    text-decoration: underline;
    word-break: break-all;
    transition: var(--transition);
    cursor: pointer;
}

.result-value a:hover {
    color: var(--color-red);
    text-decoration: none;
}

.result-value a.file-link {
    color: #28a745;
    border-left: 3px solid #28a745;
    padding-left: 8px;
    background-color: rgba(40, 167, 69, 0.05);
    display: inline-block;
    text-decoration: underline;
}

.result-value a.file-link:hover {
    color: #1e7e34;
    border-left-color: #1e7e34;
    background-color: rgba(40, 167, 69, 0.1);
}

/* ===== ПАГИНАЦИЯ ===== */
.pagination-container {
    margin-top: 20px;
    padding: 20px 0;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.95rem;
    background-color: var(--color-light-bg);
    padding: 5px 15px;
    border-radius: 20px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #dee2e6;
    background-color: var(--color-white);
    color: var(--color-dark-text);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

body:not(.page-military):not(.page-writers) .pagination-btn:hover:not(:disabled) {
    border-color: var(--color-blue);
    color: var(--color-blue);
}
body:not(.page-military):not(.page-writers) .pagination-btn.active {
    background-color: var(--color-blue);
    color: var(--color-white);
    border-color: var(--color-blue);
}

body.page-military .pagination-btn:hover:not(:disabled) {
    border-color: var(--color-military-red);
    color: var(--color-military-red);
}
body.page-military .pagination-btn.active {
    background-color: var(--color-military-red);
    color: var(--color-white);
    border-color: var(--color-military-red);
}

body.page-writers .pagination-btn:hover:not(:disabled) {
    border-color: var(--color-writers-green);
    color: var(--color-writers-green);
}
body.page-writers .pagination-btn.active {
    background-color: var(--color-writers-green);
    color: var(--color-white);
    border-color: var(--color-writers-green);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #e9ecef;
}

.pagination-btn i { font-size: 0.8rem; }

/* Селектор количества записей */
.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background-color: var(--color-light-bg);
    border-radius: var(--border-radius);
    justify-content: center;
}

.page-size-selector label {
    font-weight: 500;
    color: var(--color-dark-text);
    font-size: 0.95rem;
}

.page-size-selector select {
    width: auto;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius-sm);
    background-color: var(--color-white);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.page-size-selector select:hover { border-color: var(--color-blue); }

.page-size-selector select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(0, 57, 166, 0.1);
}

body.page-military .page-size-selector select:focus {
    border-color: var(--color-military-red);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

body.page-writers .page-size-selector select:focus {
    border-color: var(--color-writers-green);
    box-shadow: 0 0 0 3px rgba(46, 139, 86, 0.1);
}

/* ===== ЗАГРУЗКА ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

body:not(.page-military):not(.page-writers) .loading-spinner { border-top-color: var(--color-blue); }
body.page-military .loading-spinner { border-top-color: var(--color-military-red); }
body.page-writers .loading-spinner { border-top-color: var(--color-writers-green); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6c757d;
    font-size: 1rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background-color: var(--color-light-bg);
    border-radius: 8px;
}

.results-count {
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ===== ПОДВАЛ ===== */
footer {
    background: linear-gradient(135deg, var(--color-dark-text) 0%, #2c3e50 100%);
    color: var(--color-white);
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    flex-shrink: 0;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

body:not(.page-military):not(.page-writers) footer::before {
    background: linear-gradient(135deg, #bfa060 0%, #d4b87a 100%);
}
body.page-military footer::before {
    background: linear-gradient(135deg, #8B0000 0%, #a52a2a 100%);
}
body.page-writers footer::before {
    background: linear-gradient(135deg, #2E8B57 0%, #3cb371 100%);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    text-align: left;
}

.footer-section {
    padding: 0 15px;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid;
    padding-bottom: 8px;
    display: inline-block;
    font-family: 'Merriweather', serif;
}

body:not(.page-military):not(.page-writers) .footer-section h3 {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
}
body.page-military .footer-section h3 {
    color: var(--color-military-red);
    border-bottom-color: var(--color-military-red);
}
body.page-writers .footer-section h3 {
    color: var(--color-writers-green);
    border-bottom-color: var(--color-writers-green);
}

.footer-section p {
    margin: 8px 0;
    line-height: 1.6;
    color: #e0e0e0;
}

.footer-section a {
    color: #e0e0e0;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--color-gold);
    padding-left: 5px;
}

.footer-social {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.social-link {
    color: var(--color-white);
    text-decoration: none;
    padding: 10px 15px;
    border: 1px solid;
    border-radius: 5px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(255, 255, 255, 0.05);
}

body:not(.page-military):not(.page-writers) .social-link {
    border-color: var(--color-gold);
}
body:not(.page-military):not(.page-writers) .social-link:hover {
    background-color: var(--color-gold);
    color: var(--color-dark-text);
    transform: translateY(-3px);
}

body.page-military .social-link {
    border-color: var(--color-military-red);
}
body.page-military .social-link:hover {
    background-color: var(--color-military-red);
    color: var(--color-white);
    transform: translateY(-3px);
}

body.page-writers .social-link {
    border-color: var(--color-writers-green);
}
body.page-writers .social-link:hover {
    background-color: var(--color-writers-green);
    color: var(--color-white);
    transform: translateY(-3px);
}

.footer-bottom {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #a0a0a0;
    font-size: 0.9rem;
    text-align: center;
}

/* ===== АНИМАЦИИ ===== */
nav a.active, .mobile-nav a.active {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 12px rgba(0, 57, 166, 0.3); }
    50% { box-shadow: 0 4px 18px rgba(0, 57, 166, 0.6); }
    100% { box-shadow: 0 4px 12px rgba(0, 57, 166, 0.3); }
}

body.page-military nav a.active, 
body.page-military .mobile-nav a.active {
    animation: pulseMilitary 2s infinite;
}

@keyframes pulseMilitary {
    0% { box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3); }
    50% { box-shadow: 0 4px 18px rgba(139, 0, 0, 0.6); }
    100% { box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3); }
}

body.page-writers nav a.active, 
body.page-writers .mobile-nav a.active {
    animation: pulseWriters 2s infinite;
}

@keyframes pulseWriters {
    0% { box-shadow: 0 4px 12px rgba(46, 139, 86, 0.3); }
    50% { box-shadow: 0 4px 18px rgba(46, 139, 86, 0.6); }
    100% { box-shadow: 0 4px 12px rgba(46, 139, 86, 0.3); }
}

/* ===== МОБИЛЬНЫЙ ЗАГОЛОВОК ===== */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
}

/* ===== МЕДИА-ЗАПРОСЫ ===== */
@media (max-width: 992px) {
    .content-wrapper { padding: 20px 15px; }
    h1 { font-size: 2.2rem; }
    
    nav a { 
        padding: 6px 14px; 
        font-size: 0.95rem;
    }
    .bg-switcher { padding: 3px 6px; }
    .bg-switcher-btn { width: 26px; height: 18px; }
}

@media (max-width: 768px) {
    .header-top { 
        height: 55px; 
        padding: 5px 0;
    }
    .logo { height: 35px; }
    
    nav, .bg-switcher { display: none !important; }
    
    .mobile-menu-toggle { 
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    main {
        margin: 15px auto;
        padding: 0 15px;
    }
    .content-wrapper { padding: 20px 15px; }
    
    .input-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .input-with-button { flex-direction: column; }
    .input-with-button button { width: 100%; }
    
    .result-field {
        flex-direction: column;
        gap: 5px;
    }
    .result-label { min-width: auto; }
    
    h1 {
        font-size: 2rem;
        margin: 10px 0 15px;
    }
    h1::after { width: 60px; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 25px;
    }
    .footer-section { text-align: center; }
    .footer-section h3 { width: 100%; text-align: center; }
    .footer-social { justify-content: center; }
    .social-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .pagination-controls { gap: 5px; }
    .pagination-btn {
        min-width: 35px;
        height: 35px;
        padding: 0 8px;
        font-size: 0.85rem;
    }
    
    .page-size-selector {
        margin-left: 0;
        margin-top: 10px;
        justify-content: center;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .page-size-selector select {
        width: 100%;
        max-width: 200px;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .header-top { height: 50px; }
    .logo { height: 30px; }
    
    .mobile-menu-toggle {
        width: 35px;
        height: 35px;
    }
    .mobile-menu-toggle span { 
        width: 20px; 
        height: 2px;
        margin: 4px auto;
    }
    
    .mobile-menu {
        width: 90%;
        padding: 60px 15px 20px;
    }
    .mobile-nav a {
        padding: 12px 15px;
        font-size: 1rem;
    }
    .mobile-menu-close {
        top: 10px;
        right: 10px;
        font-size: 1.8rem;
    }
    
    h1 {
        font-size: 1.8rem;
        margin: 10px 0 15px;
    }
    .content-wrapper { padding: 15px 10px; }
    
    .section-style,
    .military-section,
    .writers-section {
        padding: 15px;
    }
    
    .input-with-button input,
    .input-with-button button,
    select {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .result-container { padding: 15px; }
    footer { padding: 20px 15px; }
}

@media (max-width: 360px) {
    .logo { height: 25px; }
    .mobile-menu-toggle span {
        width: 18px;
        height: 2px;
        margin: 3px auto;
    }
    h1 { font-size: 1.5rem; }
    .pagination-btn {
        min-width: 30px;
        height: 30px;
        padding: 0 5px;
        font-size: 0.75rem;
    }
}

/* ===== ПЕЧАТЬ ===== */
@media print {
    header, footer, .bg-switcher, .mobile-menu-toggle, .pagination-container {
        display: none !important;
    }
    body { background: white; }
    .content-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== УТИЛИТЫ ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ===== ПРОДВИНУТЫЙ ПОИСК ===== */
.info-message {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-size: 1.1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.global-search-results {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #fff;
}

.global-search-results::-webkit-scrollbar {
    width: 8px;
}

.global-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.global-search-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.global-search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.category-section {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid;
}

body:not(.page-military):not(.page-writers) .category-section {
    border-left-color: var(--color-gold);
}
body.page-military .category-section {
    border-left-color: var(--color-military-red);
}
body.page-writers .category-section {
    border-left-color: var(--color-writers-green);
}

.category-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
}

body:not(.page-military):not(.page-writers) .category-title {
    color: var(--color-blue);
    border-bottom-color: var(--color-gold);
}
body.page-military .category-title {
    color: var(--color-military-red);
    border-bottom-color: var(--color-military-red);
}
body.page-writers .category-title {
    color: var(--color-writers-green);
    border-bottom-color: var(--color-writers-green);
}

.global-search-result-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.global-search-result-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-gold);
}

.global-search-result-item .result-field {
    padding: 8px 0;
}

.global-search-result-item .result-label {
    font-size: 0.85rem;
    color: #6c757d;
}

.global-search-result-item .result-value {
    font-size: 1rem;
}

/* Анимация для мгновенного поиска */
@keyframes pulseSearch {
    0% { box-shadow: 0 0 0 0 rgba(0, 57, 166, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 57, 166, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 57, 166, 0); }
}

#search-input:focus {
    animation: pulseSearch 1.5s infinite;
}

/* Подсказка для поиска */
.search-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

/* Медиа-запросы для мобильных */
@media (max-width: 768px) {
    .global-search-results {
        max-height: 400px;
    }
    
    .global-search-result-item {
        padding: 12px;
    }
    
    .global-search-result-item .result-label {
        min-width: 80px;
        font-size: 0.8rem;
    }
    
    .global-search-result-item .result-value {
        font-size: 0.95rem;
    }
    
    .category-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .global-search-results {
        max-height: 350px;
        padding: 5px;
    }
    
    .global-search-result-item {
        padding: 10px;
    }
    
    .global-search-result-item .result-field {
        flex-direction: column;
        gap: 3px;
    }
    
    .search-highlight {
        padding: 1px 2px;
        font-size: 0.9rem;
    }
}