/* ========================================================
   1. ПЕРЕМЕННЫЕ И ОБЩИЕ СТИЛИ
   ======================================================== */
:root {
    --primary-color: #2ec4b6; 
    --primary-dark: #209f93;  
    --light-green: #e6f9f7;   
    --white: #ffffff;
    --text-dark: #2b2d42;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent; /* Убирает синий блик при тапе на мобилках */
}

body {
    color: var(--text-dark);
    background-color: var(--white);
    line-height: 1.5;
}

.container {
    width: 90%;
    max-width: 1140px;
    margin: 0 auto;
}

/* Заголовки */
.section-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 2.5rem;
    font-weight: 700;
}
.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 4px;
    background-color: var(--primary-color);
    margin: 8px auto 0;
    border-radius: 2px;
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 1rem;
    border: none;
}
.btn-primary { background-color: var(--primary-color); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-dark); }
.btn-secondary { background-color: var(--light-green); color: var(--primary-dark); }
.btn-outline { border: 2px solid var(--primary-color); color: var(--primary-color); background: transparent; }
.btn-outline:hover { background-color: var(--primary-color); color: var(--white); }

/* ========================================================
   2. ШАПКА САЙТА (ОПТИМИЗИРОВАННАЯ ДЕСКТОП ВЕРСИЯ)
   ======================================================== */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    gap: 15px; /* Безопасное расстояние между блоками */
}
.logo { 
    font-size: 1.4rem; 
    font-weight: 800; 
    white-space: nowrap; /* Логотип не переносится */
}
.logo i, .logo span { color: var(--primary-color); }

nav ul { 
    display: flex; 
    list-style: none; 
    gap: 20px; /* Управление отступами без деформации строки */
}
nav ul li { margin: 0; }
nav ul li a { 
    text-decoration: none; 
    color: var(--text-dark); 
    font-weight: 500; 
    transition: color 0.2s; 
    white-space: nowrap; /* Ссылки всегда в одну линию */
    font-size: 0.95rem; 
}
nav ul li a:hover { color: var(--primary-color); }

.header-contacts { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    white-space: nowrap;
}
.phone { text-decoration: none; color: var(--text-dark); font-weight: 700; font-size: 0.95rem; }
.menu-toggle { display: none; }

/* Настройки для небольших экранов ноутбуков (до перехода на планшет) */
@media (max-width: 1100px) and (min-width: 769px) {
    nav ul { gap: 12px; }
    .header-contacts { gap: 10px; }
    .header-contacts .phone { display: none; } /* Скрываем телефон, оставляем только кнопку */
}

/* ========================================================
   3. ОСНОВНЫЕ БЛОКИ И СЕКЦИИ
   ======================================================== */
.hero { background: linear-gradient(135deg, var(--white) 50%, var(--light-green) 100%); padding: 80px 0; }
.hero-container { display: flex; align-items: center; gap: 40px; }
.hero-content { flex: 1; }
.hero-content h1 { font-size: 3rem; line-height: 1.2; margin-bottom: 20px; font-weight: 800; }
.hero-content h1 span { color: var(--primary-color); }
.hero-content p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 30px; }
.hero-buttons { display: flex; gap: 15px; }
.hero-image { flex: 1; display: flex; justify-content: center; }
.image-placeholder { width: 350px; height: 350px; background-color: var(--white); border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; box-shadow: 0 15px 30px rgba(46, 196, 182, 0.15); display: flex; align-items: center; justify-content: center; font-size: 6rem; color: var(--primary-color); }

.about { padding: 80px 0; }
.about-grid { display: flex; gap: 40px; align-items: center; }
.about-text { flex: 1; }
.about-text p { margin-bottom: 15px; color: var(--text-light); }
.about-stats { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.stat-item { background-color: var(--bg-light); border-bottom: 4px solid var(--primary-color); padding: 20px 10px; text-align: center; border-radius: 8px; }
.stat-item h3 { font-size: 2rem; color: var(--primary-color); }

.services { background-color: var(--bg-light); padding: 80px 0; }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.service-card { background-color: var(--white); padding: 30px 20px; border-radius: 12px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s; }
.service-card:hover { transform: translateY(-5px); }
.service-card i { font-size: 2.2rem; color: var(--primary-color); margin-bottom: 15px; }

/* ========================================================
   4. РАЗДЕЛ "ВРАЧИ"
   ======================================================== */
.doctors {
    padding: 80px 0;
    background-color: var(--white);
}
.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}
.doctor-card {
    background-color: var(--bg-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.doctor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(46, 196, 182, 0.15);
}
.doc-image-box {
    background: linear-gradient(180deg, var(--white) 0%, var(--light-green) 100%);
    height: 320px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.doc-image-box img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.doctor-card:hover .doc-image-box img {
    transform: scale(1.03);
}
.doc-img-fallback::before {
    content: "\f0f0";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 5rem;
    color: var(--primary-color);
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
}
.doc-info {
    padding: 25px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.doc-spec {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}
.doc-info h3 {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}
.doc-exp {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 20px;
}
.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* ========================================================
   5. ФОРМА, КОНТАКТЫ И ПОДВАЛ
   ======================================================== */
.appointment { padding: 60px 0; background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)); color: var(--white); }
.appointment-wrapper { display: flex; justify-content: space-between; align-items: center; gap: 40px; }
.appointment-info { flex: 1; }
.appointment-form { flex: 1; display: flex; flex-direction: column; gap: 15px; background: var(--white); padding: 30px; border-radius: 16px; }
.appointment-form input { padding: 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 1rem; }

.contacts { padding: 80px 0; }
.contacts-grid { display: flex; gap: 40px; }
.contact-info { flex: 1; display: flex; flex-direction: column; gap: 20px; justify-content: center; }
.contact-item { display: flex; align-items: center; gap: 15px; font-size: 1.1rem; }
.contact-item i { color: var(--primary-color); font-size: 1.4rem; }
.contact-item a:hover { color: var(--primary-color) !important; }

.map { flex: 1; }
.map-placeholder { height: 250px; background-color: var(--bg-light); border: 2px dashed var(--primary-color); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-light); gap: 10px; }

footer { background-color: var(--text-dark); color: var(--white); padding: 25px 0; text-align: center; font-size: 0.9rem; }
.mobile-action-bar { display: none; }

/* ========================================================
   6. АДАПТАЦИЯ ДЛЯ IPAD / ПЛАНШЕТОВ (769px - 1024px)
   ======================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container { width: 92%; }
    .header-container { padding: 15px 0; }
    nav ul li { margin: 0 12px; }
    .header-contacts { gap: 0; }
    .header-contacts .phone { display: none; }
    .header-contacts .btn { padding: 10px 20px; font-size: 0.9rem; }

    .hero { padding: 60px 0; }
    .hero-container { gap: 20px; }
    .hero-content h1 { font-size: 2.4rem; }
    .image-placeholder { width: 280px; height: 280px; font-size: 4.5rem; }

    .about { padding: 60px 0; }
    .about-grid { gap: 25px; }
    .about-stats { gap: 10px; }
    .stat-item { padding: 15px 5px; }
    .stat-item h3 { font-size: 1.8rem; }

    .services { padding: 60px 0; }
    .services-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }

    .appointment { padding: 5px 0; }
    .appointment-wrapper { gap: 30px; }
    .appointment-info h2 { font-size: 1.8rem; }
    .appointment-form { padding: 25px; }

    .contacts { padding: 60px 0; }
    .contacts-grid { gap: 25px; }
    .map-placeholder { height: 250px; }

    body { padding-bottom: 75px; }
    .mobile-action-bar { display: flex; height: 70px; }
    .action-item i { font-size: 1.4rem; }
    .action-item span { font-size: 0.85rem; }
}

/* ========================================================
   7. АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ (до 768px)
   ======================================================== */
@media (max-width: 768px) {
    body { padding-bottom: 70px; }
    .section-title { font-size: 1.8rem; margin-bottom: 1.8rem; }

    /* Мобильное меню */
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-dark);
        cursor: pointer;
        z-index: 1001;
    }

    nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--white);
        transition: left 0.3s ease-in-out;
        box-shadow: 0 10px 15px rgba(0,0,0,0.05);
    }
    nav.active { left: 0; }
    nav ul { flex-direction: column; align-items: center; padding-top: 40px; }
    nav ul li { margin: 20px 0; }
    nav ul li a { font-size: 1.3rem; font-weight: 600; }

    .header-contacts { display: none; }

    /* Hero мобильный */
    .hero { padding: 40px 0; text-align: center; }
    .hero-container { flex-direction: column; gap: 20px; }
    .hero-content h1 { font-size: 2rem; }
    .hero-content p { font-size: 1rem; margin-bottom: 20px; }
    .hero-buttons { flex-direction: column; gap: 10px; }
    .hero-buttons .btn { width: 100%; }
    .hero-image { order: -1; }
    .image-placeholder { width: 200px; height: 200px; font-size: 4rem; }

    /* О нас мобильный */
    .about { padding: 40px 0; text-align: center; }
    .about-grid { flex-direction: column; gap: 25px; }
    .about-stats { width: 100%; gap: 10px; }
    .stat-item { padding: 15px 5px; }
    .stat-item h3 { font-size: 1.6rem; }
    .stat-item p { font-size: 0.85rem; }

    /* Услуги мобильный */
    .services { padding: 40px 0; }
    .services-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .service-card { padding: 20px 10px; border-radius: 8px; }
    .service-card i { font-size: 1.8rem; margin-bottom: 10px; }
    .service-card h3 { font-size: 1.1rem; margin-bottom: 5px; }
    .service-card p { font-size: 0.8rem; line-height: 1.3; }

    /* Врачи мобильный */
    .doctors { padding: 40px 0; }
    .doctors-grid { grid-template-columns: 1fr; gap: 20px; }
    .doc-image-box { height: 280px; }

    /* Форма и контакты мобильный */
    .appointment { padding: 40px 0; text-align: center; }
    .appointment-wrapper { flex-direction: column; gap: 20px; }
    .appointment-info h2 { font-size: 1.6rem; }
    .appointment-form { padding: 20px; width: 100%; border-radius: 12px; }
    .contacts { padding: 40px 0; }
    .contacts-grid { flex-direction: column; gap: 25px; }
    .contact-item { font-size: 1rem; }

    /* Панель действий мобильная */
    .mobile-action-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background-color: var(--white);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding: 5px 0;
    }
    .action-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-light);
        font-size: 0.75rem;
        font-weight: 600;
        transition: color 0.2s;
        flex: 1;
    }
    .action-item i { font-size: 1.2rem; margin-bottom: 3px; }
    .action-item:active { color: var(--primary-color); }
    .action-item.special { color: var(--primary-color); }
    .action-item.special i {
        background-color: var(--primary-color);
        color: var(--white);
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        margin-bottom: -2px;
        box-shadow: 0 4px 10px rgba(46, 196, 182, 0.3);
    }
    .action-item.instagram-action:active i { color: #e1306c; }
}

/* Дополнительные мини-экраны (до 375px) */
@media (max-width: 375px) {
    .services-grid { grid-template-columns: 1fr; }
}