/* ════════════════════════════════════════════════════════════
   Адаптивная вёрстка — Добрый Доктор
   Breakpoints: 1200 | 992 | 768 | 600
   ════════════════════════════════════════════════════════════ */

/* Админ-панель (базовая сетка) */
.admin {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.admin__sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-sizing: border-box;
}

.admin__brand {
    font-weight: 800;
    font-size: 18px;
    line-height: 1.35;
    margin-bottom: 20px;
}

.admin__brand small {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-subtle);
}

.admin__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin__nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.admin__nav-link:hover {
    background: var(--bg-accent);
}

.admin__nav-link.active {
    background: var(--text-accent);
    color: #fff;
}

.admin__content {
    flex: 1;
    min-width: 0;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--text-accent);
    background: rgba(1, 161, 69, 0.08);
    color: var(--text-accent);
}

/* ── Планшет (горизонтальный) ─────────────────────────────────────────── */
@media (max-width: 1200px) {
    .nav {
        gap: 32px;
    }

    .hero-image-container {
        width: 520px;
        margin-left: -80px;
    }

    .service-sidebar {
        width: 42%;
        padding: 80px 32px;
    }

    .service-content {
        padding: 80px 32px;
    }
}

/* ── Планшет / мобильное меню ───────────────────────────────────────────── */
@media (max-width: 992px) {
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        border: 2px solid var(--border-color);
        border-radius: 12px;
        background: var(--bg-primary);
        cursor: pointer;
        flex-shrink: 0;
    }

    .nav-toggle__bar {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    body.nav-open .nav-toggle__bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    body.nav-open .nav-toggle__bar:nth-child(2) {
        opacity: 0;
    }

    body.nav-open .nav-toggle__bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 88vw);
        height: 100vh;
        height: 100dvh;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 88px 24px 32px;
        background: var(--bg-primary);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.18);
        z-index: 10001;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    body.nav-open .nav {
        transform: translateX(0);
    }

    .nav__link {
        width: 100%;
        padding: 14px 0;
        font-size: 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .nav__link:last-child {
        border-bottom: none;
    }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .nav-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    body.nav-open {
        overflow: hidden;
    }

    .header {
        padding: 16px 0;
    }

    .logo-image {
        width: 80px;
        height: 80px;
    }

    .auth-btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .user-avatar-btn {
        font-size: 13px;
        padding: 6px 12px 6px 6px;
    }

    /* Услуги */
    .services {
        padding-top: 72px;
        padding-bottom: 72px;
    }

  /* Почему мы — планшет */
    .why-us-grid {
        grid-template-columns: 1fr;
        gap: 48px;
        column-gap: 0;
    }

    .why-us-item-title {
        margin-left: 0;
    }

    .why-us-title {
        margin-bottom: 56px;
    }

    /* Статистика */
    .stats-number {
        font-size: 52px;
    }

    .stats-description {
        font-size: 32px;
        white-space: normal;
    }

    /* Подвал — мобильный вариант со скриншота */
    .footer {
        padding: 36px 0 28px;
        text-align: left;
    }

    .footer-container {
        gap: 20px;
    }

    .footer-brand-row {
        flex-wrap: nowrap;
        gap: 12px;
    }

    .footer-logo-image {
        width: 56px;
        height: 56px;
    }

    .footer-logo-text-block {
        display: none;
    }

    .footer-quick-nav {
        display: flex;
        flex: 1;
        justify-content: flex-start;
        gap: 14px;
        min-width: 0;
    }

    .footer-quick-nav .footer-link {
        font-size: 15px;
    }

    .footer-social {
        margin-left: auto;
        gap: 10px;
    }

    .footer-social-link img {
        width: 36px;
        height: 36px;
    }

    .footer-bottom {
        gap: 10px;
    }

    .footer-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px 18px;
    }

    .footer-nav .footer-link,
    .footer-center .footer-link {
        font-size: 15px;
    }

    .footer-contacts {
        padding-top: 14px;
        margin-top: 6px;
        gap: 6px;
    }

    .footer-contacts .footer-link {
        font-size: 15px;
    }

    .footer-link {
        font-size: 15px;
        line-height: 1.35;
    }

    /* Страницы услуг / записи / новости */
    .service-page-container {
        flex-direction: column;
    }

    .service-sidebar {
        width: 100%;
        padding: 48px 24px 32px;
    }

    .service-sidebar-title {
        font-size: 28px;
    }

    .service-content {
        width: 100%;
        padding: 32px 24px 56px;
    }

    .service-title,
    .service-subtitle {
        font-size: 28px;
    }

    .service-description,
    .article-text-content {
        font-size: 17px;
        line-height: 1.5;
    }

    .price-list {
        font-size: 16px;
    }

    .price-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 14px 16px;
    }

    /* Форма записи */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group input[type="text"],
    .form-group input[type="tel"],
    .form-group textarea {
        padding: 16px;
        font-size: 16px;
        border-radius: 16px;
    }

    .form-group textarea {
        height: 160px;
    }

    .appointment-btn {
        width: 100%;
        max-width: 100%;
    }

    .radio-group {
        font-size: 18px;
    }

    /* Кабинет */
    .cabinet-tabs {
        padding: 0 8px;
    }

    .cabinet-tab {
        padding: 12px 16px;
        font-size: 13px;
    }

    .cabinet-content {
        padding: 28px 12px 48px;
    }

    /* Админка */
    .admin {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .admin__sidebar {
        width: 100%;
        background: var(--bg-card);
        border-radius: 16px;
        padding: 20px;
        box-sizing: border-box;
    }

    .admin__nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin__nav-link {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 14px;
        text-decoration: none;
        color: var(--text-primary);
        background: var(--bg-accent);
    }

    .admin__nav-link.active {
        background: var(--text-accent);
        color: #fff;
    }

    .admin__content {
        width: 100%;
        overflow-x: auto;
    }

    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ── Мобильный ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .logo-image {
        width: 72px;
        height: 72px;
    }

    /* Герой — по центру */
    .hero-text {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-title,
    .hero-description {
        text-align: center;
    }

    /* Услуги — сетка 2 в ряд, контент по центру */
    .services {
        padding-top: 48px;
        padding-bottom: 56px;
    }

    .services-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        width: 100%;
        align-items: stretch;
    }

    .services-row {
        display: contents;
    }

    .service-card {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: auto;
        min-height: 128px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 14px 10px;
        gap: 4px;
    }

    .service-card__title {
        position: static;
        font-size: 15px;
        line-height: 1.25;
        width: 100%;
    }

    .service-card__count {
        position: static;
        font-size: 12px;
        width: 100%;
    }

    .service-card__image {
        position: static !important;
        width: 44px !important;
        height: auto;
        margin: 2px 0;
        flex-shrink: 0;
    }

    .why-us {
        padding-top: 56px;
        padding-bottom: 56px;
        min-height: auto;
        overflow: hidden;
    }

    .why-us-title {
        margin-bottom: 40px;
    }

    .why-us-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .why-us-item-title {
        margin-left: 0;
        margin-bottom: 16px;
        font-size: 18px;
        text-align: center;
    }

    .why-us-item-content {
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }

    .why-us-item-icon {
        width: auto;
        max-width: 72px;
        height: auto;
    }

    .why-us-item-description {
        margin-left: 0 !important;
        font-size: 15px;
        line-height: 1.55;
        text-align: center;
        max-width: 100%;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-card-image-wrapper {
        height: auto;
        max-height: none;
    }

    .news-card-image {
        width: 100%;
        height: auto;
        object-fit: contain;
        object-position: center top;
    }

    .news-card-content {
        padding: 22px;
    }

    .news-card-title {
        font-size: 18px;
        margin-bottom: 24px;
    }

    .contacts {
        padding: 56px 0 80px;
    }

    .contacts-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 28px;
    }

    .contacts-title {
        margin-bottom: 32px;
    }

    .contact-item {
        gap: 14px;
        margin-bottom: 18px;
    }

    .contact-icon-wrap {
        width: 32px;
        height: 32px;
    }

    .contact-icon {
        width: 26px;
        height: 26px;
    }

    .contact-text {
        font-size: 16px;
        line-height: 1.45;
        padding-top: 4px;
    }

    .map {
        width: 100%;
        height: 280px;
    }

    .about-us {
        padding: 56px 0;
        overflow: hidden;
    }

    .about-us-content {
        width: 100%;
        max-width: 100%;
    }

    .about-us-description {
        width: 100%;
        max-width: 100%;
        padding: 0 4px;
        font-size: 16px;
        line-height: 1.55;
        text-align: center;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .about-us-decoration-1,
    .about-us-decoration-2,
    .about-us-decoration-3 {
        display: none;
    }

    .about-us-image {
        max-width: 100%;
        width: 100%;
        height: auto;
        padding: 0 8px;
        box-sizing: border-box;
    }

    .reviews-grid {
        grid-template-columns: 1fr;
    }

    .review-form-wrap {
        padding: 24px 18px;
    }

    .review-form .btn,
    .contact-form .btn {
        width: 100%;
    }

    .auth-modal {
        padding: 28px 22px;
        width: 100%;
        max-width: calc(100vw - 32px);
        margin: 16px;
    }

    #scroll-top-btn {
        right: 16px;
        bottom: 16px;
    }

    #toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        max-width: none;
    }
}

/* ── Узкий мобильный ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .service-card {
        min-height: 118px;
        padding: 12px 8px;
    }

    .service-card__title {
        font-size: 14px;
    }

    .service-card__image {
        width: 40px !important;
    }

    .services-content {
        gap: 10px;
    }

    .stats-number {
        font-size: 40px;
    }

    .stats-description {
        font-size: 22px;
        line-height: 1.35;
    }

    .footer {
        padding: 28px 0 24px;
    }

    .footer-logo-image {
        width: 48px;
        height: 48px;
    }

    .footer-social-link img {
        width: 32px;
        height: 32px;
    }

    .footer-quick-nav .footer-link,
    .footer-nav .footer-link,
    .footer-center .footer-link,
    .footer-contacts .footer-link {
        font-size: 14px;
    }

    .cabinet-tab {
        padding: 12px 12px;
        font-size: 12px;
    }

    .cabinet-card {
        padding: 18px 16px;
    }

    .cabinet-card__title {
        font-size: 17px;
    }

    .appointment-card {
        flex-direction: column;
        gap: 12px;
    }

    .admin-stats {
        grid-template-columns: 1fr 1fr;
    }

    .admin-stat-card__val {
        font-size: 28px;
    }

    .service-price-note {
        font-size: 16px;
    }

    .article-text-content p {
        margin-bottom: 24px;
    }
}

/* ── Очень узкие экраны ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .header-toolbar {
        gap: 8px;
    }

    .auth-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .user-avatar-btn > span:not(.user-avatar-circle) {
        display: none;
    }

    .user-avatar-btn {
        padding: 6px;
        border-radius: 50%;
    }
}
