/* ========================================
   АДАПТИВНЫЕ СТИЛИ
   Терапевтическое отделение ГУЗ НГКБ
   г. Новомосковск, 2026
   ======================================== */

/* ========================================
   1. ПЛАНШЕТЫ (до 1024px)
   ======================================== */
@media (max-width: 1024px) {
    /* Контейнер */
    :root {
        --container-max: 960px;
    }

    /* Шапка */
    .header-top {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-3);
    }

    .header-logo {
        justify-content: center;
    }

    .header-contacts {
        text-align: center;
    }

    /* Навигация */
    .nav-list {
        gap: var(--spacing-1);
    }

    .nav-link {
        padding: var(--spacing-2) var(--spacing-3);
        font-size: var(--font-size-sm);
    }

    /* Герой-баннер */
    .hero-section {
        padding: var(--spacing-12) 0;
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }

    /* Сетка врачей */
    .doctors-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .doctors-grid-full {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Сетка услуг */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid-full {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Сетка новостей */
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .news-card-large {
        grid-column: span 1;
    }

    /* Форма записи */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Контакты */
    .contacts-grid {
        grid-template-columns: 1fr;
    }

    /* Подвал */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* О отделении */
    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-stats {
        justify-content: center;
    }

    /* Таймлайн */
    .timeline-item,
    .timeline-item[style*="padding-right"] {
        padding-right: var(--spacing-4) !important;
        padding-left: var(--spacing-4) !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .timeline-item > div:first-child {
        position: static !important;
        margin-bottom: var(--spacing-2);
    }

    /* Руководство */
    .management-grid {
        grid-template-columns: 1fr;
    }

    /* Памятки */
    .memos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Карта сайта */
    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Дополнительные контакты */
    .additional-grid {
        grid-template-columns: 1fr;
    }

    /* Социальные сети */
    .social-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    /* Лицензия */
    .license-actions {
        flex-direction: column;
    }

    .license-actions .btn {
        width: 100%;
    }

    /* Баннеры */
    .banners-grid {
        gap: var(--spacing-4);
    }

    .banner-item img {
        height: 40px;
    }
}

/* ========================================
   2. МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px)
   ======================================== */
@media (max-width: 768px) {
    /* Бургер-меню */
    .burger-menu {
        display: flex;
    }

    .nav-list {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background-color: var(--color-bg-white);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-4);
        border-top: 1px solid var(--color-border);
    }

    .nav-list.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    .nav-link {
        padding: var(--spacing-3) var(--spacing-4);
        border-radius: var(--radius-sm);
    }

    .nav-link:hover,
    .nav-link.active {
        background-color: var(--color-primary);
        color: var(--color-white);
    }

    /* Поиск в шапке */
    .header-search {
        position: absolute;
        top: var(--spacing-2);
        right: 60px;
    }

    /* Панель доступности */
    .accessibility-panel {
        top: var(--spacing-2);
        right: var(--spacing-2);
    }

    .accessibility-text {
        display: none;
    }

    .accessibility-btn {
        padding: var(--spacing-2) var(--spacing-3);
    }

    /* Герой-баннер */
    .hero-section {
        padding: var(--spacing-10) 0;
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-lg);
    }

    /* Заголовок страницы */
    .page-hero {
        padding: var(--spacing-8) 0;
    }

    .page-title {
        font-size: var(--font-size-3xl);
    }

    .page-subtitle {
        font-size: var(--font-size-base);
    }

    /* Секции */
    .section {
        padding: var(--spacing-8) 0;
    }

    .section-title {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--spacing-8);
    }

    /* Врачи */
    .doctors-grid,
    .doctors-grid-full {
        grid-template-columns: 1fr;
        gap: var(--spacing-4);
    }

    .doctor-photo {
        height: 200px;
    }

    /* Услуги */
    .services-grid,
    .services-grid-full {
        grid-template-columns: 1fr;
    }

    /* Новости */
    .news-grid,
    .news-grid-full {
        grid-template-columns: 1fr;
    }

    /* Форма записи */
    .appointment-form {
        padding: 0 var(--spacing-2);
    }

    /* Таблицы */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .info-table,
    .schedule-table,
    .docs-table {
        font-size: var(--font-size-sm);
    }

    .info-table th,
    .info-table td,
    .schedule-table th,
    .schedule-table td,
    .docs-table th,
    .docs-table td {
        padding: var(--spacing-3);
    }

    /* Модальные окна */
    .modal-container {
        margin: var(--spacing-4);
        max-height: 95vh;
    }

    .modal-content {
        padding: var(--spacing-5);
    }

    .doctor-modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .doctor-modal-photo {
        width: 120px;
        height: 120px;
    }

    /* Фильтры */
    .filters-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
        min-width: auto;
    }

    .filter-actions {
        justify-content: center;
    }

    /* Пагинация */
    .pagination-list {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Подвал */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-6);
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-2);
    }

    .footer-links li {
        margin-bottom: 0;
    }

    .social-links {
        justify-content: center;
    }

    /* О отделении */
    .about-grid {
        gap: var(--spacing-6);
    }

    .about-stats {
        flex-direction: column;
        gap: var(--spacing-4);
    }

    .stat-item {
        min-width: auto;
    }

    /* Таймлайн на мобильных */
    .timeline-container > div[style*="position: absolute"] {
        left: 20px !important;
        transform: none !important;
    }

    .timeline-item,
    .timeline-item[style*="padding-right"],
    .timeline-item[style*="padding-left"] {
        padding-left: 50px !important;
        padding-right: var(--spacing-4) !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }

    .timeline-item > div:first-child {
        left: 8px !important;
        right: auto !important;
    }

    /* Госпитализация */
    .info-grid {
        grid-template-columns: 1fr;
    }

    /* Памятки */
    .memos-grid {
        grid-template-columns: 1fr;
    }

    /* Карта сайта */
    .quick-links-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sitemap-level-2 {
        padding-left: var(--spacing-6);
    }

    /* Поиск на карте сайта */
    .search-input-wrapper {
        flex-direction: column;
    }

    .search-input-large {
        width: 100%;
    }

    .search-form-large .btn {
        width: 100%;
    }

    /* CTA блок */
    .cta-box {
        padding: var(--spacing-6);
    }

    .cta-box h2 {
        font-size: var(--font-size-2xl);
    }

    .cta-box p {
        font-size: var(--font-size-base);
    }

    /* Аккордеон */
    .accordion-summary {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-base);
    }

    .accordion-content {
        padding: 0 var(--spacing-4) var(--spacing-4);
        font-size: var(--font-size-sm);
    }

    /* Документы */
    .doc-item {
        flex-direction: column;
        text-align: center;
    }

    .doc-info {
        text-align: center;
    }

    /* Страхование */
    .insurance-item {
        flex-direction: column;
        text-align: center;
    }

    .insurance-logo {
        margin-bottom: var(--spacing-3);
    }

    /* Контакты */
    .contact-item {
        flex-direction: column;
        text-align: center;
    }

    .contact-content {
        text-align: center;
    }

    .map-container {
        height: 300px;
    }

    /* Подписка */
    .subscribe-input-group {
        flex-direction: column;
    }

    .subscribe-input {
        width: 100%;
    }

    .subscribe-consent {
        flex-direction: column;
        align-items: center;
    }

    /* Помощь */
    .help-buttons {
        flex-direction: column;
        align-items: center;
    }

    .help-buttons .btn {
        width: 100%;
        max-width: 300px;
    }

    /* Быстрые ссылки на странице Пациентам */
    .services-grid[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Степпер записи */
    .steps-container {
        flex-direction: column;
    }

    .step-item {
        position: relative;
    }

    .step-item::after {
        display: none;
    }
}

/* ========================================
   3. МАЛЕНЬКИЕ ЭКРАНЫ (до 480px)
   ======================================== */
@media (max-width: 480px) {
    /* Контейнер */
    .container {
        padding: 0 var(--spacing-3);
    }

    /* Шапка */
    .logo-title {
        font-size: var(--font-size-xs);
    }

    .logo-subtitle {
        font-size: var(--font-size-xs);
    }

    .logo-img {
        width: 50px;
        height: 50px;
    }

    .phone-link {
        font-size: var(--font-size-base);
    }

    .work-hours {
        font-size: var(--font-size-xs);
    }

    /* Поиск в шапке */
    .header-search {
        right: 50px;
    }

    .search-btn {
        font-size: var(--font-size-lg);
        padding: var(--spacing-1);
    }

    /* Поиск overlay */
    .search-input {
        font-size: var(--font-size-base);
        padding: var(--spacing-3);
    }

    .search-submit {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-sm);
    }

    /* Герой-баннер */
    .hero-section {
        padding: var(--spacing-8) 0;
    }

    .hero-title {
        font-size: var(--font-size-2xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-base);
    }

    /* Заголовок страницы */
    .page-title {
        font-size: var(--font-size-2xl);
    }

    .page-subtitle {
        font-size: var(--font-size-sm);
    }

    /* Секции */
    .section {
        padding: var(--spacing-6) 0;
    }

    .section-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--spacing-6);
    }

    .section-title::after {
        width: 40px;
    }

    /* Кнопки */
    .btn {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-sm);
    }

    .btn-large {
        padding: var(--spacing-3) var(--spacing-6);
        font-size: var(--font-size-base);
    }

    .btn-small {
        padding: var(--spacing-2) var(--spacing-3);
        font-size: var(--font-size-xs);
    }

    /* Карточки врачей */
    .doctor-photo {
        height: 180px;
    }

    .doctor-name {
        font-size: var(--font-size-base);
    }

    /* Карточки услуг */
    .service-icon {
        font-size: 2.5rem;
    }

    .service-title {
        font-size: var(--font-size-base);
    }

    /* Карточки новостей */
    .news-image {
        height: 160px;
    }

    .news-title {
        font-size: var(--font-size-base);
    }

    /* Форма записи */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: var(--font-size-sm);
        padding: var(--spacing-3);
    }

    .checkbox-group {
        flex-direction: column;
        gap: var(--spacing-1);
    }

    .checkbox-group label {
        font-size: var(--font-size-sm);
    }

    /* Модальные окна */
    .modal-close {
        width: 35px;
        height: 35px;
        font-size: var(--font-size-lg);
    }

    .modal-content {
        padding: var(--spacing-4);
    }

    .doctor-modal-photo {
        width: 100px;
        height: 100px;
    }

    /* Таблицы */
    .info-table th,
    .info-table td,
    .schedule-table th,
    .schedule-table td,
    .docs-table th,
    .docs-table td {
        padding: var(--spacing-2);
        font-size: var(--font-size-xs);
    }

    /* Аккордеон */
    .accordion-summary {
        padding: var(--spacing-3);
        font-size: var(--font-size-sm);
    }

    .accordion-title {
        font-size: var(--font-size-sm);
    }

    .accordion-icon {
        font-size: var(--font-size-lg);
    }

    /* Пагинация */
    .pagination-link {
        min-width: 38px;
        height: 38px;
        font-size: var(--font-size-sm);
    }

    /* Подвал */
    .footer {
        padding: var(--spacing-8) 0 var(--spacing-6);
    }

    .footer-title {
        font-size: var(--font-size-base);
    }

    .footer-links a {
        font-size: var(--font-size-sm);
    }

    .footer-bottom {
        font-size: var(--font-size-xs);
    }

    /* Баннеры */
    .banner-item img {
        height: 35px;
    }

    /* Статистика */
    .stat-number {
        font-size: var(--font-size-3xl);
    }

    .stat-label {
        font-size: var(--font-size-xs);
    }

    /* Быстрые ссылки (Пациентам) */
    .services-grid[style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* CTA блок */
    .cta-box {
        padding: var(--spacing-5);
    }

    .cta-box h2 {
        font-size: var(--font-size-xl);
    }

    .cta-box p {
        font-size: var(--font-size-sm);
    }

    /* Документы */
    .doc-icon {
        font-size: var(--font-size-3xl);
    }

    .doc-title {
        font-size: var(--font-size-base);
    }

    .doc-meta {
        font-size: var(--font-size-xs);
    }

    /* Памятки */
    .memo-icon {
        font-size: 2.5rem;
    }

    .memo-title {
        font-size: var(--font-size-base);
    }

    .memo-desc {
        font-size: var(--font-size-sm);
    }

    /* Социальные сети */
    .social-card {
        padding: var(--spacing-5);
    }

    .social-icon {
        font-size: var(--font-size-3xl);
    }

    .social-name {
        font-size: var(--font-size-base);
    }

    .social-handle {
        font-size: var(--font-size-xs);
    }

    /* Контакты */
    .contact-icon {
        font-size: var(--font-size-xl);
    }

    .contact-content h3 {
        font-size: var(--font-size-sm);
    }

    .contact-content p {
        font-size: var(--font-size-xs);
    }

    /* Карта */
    .map-container {
        height: 250px;
    }

    .map-placeholder {
        padding: var(--spacing-4);
    }

    /* Подписка */
    .subscribe-text {
        font-size: var(--font-size-base);
    }

    /* Помощь */
    .help-box h2 {
        font-size: var(--font-size-2xl);
    }

    /* Таймлайн */
    .timeline-container {
        padding: var(--spacing-4) 0 !important;
    }

    .timeline-item > div[style*="background"] {
        padding: var(--spacing-3) !important;
    }

    .stat-number[style*="font-size: var(--font-size-2xl)"] {
        font-size: var(--font-size-xl) !important;
    }

    /* Цитата */
    blockquote {
        font-size: var(--font-size-lg) !important;
    }

    /* Руководство */
    .management-photo {
        width: 120px;
        height: 120px;
    }

    .management-name {
        font-size: var(--font-size-base);
    }

    /* Лицензия */
    .license-card {
        padding: var(--spacing-5);
    }

    .license-preview img {
        max-width: 200px;
    }

    /* Поиск по сайту (sitemap) */
    .search-input-large {
        padding: var(--spacing-3);
        font-size: var(--font-size-base);
    }

    /* Фильтры */
    .filter-label {
        font-size: var(--font-size-sm);
    }

    .filter-select {
        font-size: var(--font-size-sm);
        padding: var(--spacing-2) var(--spacing-3);
    }

    /* Чеклист документов */
    .checklist-item {
        padding: var(--spacing-2) !important;
    }

    .check-text {
        font-size: var(--font-size-sm);
    }
}

/* ========================================
   4. ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 360px)
   ======================================== */
@media (max-width: 360px) {
    /* Шрифты ещё меньше */
    html {
        font-size: 14px;
    }

    /* Шапка */
    .logo-title {
        display: none;
    }

    .logo-subtitle {
        display: none;
    }

    .header-logo {
        justify-content: center;
    }

    /* Герой */
    .hero-title {
        font-size: var(--font-size-xl);
    }

    /* Кнопки */
    .btn {
        width: 100%;
    }

    .btn-block {
        width: 100%;
    }

    /* Карточки */
    .doctor-card,
    .service-card,
    .news-card,
    .memo-card {
        padding: var(--spacing-3);
    }

    /* Таблицы */
    .info-table,
    .schedule-table,
    .docs-table {
        font-size: 10px;
    }

    /* Подвал */
    .footer-column {
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

/* ========================================
   5. АЛЬБОМНАЯ ОРИЕНТАЦИЯ (мобильные)
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: var(--spacing-8) 0;
    }

    .modal-container {
        max-height: 85vh;
    }

    .modal-content {
        max-height: 75vh;
        overflow-y: auto;
    }
}

/* ========================================
   6. ПЕЧАТНЫЕ СТИЛИ (дополнение)
   ======================================== */
@media print {
    @page {
        margin: 1.5cm;
        size: A4;
    }

    body {
        font-size: 11pt;
        line-height: 1.4;
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
        padding: 0;
        width: 100%;
    }

    /* Скрыть ненужные элементы */
    .header,
    .footer,
    .accessibility-panel,
    .search-overlay,
    .modal-overlay,
    .burger-menu,
    .filters-section,
    .pagination,
    .cta-section,
    .banners-section,
    .subscribe-section,
    .help-section,
    .social-section,
    .skip-link {
        display: none !important;
    }

    /* Ссылки */
    a {
        text-decoration: underline;
        color: black;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        word-break: break-all;
    }

    a[href^="tel:"]::after,
    a[href^="mailto:"]::after,
    a[href^="#"]::after {
        content: "";
    }

    /* Изображения */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Секции */
    .section {
        padding: 1cm 0;
        page-break-inside: avoid;
    }

    /* Заголовки */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    /* Таблицы */
    table {
        page-break-inside: avoid;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    /* Карточки */
    .doctor-card,
    .service-card,
    .news-card,
    .memo-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    /* Кнопки */
    .btn {
        border: 1px solid black;
        background: none;
        color: black;
    }

    /* Фон */
    .hero-section,
    .page-hero,
    .subscribe-section,
    .cta-section {
        background: white !important;
        color: black !important;
    }

    .hero-title,
    .page-title {
        color: black !important;
    }
}

/* ========================================
   7. АНИМАЦИИ ДЛЯ МОБИЛЬНЫХ
   ======================================== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Уменьшение анимаций для пользователей с предпочтением */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   8. ТЁМНАЯ ТЕМА (будущая поддержка)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Можно раскомментировать для тёмной темы */
    /*
    :root {
        --color-bg: #1a1a1a;
        --color-bg-white: #2d2d2d;
        --color-text: #e0e0e0;
        --color-text-light: #b0b0b0;
        --color-border: #404040;
    }
    */
}

/* ========================================
   9. ВЫСОКИЙ КОНТРАСТ
   ======================================== */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #0000FF;
        --color-accent: #00FF00;
        --color-border: #000000;
    }

    .btn {
        border-width: 3px;
    }

    a {
        text-decoration: underline;
    }
}

/* ========================================
   10. БОЛЬШОЙ ТЕКСТ (системные настройки)
   ======================================== */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Поддержка системного увеличения текста */
@media (min-resolution: 120dpi) {
    html {
        font-size: 18px;
    }
}