/* ----- Базовые сбросы и переменные ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #f39c12; /* Электрик оранжевый */
    --dark-color: #2c3e50;
    --light-bg: #f8f9fa;
    --text-color: #333;
    --white: #ffffff;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

 


body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 70px 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    color: var(--dark-color);
    position: relative;
}

.section-titleh1 {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 10px;
    color: var(--dark-color);
    position: relative;
    background: var(--primary-color);
    border-radius: 30px;
}

/* --- Обертка для заголовка и кнопки --- */
.hero-cta-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px; /* Отступ до следующего заголовка "Наши услуги" */
    text-align: center;
}

/* Делаем так, чтобы заголовок не прилипал к кнопке */
.hero-cta-wrapper .section-titleh1 {
    margin-bottom: 25px; 
}

/* --- Стили для кнопки "Вызов мастера" --- */
.btn-call-master {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-color); /* Оранжевый цвет */
    color: var(--white);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 15px 40px;
    border-radius: 50px; /* Форма таблетки */
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4); /* Оранжевая тень */
    transition: var(--transition);
    animation: pulse 2s infinite; /* Легкая пульсация, чтобы привлекала внимание */
}

.btn-call-master:hover {
    background: #e67e22;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.btn-call-master i {
    font-size: 1.3rem;
}

/* Анимация пульсации */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Для мобильных телефонов делаем кнопку чуть компактнее */
@media screen and (max-width: 768px) {
    .btn-call-master {
        font-size: 1.1rem;
        padding: 12px 30px;
    }
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    margin: 15px auto 0;
    border-radius: 2px;
}

.bg-light {
    background-color: var(--light-bg);
}

/* ----- Header и Навигация ----- */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--primary-color);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 1.1rem;
    transition: var(--transition);
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link:focus {
    /* color: var(--white); */
    border-bottom-color: var(--primary-color);
}

.price-link {
    background: var(--primary-color);
    color: var(--white);
    padding: 8px 20px !important;
    border-radius: 30px;
    border-bottom: none !important;
}

.price-link:hover {
    background: #e67e22;
    color: var(--white) !important;
}

/* Бургер кнопка (скрыта по умолчанию) */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1010;
}

.burger-line {
    width: 30px;
    height: 3px;
    background: var(--dark-color);
    border-radius: 5px;
    transition: var(--transition);
}

/* ----- Услуги ----- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 30px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.service-card:hover {
    transform: translateY(-5px);
    border-bottom-color: var(--primary-color);
}

.service-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.service-card h3 {
    margin-bottom: 15px;
    color: var(--dark-color);
}

/* ----- О нас ----- */
.about-container {
    display: flex;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap;
}

.about-text {
    flex: 1 1 400px;
}

.about-image {
    flex: 1 1 400px;
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: block;
}

/* ----- Галерея ----- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    aspect-ratio: 4 / 3;
    pointer-events: auto;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item, .gallery-item img {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent; /* Убирает синюю подсветку при тапе */
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 156, 18, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    color: var(--white);
    font-size: 2rem;
    pointer-events: none;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

/* ----- Контакты и Форма ----- */
.contacts-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.contacts-info {
    flex: 1 1 300px;
}

.contact-list {
    list-style: none;
    margin-top: 20px;
}

.contact-list li {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
}

.contact-list i {
    width: 25px;
    color: var(--primary-color);
    font-size: 1.4rem;
}

.contact-list a {
    color: var(--text-color);
    text-decoration: none;
}

.social-links {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--dark-color);
    color: var(--white);
    border-radius: 50%;
    font-size: 1.5rem;
    /* transition: var(--transition); */
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* ---------- ОБНОВЛЁННЫЕ СТИЛИ ДЛЯ КОМПАКТНОЙ ФОРМЫ ---------- */
.form-container {
    flex: 2 1 400px;
    background: var(--white);
    padding: 25px; /* Уменьшено с 30px */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-container h3 {
    margin-bottom: 20px; /* Уменьшено с 25px */
    color: var(--dark-color);
    font-size: 1.6rem; /* Уменьшено с 1.8rem */
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Добавлен общий отступ между элементами */
}

.form-group {
    margin-bottom: 0; /* Убрано, так как теперь gap работает */
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px; /* Уменьшено с 15px */
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    background: var(--white);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px; /* Уменьшено с дефолтного (обычно 4 ряда ~100px) */
    max-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2);
}

.btn-submit {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 30px; /* Уменьшено с 15px */
    font-size: 1rem; /* Уменьшено с 1.1rem */
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    width: 100%;
    margin-top: 5px;
}

.btn-submit:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.form-message {
    margin-top: 10px; /* Уменьшено с 15px */
    text-align: center;
    font-weight: 500;
    min-height: 20px; /* Уменьшено с 24px */
    font-size: 0.9rem;
}

.form-message.success {
    color: #27ae60;
}

.form-message.error {
    color: #e74c3c;
}

/* ----- Прайс ----- */
.price-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.price-table th {
    background: var(--dark-color);
    color: var(--white);
    padding: 18px 20px;
    text-align: left;
    font-size: 1.2rem;
}

.price-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.price-table tr:last-child td {
    border-bottom: none;
}

.price-table tbody tr:hover {
    background-color: #fff8e7;
}

.price-note {
    margin-top: 20px;
    font-style: italic;
    color: #666;
    text-align: right;
}

/* ----- Футер ----- */
.footer {
    background: var(--dark-color);
    color: var(--white);
    text-align: center;
    padding: 25px 0;
}

/* ----- АДАПТИВНОСТЬ (Мобильная версия) ----- */
@media screen and (max-width: 768px) {
    .section-title {
        font-size: 2rem;
        margin-bottom: 20px;
    }

    .burger-btn {
        display: flex;
    }

    /* Навигация превращается в мобильное меню */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 350px;
        height: 100vh;
        background: var(--white);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        padding: 100px 30px 30px;
        transition: right 0.3s ease-in-out;
        z-index: 1000;
    }

    .nav.active {
        right: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }

    .nav-link {
        font-size: 1.3rem;
        display: block;
        padding: 10px 0;
    }

    .price-link {
        display: inline-block;
        margin-top: 10px;
    }

    /* Анимация бургера в крестик */
    .burger-btn.active .burger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .burger-btn.active .burger-line:nth-child(2) {
        opacity: 0;
    }

    .burger-btn.active .burger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Уменьшаем отступы */
    .section {
        padding: 20px 0;
    }

    .header-container {
        height: 70px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .about-container {
        gap: 30px;
    }

    .contacts-wrapper {
        gap: 30px;
    }

    /* ---------- ДОПОЛНИТЕЛЬНОЕ СЖАТИЕ ФОРМЫ НА МОБИЛЬНЫХ ---------- */
    .form-container {
        padding: 20px 15px; /* Ещё меньше по бокам и сверху/снизу */
    }

    .form-container h3 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .contact-form {
        gap: 12px; /* Меньше расстояние между полями */
    }

    .form-group input,
    .form-group textarea {
        padding: 10px 12px; /* Компактные поля ввода */
        font-size: 16px; /* Предотвращает зум на iOS при фокусе */
    }

    .form-group textarea {
        min-height: 70px; /* Ещё меньше высота textarea */
    }

    .btn-submit {
        padding: 12px 20px;
        margin-top: 0;
    }

    /* Делаем блок контактов тоже компактнее, чтобы форма не давила */
    .contacts-info .section-title {
        margin-bottom: 10px;
    }

    .contact-list li {
        margin-bottom: 12px;
        font-size: 1rem;
    }

    .contact-list i {
        font-size: 1.2rem;
    }

    .social-links {
        margin-top: 15px;
    }

    .social-links a {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
    .section-titleh1 {
        line-height: 1.2;
        font-size: 30px;
    }
    
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section {
        padding: 8px 0;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    /* Финальная оптимизация формы для самых маленьких экранов */
    .form-container {
        padding: 18px 12px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px;
    }

    .price-table th,
    .price-table td {
        padding: 12px 10px;
        font-size: 0.9rem;
    }

    .service-card {
        padding: 8px 15px;
    }

    /* Убираем лишние отступы у секции контактов */
    #contacts.section {
        padding-top: 30px;
        padding-bottom: 40px;
    }

    .contacts-wrapper {
        gap: 15px;
    }
}

/* Исправление для очень маленьких высот экрана (например, iPhone SE в альбомной) */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .form-container {
        padding: 12px 15px;
    }

    .form-container h3 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .contact-form {
        gap: 8px;
    }

    .form-group textarea {
        min-height: 50px;
    }

    .btn-submit {
        padding: 8px 20px;
    }
}


/* ----- Стили для кастомной иконки Max ----- */
.max-link .max-icon {
    width: 28px;  /* Чуть больше, чтобы соответствовать размеру иконки VK */
    height: 28px;
    vertical-align: middle;
    transition: var(--transition);
}

.max-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* При наведении меняем цвет фона и иконки */
.social-links .vk-link:hover {
    background: #0077ff; /* Синий ВК */
    color: white;
}

.social-links .max-link:hover {
    background: #0033cc; /* Фирменный синий Max */
    color: white;
}

.social-links .max-link:hover .max-icon {
    transform: scale(1.1);
}

@media screen and (max-width: 1040px) {
    .nav-list {
    display: flex;
    justify-content:center;
    align-items: center;
    gap: 10px;    
}

.nav-list .nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.logo {
    font-size: 1.6rem;
}
}

@media screen and (max-width: 835px) {
    .logo {
    font-size: 1.1rem;
}
}

/* Стили для сообщений формы */
.form-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.form-message.loading {
    display: block;
    background: #f0f0f0;
    color: #666;
}

.form-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Стили для модального окна галереи --- */
.image-modal {
    display: none; /* По умолчанию скрыто */
    position: fixed;
    z-index: 9999; /* Поверх всей шапки и меню */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Темный фон */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-out; /* Курсор в виде лупы с минусом */
}

/* Класс для показа окна */
.image-modal.show {
    display: flex;
    opacity: 1;
}

/* Сама увеличенная картинка */
.modal-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transform: scale(0.8); /* Начальный размер для анимации */
    transition: transform 0.3s ease;
    object-fit: contain;
    cursor: default;
}

/* Анимация увеличения картинки */
.image-modal.show .modal-content {
    transform: scale(1);
}

/* Кнопка закрытия (крестик) */
.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #f0c040; /* Твой фирменный цвет */
}