/* ==========================================
   ОРИГИНАЛЬНЫЕ СТИЛИ ГАУЗ "БГБ №1"
   ========================================== */
:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --bg-light: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --white: #ffffff;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Верхняя панель */
.top-bar {
    background: #0f172a;
    color: #94a3b8;
    padding: 8px 20px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar-info span {
    margin-right: 15px;
}

.accessible-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-accessible {
    background: #334155;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-font-size {
    background: #334155;
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Шапка с фоновым изображением */
.hero-header-img-container {
    position: relative;
    background: #0284c7;
    color: white;
    min-height: 140px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-header-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.25;
}

.header-image-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-logo-img {
    height: 65px;
    width: auto;
}

.header-titles h1 {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.header-titles p {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 4px;
}

.btn-header-booking {
    background: #ffffff;
    color: var(--primary);
    border: none;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, background 0.2s;
}

.btn-header-booking:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

/* Навигация */
nav {
    background: var(--primary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 14px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-hover);
}

/* Макет страницы */
main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    flex: 1;
    width: 100%;
}

.page-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 30px;
}

@media (max-width: 900px) {
    .page-with-sidebar {
        grid-template-columns: 1fr;
    }
}

.hero-banner-compact {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.hero-banner-compact h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.hero-banner-compact p {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* Карточки быстрых ссылок */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.card h3 {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 6px;
}

.card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Заголовки разделов */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    margin-top: 25px;
}

.section-header h3 {
    font-size: 1.2rem;
    color: var(--text-main);
}

.link-all {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Новости на главной */
.news-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.news-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.news-date {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 6px;
}

.news-card h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.news-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Внешние ресурсы */
.external-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.partner-link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: border-color 0.2s;
}

.partner-link:hover {
    border-color: var(--primary);
}

.partner-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.partner-title {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Сайдбар виджета */
.desktop-widget-container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
}

.desktop-widget-container h4 {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.mobile-widget-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 99;
}

@media (max-width: 900px) {
    .desktop-widget-container {
        display: none;
    }
    .mobile-widget-btn {
        display: block;
    }
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Мобильное окно виджета «Вопросы и предложения» */
.widget-modal-content {
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 45px 20px 20px 20px;
}

.widget-content {
    width: 100%;
}

.widget-content h4 {
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.booking-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.booking-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    color: white;
}

.btn-gosuslugi { background: #0b5cff; }
.btn-napriem { background: #0284c7; }
.btn-phone { background: #16a34a; }

/* Подвал */
footer {
    background: #0f172a;
    color: white;
    margin-top: auto;
    padding-top: 30px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 30px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.footer-col h4 {
    font-size: 1.05rem;
    margin-bottom: 12px;
    color: #f1f5f9;
}

.footer-col p, .footer-col ul li {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.6;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li a {
    color: #94a3b8;
    text-decoration: none;
}

.footer-col ul li a:hover {
    color: white;
}

.footer-bottom {
    background: #020617;
    text-align: center;
    padding: 15px 20px;
    font-size: 0.8rem;
    color: #64748b;
}
/* --- Версия для слабовидящих (Контрастный режим) --- */
body.accessibility-mode {
    background: #000 !important;
    color: #fff !important;
}

body.accessibility-mode *, 
body.accessibility-mode header, 
body.accessibility-mode footer, 
body.accessibility-mode main, 
body.accessibility-mode div, 
body.accessibility-mode section, 
body.accessibility-mode article, 
body.accessibility-mode table, 
body.accessibility-mode tr, 
body.accessibility-mode td, 
body.accessibility-mode th {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
    background-image: none !important;
}

/* Ссылки делаем ярко-желтыми для лучшей видимости */
body.accessibility-mode a, 
body.accessibility-mode a * {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

/* Карточки, блоки и таблицы с белыми рамками */
body.accessibility-mode .contact-card,
body.accessibility-mode .dept-card,
body.accessibility-mode .dept-preview-card,
body.accessibility-mode table tr {
    border: 2px solid #fff !important;
}

/* Кнопки в контрастном режиме */
body.accessibility-mode button, 
body.accessibility-mode .btn-submit,
body.accessibility-mode .btn-download,
body.accessibility-mode .btn-action,
body.accessibility-mode .btn-details {
    background-color: #fff !important;
    color: #000 !important;
    border: 2px solid #fff !important;
    font-weight: bold !important;
}
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.resource-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.resource-img-wrap {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.resource-img-wrap img {
    max-width: 100%;
    max-height: 90px;
    object-fit: contain;
}

.resource-title {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 8px;
    font-weight: 600;
}

.resource-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

/* Оформление текста, набранного в визуальном редакторе (новости, статьи) */
.rich-text {
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.rich-text > *:first-child { margin-top: 0; }
.rich-text > *:last-child { margin-bottom: 0; }

/* Страховка от вставленного из Word текста с фиксированной шириной */
.rich-text div,
.rich-text section {
    max-width: 100%;
}

.rich-text p {
    margin: 0 0 15px;
    line-height: 1.7;
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6 {
    color: var(--primary);
    line-height: 1.3;
    margin: 26px 0 12px;
}

.rich-text h1 { font-size: 1.5rem; }
.rich-text h2 { font-size: 1.35rem; }
.rich-text h3 { font-size: 1.18rem; }
.rich-text h4 { font-size: 1.05rem; }
.rich-text h5,
.rich-text h6 { font-size: 1rem; }

.rich-text ul,
.rich-text ol {
    margin: 0 0 15px;
    padding-left: 24px;
}

.rich-text li {
    margin-bottom: 6px;
    line-height: 1.65;
}

.rich-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 12px 0;
}

.rich-text a {
    color: var(--primary);
    text-decoration: underline;
}

.rich-text a:hover { color: var(--primary-hover); }

.rich-text blockquote {
    border-left: 4px solid var(--primary);
    background: var(--bg-light);
    margin: 18px 0;
    padding: 10px 18px;
    color: var(--text-muted);
}

.rich-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 25px 0;
}

.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.95rem;
}

.rich-text th,
.rich-text td {
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.rich-text th {
    background: #f1f5f9;
    font-weight: 600;
}

.rich-text .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 15px 0;
    -webkit-overflow-scrolling: touch;
}

.rich-text .table-wrap table { margin: 0; }

.rich-text iframe,
.rich-text video {
    max-width: 100%;
    border: none;
}

.rich-text pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 15px 0;
}

.rich-text code {
    background: #f1f5f9;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

@media (max-width: 640px) {
    .rich-text h1 { font-size: 1.25rem; }
    .rich-text h2 { font-size: 1.18rem; }
    .rich-text h3 { font-size: 1.08rem; }
}
