:root {
    --primary-blue: #1565C0;
    --light-blue-bg: #EBF4FA;
    --very-light-blue: #F5F9FD;
    --white: #FFFFFF;
    --text-dark: #1E293B;
    --text-muted: #475569;
    --border-light: #DCE7F1;
    --hover-blue: #E3F0FA;
    --table-header: #E3F0FA;
    --table-stripe: #F8FBFE;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-blue-bg);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* ======= РЕЖИМ ДЛЯ СЛАБОВИДЯЩИХ ======= */
body.accessible-mode {
    background: #000 !important;
    color: #fff !important;
    font-size: 18px;
    line-height: 1.6;
}
body.accessible-mode a {
    color: #ffdd00 !important;
    text-decoration: underline !important;
}
body.accessible-mode a:hover {
    color: #ffe866 !important;
}
body.accessible-mode .top-bar,
body.accessible-mode .header-main,
body.accessible-mode .navbar,
body.accessible-mode .card-official,
body.accessible-mode .legal-filter-bar,
body.accessible-mode .publication-card,
body.accessible-mode .footer {
    background: #111 !important;
    border-color: #555 !important;
    color: #fff !important;
}
body.accessible-mode .card-official .card-title,
body.accessible-mode .site-title,
body.accessible-mode .site-subtitle,
body.accessible-mode .header-contacts {
    color: #fff !important;
}
body.accessible-mode .navbar-dark .navbar-nav .nav-link {
    color: #ffdd00 !important;
}
body.accessible-mode .btn-primary,
body.accessible-mode .btn-outline-custom,
body.accessible-mode .badge-status {
    background: #222 !important;
    color: #ffdd00 !important;
    border-color: #ffdd00 !important;
}
body.accessible-mode .legal-table thead th {
    background: #222 !important;
    color: #ffdd00 !important;
    border-color: #555 !important;
}
body.accessible-mode .legal-table tbody td {
    border-color: #444 !important;
}
body.accessible-mode .legal-table tbody tr:nth-child(even) {
    background: #1a1a1a !important;
}
body.accessible-mode .legal-table tbody tr:hover {
    background: #2a2a2a !important;
}
body.accessible-mode .form-control,
body.accessible-mode .form-select {
    background: #222 !important;
    color: #fff !important;
    border-color: #555 !important;
}
body.accessible-mode .btn-outline-custom:hover {
    background: #333 !important;
}
.accessibility-toggle {
    cursor: pointer;
    transition: background 0.2s;
}
body.accessible-mode .accessibility-toggle {
    background: #ffdd00 !important;
    color: #000 !important;
    font-weight: bold;
}

/* Базовые элементы */
a { text-decoration: none; color: var(--primary-blue); transition: color 0.2s; }
a:hover { text-decoration: underline; color: #0D47A1; }
html { scroll-behavior: smooth; }

/* Верхняя панель */
.top-bar {
    background: var(--very-light-blue);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    padding: 0.4rem 0;
    animation: slideDown 0.5s ease-out;
}
.top-bar a {
    color: #2C3E50;
    margin-right: 1.2rem;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.top-bar a:hover { transform: translateY(-1px); color: var(--primary-blue); text-decoration: none; }
.top-bar a i { margin-right: 0.3rem; color: var(--primary-blue); transition: transform 0.3s; }
.top-bar a:hover i { transform: scale(1.2); }

/* Шапка */
.header-main {
    background: var(--white);
    padding: 1.8rem 0;
    border-bottom: 4px solid var(--primary-blue);
    box-shadow: 0 2px 8px rgba(21,101,192,0.1);
    position: relative;
    overflow: hidden;
}
.header-main::after {
    content: '';
    position: absolute;
    top: -40%; right: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(21,101,192,0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}
.header-main .container { display: flex; align-items: center; flex-wrap: wrap; position: relative; z-index: 1; }
.coat-of-arms {
    width: 100px; height: auto; margin-right: 2rem;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s;
}
.coat-of-arms:hover { transform: scale(1.05) rotate(2deg); }
.site-title-block { flex: 1; }
.site-title { font-size: 2.2rem; font-weight: 700; color: #0D3B66; line-height: 1.2; margin: 0; letter-spacing: 0.3px; animation: fadeInLeft 0.8s; }
.site-subtitle { font-size: 1rem; color: #4B5E73; margin: 0.2rem 0 0; animation: fadeInLeft 1s; }
.header-contacts { text-align: right; font-size: 0.9rem; color: #2C3E50; animation: fadeInRight 0.8s; }
.header-contacts div { margin-bottom: 0.2rem; transition: transform 0.2s; }
.header-contacts div:hover { transform: translateX(-3px); }
.header-contacts i { color: var(--primary-blue); width: 18px; margin-right: 4px; }

/* Навигация */
.navbar {
    background: var(--primary-blue);
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    animation: fadeIn 0.8s ease-out 0.3s both;
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,0.95);
    font-weight: 500;
    padding: 0.8rem 1.3rem;
    transition: all 0.3s;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeInLeft 0.5s forwards;
}
.navbar-dark .navbar-nav .nav-item:nth-child(1) .nav-link { animation-delay: 0.5s; }
.navbar-dark .navbar-nav .nav-item:nth-child(2) .nav-link { animation-delay: 0.6s; }
.navbar-dark .navbar-nav .nav-item:nth-child(3) .nav-link { animation-delay: 0.7s; }
.navbar-dark .navbar-nav .nav-item:nth-child(4) .nav-link { animation-delay: 0.8s; }
.navbar-dark .navbar-nav .nav-item:nth-child(5) .nav-link { animation-delay: 0.9s; }
.navbar-dark .navbar-nav .nav-item:nth-child(6) .nav-link { animation-delay: 1.0s; }
.navbar-dark .navbar-nav .nav-item:nth-child(7) .nav-link { animation-delay: 1.1s; }
.navbar-dark .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    width: 0; height: 3px;
    background: #fff;
    transition: all 0.3s;
    transform: translateX(-50%);
}
.navbar-dark .navbar-nav .nav-link:hover::after,
.navbar-dark .navbar-nav .nav-link.active::after { width: 100%; }
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}
.dropdown-menu { border-radius: 0 0 6px 6px; border: 1px solid var(--border-light); margin-top: 0; background: #fff; animation: fadeIn 0.2s; }
.dropdown-item { font-size: 0.9rem; color: var(--text-dark); transition: all 0.2s; }
.dropdown-item:hover { background: var(--hover-blue); color: #000; transform: translateX(5px); }

/* Основной контент */
.main-content { padding: 2.5rem 0; }
.card-official {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(21,101,192,0.08);
    margin-bottom: 2rem;
    padding: 1.8rem;
    transition: box-shadow 0.3s, transform 0.3s;
}
.card-official:hover { box-shadow: 0 8px 25px rgba(21,101,192,0.15); transform: translateY(-2px); }
.card-official .card-title {
    font-size: 1.4rem; font-weight: 600; color: #0D3B66;
    border-bottom: 3px solid #DCE7F1;
    padding-bottom: 0.6rem; margin-bottom: 1.2rem;
    display: flex; align-items: center; gap: 0.5rem;
    transition: border-color 0.3s;
}
.card-official:hover .card-title { border-bottom-color: var(--primary-blue); }
.card-official .card-title i { color: var(--primary-blue); transition: transform 0.3s; }
.card-official:hover .card-title i { transform: rotate(5deg) scale(1.1); }

/* Фильтр правовых актов */
.legal-filter-bar {
    background: var(--very-light-blue);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s;
}
.legal-filter-bar:hover { box-shadow: 0 4px 12px rgba(21,101,192,0.1); }
.legal-filter-bar .form-control,
.legal-filter-bar .form-select {
    border-radius: 4px; border: 1px solid #B0C4DE; font-size: 0.9rem;
    transition: all 0.3s;
}
.legal-filter-bar .form-control:focus,
.legal-filter-bar .form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 0.2rem rgba(21,101,192,0.15);
    transform: translateY(-1px);
}
.legal-filter-bar .btn-primary {
    border-radius: 4px; background: var(--primary-blue); border-color: var(--primary-blue);
    font-weight: 600; transition: all 0.3s; position: relative; overflow: hidden;
}
.legal-filter-bar .btn-primary:hover {
    background: #0D47A1; border-color: #0D47A1;
    transform: translateY(-2px); box-shadow: 0 6px 15px rgba(21,101,192,0.3);
}
.legal-filter-bar .btn-primary:active { transform: translateY(0); }

/* Таблица */
.legal-table { width: 100%; border-collapse: collapse; animation: fadeIn 0.8s; }
.legal-table thead th {
    background: var(--table-header); color: #0D3B66; font-weight: 600;
    font-size: 0.9rem; padding: 0.8rem 1rem;
    border-bottom: 2px solid #B0C4DE; vertical-align: middle;
}
.legal-table tbody td {
    padding: 0.8rem 1rem; font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light); vertical-align: middle;
    color: var(--text-dark);
}
.legal-table tbody tr { transition: all 0.2s; }
.legal-table tbody tr:hover { background: var(--hover-blue); transform: scale(1.01); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.legal-table tbody tr:nth-child(even) { background: var(--table-stripe); }
.legal-table tbody tr:nth-child(even):hover { background: var(--hover-blue); }
.legal-table .doc-number { font-weight: 600; color: #0D3B66; white-space: nowrap; }
.legal-table .doc-title { font-weight: 500; }
.legal-table .badge-status { border-radius: 4px; font-size: 0.75rem; font-weight: 600; padding: 0.3em 0.8em; letter-spacing: 0.2px; transition: transform 0.2s; }
.legal-table .badge-status:hover { transform: scale(1.1); }
.legal-table .btn-outline-custom {
    border: 1px solid #B0C4DE; color: #2C3E50; border-radius: 4px;
    font-size: 0.8rem; padding: 0.25rem 0.7rem; background: #fff;
    white-space: nowrap; transition: all 0.3s;
}
.legal-table .btn-outline-custom:hover {
    background: #EBF2FA; border-color: var(--primary-blue);
    transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Публикации */
.publication-card {
    border: 1px solid var(--border-light); border-radius: 6px; background: #fff;
    padding: 1.2rem; margin-bottom: 1rem; transition: all 0.3s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}
.publication-card:hover {
    box-shadow: 0 10px 25px rgba(21,101,192,0.15); border-color: #B0C4DE;
    transform: translateY(-5px);
}
.publication-card .badge-category {
    background: #E3F0FA; color: #0D3B66; font-weight: 500; font-size: 0.75rem;
    border-radius: 4px; padding: 0.25em 0.8em; display: inline-block;
    margin-bottom: 0.5rem; transition: all 0.3s;
}
.publication-card:hover .badge-category {
    background: var(--primary-blue); color: white; transform: translateY(-2px);
}
.publication-card .card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.3rem; }
.publication-card .card-text { font-size: 0.9rem; color: #475569; margin-bottom: 0.6rem; line-height: 1.5; }
.publication-card .meta { font-size: 0.8rem; color: #5F6B7A; display: flex; justify-content: space-between; align-items: center; }
.publication-card .btn-outline-custom { transition: all 0.3s; }
.publication-card .btn-outline-custom:hover { transform: translateX(3px); }

/* Кнопки */
.btn-outline-custom {
    border: 1px solid #B0C4DE; color: #2C3E50; border-radius: 4px;
    font-size: 0.85rem; padding: 0.35rem 0.9rem; background: #fff;
    transition: all 0.3s;
}
.btn-outline-custom:hover {
    background: #EBF2FA; border-color: var(--primary-blue);
    transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Пагинация */
.pagination .page-link {
    border-radius: 4px; color: var(--primary-blue);
    border: 1px solid var(--border-light); margin: 0 3px;
    transition: all 0.3s;
}
.pagination .page-link:hover { background: var(--hover-blue); transform: translateY(-2px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.pagination .page-item.active .page-link {
    background: var(--primary-blue); border-color: var(--primary-blue); color: white;
    animation: pulse 2s infinite;
}

/* Футер */
.footer {
    background: #0D3B66; color: #E3F0FA; padding: 2.5rem 0 1.5rem;
    font-size: 0.9rem; margin-top: 2rem; position: relative; overflow: hidden;
}
.footer::before {
    content: '';
    position: absolute; top: -50%; left: -10%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}
.footer h6 { color: #ffffff; font-weight: 600; margin-bottom: 1rem; }
.footer a { color: #B0C4DE; transition: all 0.3s; }
.footer a:hover { color: #ffffff; text-decoration: none; padding-left: 5px; }
.footer-bottom { background: #0A2A4A; color: #8FA4BA; padding: 1rem 0; font-size: 0.85rem; text-align: center; }

/* Анимации */
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-15px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-6px); } 100% { transform: translateY(0px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21,101,192,0.4); } 70% { box-shadow: 0 0 0 8px rgba(21,101,192,0); } 100% { box-shadow: 0 0 0 0 rgba(21,101,192,0); } }

/* Адаптив */
@media (max-width: 992px) { .legal-table-wrap { overflow-x: auto; } }
@media (max-width: 768px) {
    .header-main .container { flex-direction: column; text-align: center; }
    .header-contacts { text-align: center; margin: 1.2rem 0 0; }
    .coat-of-arms { margin: 0 auto 1rem; animation: none; }
}