/* ============================================================
   ПЕСКОВОЗ.РФ — СТРУКТУРИРОВАННЫЕ СТИЛИ v2
   ============================================================ */

/* --- 1. ПЕРЕМЕННЫЕ --- */
:root {
    --primary: #E8B56B;
    --primary-dark: #D49A4E;
    --secondary: #3A7D5F;
    --dark: #2A2A2A;
    --light: #F8F5F0;
    --gray: #7D7D7D;
    --telegram: #0088CC;
    --sand: #E8D2B0;
}

/* --- 2. БАЗОВЫЕ СТИЛИ --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Roboto', sans-serif;
    color: var(--dark);
    line-height: 1.6;
    background-color: var(--light);
    overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: 'Montserrat', sans-serif; font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }

/* --- 3. КНОПКИ --- */
.btn {
    display: inline-block; padding: 14px 28px; border-radius: 4px;
    font-weight: 600; text-align: center; cursor: pointer;
    transition: all 0.3s ease; border: none;
    font-family: 'Montserrat', sans-serif; font-size: 1rem;
}
.btn-primary { background-color: var(--primary); color: white; box-shadow: 0 4px 12px rgba(232,181,107,0.3); }
.btn-primary:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(232,181,107,0.4); }
.btn-large { padding: 16px 32px; font-size: 1.1rem; }
.btn-telegram { background-color: var(--telegram); color: white; box-shadow: 0 4px 12px rgba(0,136,204,0.3); }
.btn-telegram:hover { background-color: #0077b5; transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,136,204,0.5); }
.btn-gradient { background-color: var(--secondary); color: white; box-shadow: 0 4px 15px rgba(58,125,95,0.4); transition: all 0.3s ease; border: none; }
.btn-gradient:hover { background-color: #2e6a50; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(58,125,95,0.5); }

/* --- 4. СЕКЦИИ --- */
.section { padding: 100px 0; }
.section-title { font-size: 2.5rem; margin-bottom: 50px; text-align: center; position: relative; color: var(--dark); }
.section-title:after { content: ''; display: block; width: 100px; height: 5px; background-color: var(--primary); margin: 20px auto 0; }

/* --- 5. ШАПКА --- */
header { background-color: white; box-shadow: 0 2px 15px rgba(0,0,0,0.1); position: fixed; width: 100%; z-index: 1000; }
.header-container {
    display: flex;
    align-items: center;
    padding: 12px 20px;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--dark);
    white-space: nowrap;
    flex-shrink: 0;
}
.logo:focus-visible { outline: none; }
.logo span { color: var(--primary); }

.logo-text { display: flex; align-items: center; font-weight: 800; font-size: 1.6rem; color: var(--dark); }
.logo-text span { color: var(--primary); }

.logo-img { height: 50px; margin-left: 5px; }
.logo-plus-caption {
    font-size: 0.66rem;
    font-weight: 500;
    color: #94a3b8 !important;
    letter-spacing: 0.03em;
    line-height: 1;
    white-space: nowrap;
    position: absolute;
    top: 55px;
}

/* Основное меню — прижато вправо за счёт margin-left: auto */
.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-links li {
    margin-left: 30px;
    flex-shrink: 0;
}
.nav-links a {
    font-weight: 500;
    transition: color 0.3s;
    font-size: 1.05rem;
    white-space: nowrap;
}
.nav-links a:hover { color: var(--primary); }

/* Блок действий (телефон + кнопка заказа) — всегда справа, вне nav-links */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 25px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Двухсостоятельные элементы — по умолчанию полный вид */
.phone-text { display: inline; }
.order-icon { display: none; }

.order-text { white-space: nowrap; }

.phone {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.phone i { margin-right: 8px; }

.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--dark); cursor: pointer; }

/* --- 6. HERO --- */
.hero { position: relative; overflow: hidden; background: none; color: white; padding: 200px 0 120px; text-align: center; }
.hero-content { max-width: 900px; margin: 0 auto; }
.hero h1 { font-size: 3.5rem; margin-bottom: 20px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.3rem; margin-bottom: 40px; max-width: 700px; margin-left: auto; margin-right: auto; }
.hero-p { letter-spacing: 3px; word-spacing: 10px; }
.sliding-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: -1; }
.sliding-track { display: flex; width: 3840px; height: 100vh; animation: slide 200s linear infinite; }
.slide { width: 1275px; height: 853px auto; background-size: cover; background-position: center; background-repeat: no-repeat; background-color: #1a1a1a; }
@keyframes slide { 0% { transform: translateX(0); } 100% { transform: translateX(-1280px); } }
.hero::after { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(0,0,0,0.4); z-index: -1; }
.stats-bar { display: flex; justify-content: center; gap: 40px; margin-bottom: 50px; flex-wrap: wrap; }
.stat-item { text-align: center; background: rgba(255,255,255,0.1); padding: 15px 25px; border-radius: 8px; backdrop-filter: blur(5px); }
.stat-number { font-size: 2.2rem; font-weight: 700; color: var(--primary); font-family: 'Montserrat', sans-serif; }
.stat-label { font-size: 1rem; margin-top: 5px; }

/* --- 7. КАЛЬКУЛЯТОР --- */
.calculator { background-color: white; border-radius: 10px; padding: 40px; margin-top: 30px; box-shadow: 0 15px 40px rgba(0,0,0,0.15); max-width: 800px; margin: 0 auto; }
.calculator h3 { color: var(--dark); margin-bottom: 25px; font-size: 1.7rem; text-align: center; }
.form-group { margin-bottom: 25px; text-align: left; }
.form-group label { display: block; margin-bottom: 10px; font-weight: 500; color: var(--dark); font-size: 1.05rem; }
.form-control { width: 100%; min-height: 50px; padding: 15px 20px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; transition: all 0.3s; background-color: #f9f9f9; color: var(--dark); }
.form-control:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(232,181,107,0.2); background-color: white; }
.form-control.is-invalid { border-color: #dc3545; }
.form-control:disabled { background-color: #e9ecef; opacity: 1; }
.form-row { display: flex; gap: 25px; }
.form-row .form-group { flex: 1; }
select.form-control { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%232a2a2a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; background-size: 12px; padding-right: 35px; }
.result { margin-top: 25px; padding: 20px; background-color: #f9f9f9; border-radius: 6px; display: none; border-left: 4px solid var(--primary); }
.result.active { display: block; animation: fadeIn 0.5s ease; }
.result.ready { border-left: 4px solid #10b981; margin-top: 0px; }
.price { font-size: 1.8rem; font-weight: 800; color: var(--primary); display: block; margin: 10px 0; }
.price_p { color: #464646; }
.price_p_u { margin-bottom: 25px!Important; margin-top: 10px; }
.price_p_d { margin-bottom: 40px!Important; margin-top: 25px; }
.guarantee-badge { display: inline-flex; align-items: center; background: rgba(90,143,123,0.1); color: var(--secondary); padding: 8px 15px; border-radius: 30px; font-size: 0.9rem; margin-top: 15px; font-weight: 500; }
.guarantee-badge i { margin-right: 8px; }
.loading-spinner { display: none; margin: 10px auto; width: 40px; height: 40px; border: 4px solid rgba(0,0,0,0.1); border-radius: 50%; border-top-color: var(--primary); animation: spin 1s ease-in-out infinite; }

/* --- Плитки вариантов --- */
.variant-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.variant-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}
.variant-card--selected {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.variant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    min-height: 22px;
}
.variant-check {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.variant-check--active {
    background: #10b981;
    border-color: #10b981;
}
.variant-check-icon {
    width: 12px;
    height: 12px;
    fill: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}
.variant-check--active .variant-check-icon {
    opacity: 1;
}
.variant-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.variant-badge--recommended {
    background: #10b981;
    color: #fff;
}
.variant-badge--alt {
    background: #f1f5f9;
    color: #475569;
}
.variant-name {
    font-weight: 600;
    font-size: 0.9rem!Important;
    color: #1e293b;
    margin: 0 0 6px 0;
    line-height: 1.3;
    margin-bottom: 20px!Important;
}
.variant-price {
    font-size: 1.05rem!Important;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px 0;
    margin-bottom: 20px!Important;
}
.variant-desc {
    font-size: 0.72rem!Important;
    color: #94a3b8;
    margin: 0;
    line-height: 1.3;
}
.variant-hint {
    font-size: 0.75rem!Important;
    color: #64748b;
    margin: 4px 0;
    line-height: 1.3;
    font-style: italic;
    margin-bottom: 20px!Important;
}
.variant-cards-grid--single .variant-card {
    cursor: default;
    border-color: #e2e8f0;
}
.variant-cards-grid--single .variant-card:hover {
    border-color: #e2e8f0;
}
.variant-reason {
    font-size: 0.7rem!Important;
    color: #94a3b8;
    margin: 4px 0 0;
    line-height: 1.3;
}
.variant-card--unavailable {
    opacity: 0.5;
    cursor: default;
    border-style: dashed;
}
.variant-card--unavailable:hover {
    border-color: #e2e8f0;
    box-shadow: none;
}
.variant-badge--unavailable {
    background: #f1f5f9;
    color: #94a3b8;
}
@media (max-width: 576px) {
    .variant-cards-grid {
        grid-template-columns: 1fr;
    }
    .price_p_u {
        margin-bottom: 20px!Important;
    }
    .price_p_d {
        margin-bottom: 40px!Important;
        margin-top: 20px;
    }
}
#price-details {
    margin-bottom: 40px;
}

/* --- 8. УВЕДОМЛЕНИЯ --- */
.global-toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100000; display: flex; flex-direction: column; gap: 10px; max-width: 350px; }
.global-toast { background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); overflow: hidden; animation: slideIn 0.3s ease; }
.global-toast-header { padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.global-toast-body { padding: 10px 12px; font-size: 14px; color: #374151; border-top: 1px solid #e5e7eb; }
.global-toast.success .global-toast-header { background-color: #10b981; color: white; }
.global-toast.error .global-toast-header { background-color: #ef4444; color: white; }
.global-toast.warning .global-toast-header { background-color: #f59e0b; color: white; }
.global-toast.info .global-toast-header { background-color: #3b82f6; color: white; }
.close-toast { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; opacity: 0.7; }
.close-toast:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- 9. КНОПКА ЗАКАЗА (СОСТОЯНИЯ) --- */
#order-btn.success-state { background: linear-gradient(135deg, #10b981, #059669); border: none; color: white; font-weight: 600; letter-spacing: 0.5px; box-shadow: 0 4px 15px rgba(16,185,129,0.3); transition: all 0.3s ease; }
#order-btn .success-icon { font-size: 1.2rem; margin-right: 5px; }
#order-btn .success-text { font-size: 0.9rem; }
.order-success-inline { margin-top: 15px; padding: 10px 15px; background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); border-radius: 10px; font-size: 0.9rem; color: #059669; }
.order-success-inline i { margin-right: 6px; }
.alert-success { background: linear-gradient(135deg, #10b981, #059669); color: white; border: none; border-radius: 16px; padding: 1.5rem; }
.alert-success h4 { color: white; font-weight: 600; }
.alert-success .text-muted { color: rgba(255,255,255,0.8) !important; }
.alert-success hr { border-color: rgba(255,255,255,0.2); }

/* --- 10. ПРЕИМУЩЕСТВА --- */
.features { background-color: white; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 35px; margin-top: 40px; }
.feature-card { text-align: center; padding: 40px 25px; border-radius: 10px; transition: all 0.4s ease; background-color: var(--light); border: 1px solid rgba(0,0,0,0.05); position: relative; overflow: hidden; }
.feature-card:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background-color: var(--primary); transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease; }
.feature-card:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0,0,0,0.1); }
.feature-card:hover:before { transform: scaleX(1); }
.feature-icon { font-size: 3rem; color: var(--primary); margin-bottom: 25px; }
.feature-card h3 { margin-bottom: 20px; font-size: 1.4rem; }

/* --- 11. МАТЕРИАЛЫ --- */
.materials { background-color: var(--light); position: relative; overflow: hidden; }
.materials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; margin-top: 40px; }
.material-card { background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: all 0.3s ease; display: flex; flex-direction: column; }
.material-card:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0,0,0,0.1); }
.material-link { height: 150px; background-size: cover; background-position: center; }
.material-image { height: 150px; background-size: cover; background-position: center; background-repeat: no-repeat; background-size: cover; }
.material-content { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
.material-content h3 { font-size: 1.4rem; margin-bottom: 10px; }
.price-tag { font-size: 1.4rem; color: var(--primary); font-weight: 700; margin: 10px 0; }
.material-content .btn { margin-top: auto; }

/* --- 12. ГАРАНТИИ --- */
.guarantee-section { background: linear-gradient(to right, var(--secondary), #2e6a50); color: white; padding: 60px 0; text-align: center; }
.guarantee-content { max-width: 1200px; margin: 0 auto; }
.guarantee-section h2 { font-size: 2.5rem; margin-bottom: 30px; }
.guarantee-subtitle { color: #fff; font-size: 1.2rem; margin-bottom: 40px; }
.guarantee-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; }
.guarantee-card { background: white; border-radius: 10px; padding: 30px 25px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); flex: 1; min-width: 250px; max-width: 350px; transition: transform 0.3s ease; }
.guarantee-card:hover { transform: translateY(-5px); }
.guarantee-icon { font-size: 2.5rem; color: #4a6bff; margin-bottom: 20px; }
.guarantee-card h3 { font-size: 1.3rem; margin-bottom: 15px; color: #333; }
.guarantee-card p { color: #666; line-height: 1.5; }

/* --- 13. КОНТАКТЫ --- */
.contact { background-color: var(--light); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 35px; margin-top: 40px; }
.contact-card { background-color: white; padding: 40px 30px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); text-align: center; transition: transform 0.3s ease; }
.contact-card:hover { transform: translateY(-5px); }
.contact-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 25px; }
.contact-card h3 { margin-bottom: 20px; font-size: 1.4rem; }

/* --- 14. ФУТЕР --- */
footer { background-color: var(--dark); color: white; padding: 70px 0 30px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 50px; }
.footer-column h3 { color: var(--primary); margin-bottom: 25px; font-size: 1.3rem; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { transition: color 0.3s; display: block; padding: 5px 0; }
.footer-links a:hover { color: var(--primary); }
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-links a { display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; background-color: rgba(255,255,255,0.1); border-radius: 50%; transition: all 0.3s; font-size: 1.2rem; }
.social-links a:hover { background-color: var(--primary); transform: translateY(-3px); }
.copyright { text-align: center; padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.95rem; color: rgba(255,255,255,0.7); }

/* --- 15. АДРЕСНЫЕ ПОДСКАЗКИ --- */
.suggestions-wrapper { position: relative; width: 100%; display: block; }
.suggestions-suggestions { position: absolute !important; width: 100% !important; background: white !important; color: #333 !important; border: 1px solid #ddd !important; border-radius: 6px !important; box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important; z-index: 1000 !important; margin-top: 5px !important; overflow: hidden; max-height: 300px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.suggestions-suggestion { padding: 10px 15px !important; color: #333 !important; cursor: pointer; transition: background 0.2s; }
.suggestions-suggestion:hover { background-color: #f8f9fa !important; }
.suggestions-promo, .suggestions-suggestion a[href*="dadata.ru"] { display: none !important; }

/* --- 16. АНИМАЦИИ --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 17. NO-COPY --- */
.no-copy { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }


/* ============================================================
   --- 20. MOBILE ACTION BAR ---
   Базовая позиция — СНИЗУ (display: none на десктопе).
   Переключение: MOBILE_BAR_CONFIG в calculator.js
     position: 'top'    → бар под шапкой (74px от верха)
     position: 'bottom' → бар прижат к низу
   Модификаторы на <body>:
     .mobile-bar-position-top    — бар вверху
     .mobile-bar-position-bottom — бар внизу (по умолчанию)
     .mobile-bar-sticky          — слайд-анимация скрытия при скролле
   ============================================================ */

.mobile-action-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    z-index: 950;
    background: #fff;
    gap: 10px;
    /* Базовая позиция — снизу */
    bottom: 0;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Модификатор: бар вверху (под шапкой) */
body.mobile-bar-position-top .mobile-action-bar {
    top: 74px;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    padding: 8px 12px;
}

.mobile-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 16px;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.mobile-action-btn:active { transform: scale(0.97); }
.mobile-action-btn--call {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.mobile-action-btn--order {
    background: var(--primary);
    color: #fff;
    border: 1.5px solid var(--primary);
    box-shadow: 0 4px 12px rgba(232, 181, 107, 0.35);
}

/* Sticky-hide: слайд вверх/вниз, только если включён body.mobile-bar-sticky */
body.mobile-bar-sticky.mobile-bar-position-top .mobile-action-bar.is-hidden {
    transform: translateY(-100%);
}
body.mobile-bar-sticky.mobile-bar-position-bottom .mobile-action-bar.is-hidden {
    transform: translateY(100%);
}


/* ============================================================
   --- 18. АДАПТАЦИЯ ШАПКИ (5 ЭТАПОВ) ---
   Этап 1: ≥1191         — всё развёрнуто
   Этап 2: 1190–1086     — скрыт «Расчёт материала»
   Этап 3: 1085–941      — телефон → круглая контурная иконка
   Этап 4: 940–577       — бургер слева, кнопка заказа → квадратная иконка
   Этап 5: ≤576          — бургер справа, bottom action bar
   ============================================================ */

/* --- 18.1. ЭТАП 2: скрыть «Расчёт материала» --- */
@media (max-width: 1190px) {
    .nav-item-calc { display: none !important; }
}

/* --- 18.2. Управление видимостью --- */
.desktop-hidden {
    display: none !important;
}
.desktop-only {
    display: flex !important;
}
.mobile-only {
    display: none !important;
}
.item-desktop { display: inline !important; }
.item-mobile { display: none !important; }

/* --- 18.3. ЭТАП 3: телефон → круглая контурная иконка --- */
@media (max-width: 1085px) and (min-width: 941px) {
    .header-actions .phone-text { display: none; }
    .header-actions .phone {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 53px;
        height: 53px;
        padding: 0;
        border-radius: 10px;                      /* квадрат со скруглением, как у кнопки заказа */
        border: 1.5px solid var(--primary);
        color: var(--primary);
        background: transparent;
        font-size: 1.05rem;
        transition: background .15s ease, color .15s ease, border-color .15s ease;
    }
    .header-actions .phone i { margin-right: 0; }
    .header-actions .phone:hover {
        background: var(--secondary);
        color: #fff;
        border-color: var(--secondary);
    }
}

/* --- 18.4. ЭТАП 4: бургер слева, кнопка заказа → квадратная иконка --- */
@media (max-width: 940px) {
    .section { padding: 80px 0; }
    .hero { padding: 180px 0 100px; }
    .hero h1 { font-size: 2.8rem; }
    .form-row { flex-wrap: wrap; }

    /* Бургер показываем, ставим визуально слева от лого */
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin: 0 0 0 4px;
        order: -1;
        background: none;
        border: none;
        font-size: 1.4rem;
        color: var(--dark);
        cursor: pointer;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }

    .header-container {
        justify-content: flex-start;
        gap: 8px;
    }
    .logo {
        margin-right: auto;
    }

    /* Выпадающее меню — только навигация, без телефона/заказа */
    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 20px 20px;
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        box-shadow: 0 12px 24px rgba(0,0,0,0.08);
        display: none;
        border-top: 1px solid #f1f5f9;
        z-index: 200;
        margin-left: 0;
        max-height: calc(100vh - 74px);
        max-height: calc(100dvh - 74px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .nav-links.active { display: flex; }

    .nav-links > li {
        margin-left: 0;
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }
    .nav-links > li.nav-item-contacts {
        border-bottom: 0;
    }
    .nav-links > li > a {
        display: block;
        width: 100%;
        padding: 15px 4px;
        font-size: 1rem;
        text-align: left;
    }

    /* Видимость пунктов меню */
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }

    /* Порядок пунктов */
    .nav-item-materials { order: 4; }
    .nav-item-equipment { order: 3; display: flex !important; }
    .nav-item-calc { order: 5; display: flex !important; }
    .nav-item-quantity { order: 6; }
    .nav-item-guarantee { order: 7; display: flex !important; }
    .nav-item-contacts { order: 8; display: flex !important; }

    /* Логотип чуть компактнее */
    .logo-plus {
        margin-top: -5px;
        margin-bottom: 5px;
    }
    .logo-plus-caption { top: 50px; }

    /* Этап 4a: компактный отступ между иконками */
    .header-actions { gap: 12px; margin-left: 12px; }

    /* Телефон на этом этапе — тоже иконка (наследуется из этапа 3) */
    .header-actions .phone-text { display: none; }
    .header-actions .phone {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
/*        border: 1.5px solid var(--primary);*/
        color: var(--primary);
        background: transparent;
        font-size: 2rem;
        margin-right: 25px;
    }
    .header-actions .phone i { margin-right: 0; }
    .header-actions .phone:hover {
        background: var(--secondary);
        color: #fff;
    }
}

/* --- 18.4b. ЭТАП 4b: кнопка заказа → квадратная заливная иконка --- */
@media (max-width: 600px) {
    .header-actions .order-text { display: none; }
    .header-actions .order-icon { display: inline-block; }
    .header-actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
        font-size: 1.05rem;
        background: var(--primary);
        color: #fff;
        box-shadow: 0 4px 12px rgba(232, 181, 107, 0.35);
    }
    .header-actions .btn:hover {
        background: var(--primary-dark);
        box-shadow: 0 6px 16px rgba(232, 181, 107, 0.45);
        transform: translateY(-1px);
    }

    .header-actions .phone {
        border: 1.5px solid var(--primary);
        font-size: 1.05rem;
        margin-right: unset;
    }

}

/* ============================================================
   --- 18.5. ОСТАЛЬНЫЕ АДАПТИВНЫЕ СТИЛИ ---
   ============================================================ */

@media (max-width: 768px) {
    .section-title { font-size: 2rem; }
    .hero { padding: 160px 0 100px; }
    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1.1rem; }
    .stat-number { font-size: 1.8rem; }
    .calculator { padding: 30px 20px; }
    .form-control { min-height: 44px; padding: 12px 15px; font-size: 0.95rem; }
    select.form-control { background-position: right 12px center; padding-right: 32px; }
    .materials-grid { grid-template-columns: 1fr; }
    .material-card { flex-direction: row; align-items: center; padding: 15px; }
    .material-link { width: 100px; height: 100px; border-radius: 8px; margin-right: 20px; flex-shrink: 0; }
    .material-image { width: 100px; height: 100px; border-radius: 8px; margin-right: 20px; flex-shrink: 0; }
    .material-content { padding: 0; }
    .material-content .btn { align-self: flex-start; margin-top: 10px; }
    .guarantee-grid { flex-direction: column; align-items: center; gap: 20px; }
    .guarantee-card { width: 100%; max-width: 100%; padding: 25px 20px; }
    .suggestions-suggestions { position: absolute !important; width: 100% !important; left: 0 !important; right: 0 !important; top: 100% !important; margin-top: 5px !important; z-index: 1001 !important; }
}

@media (max-width: 620px) {
    .stats-bar { flex-direction: row !important; gap: 20px; flex-wrap: nowrap; }
    .stat-item { padding: 10px 15px; min-width: 60px; }
    .stat-label { display: none; }
    .stat-number { font-size: 1.8rem; margin-bottom: 0; }
}

/* --- 18.6. ЭТАП 5a: общие мобильные стили (≤576px) --- */
@media (max-width: 576px) {
    .section { padding: 70px 0; }
    .hero { padding: 160px 0 80px; }
    .hero h1 { font-size: 1.9rem; }
    .section-title { font-size: 1.8rem; }
    .stats-bar { flex-direction: column; gap: 15px; }
    .stat-item { width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .material-card { flex-direction: column; text-align: center; }
    .material-link { width: 100%; height: 150px; margin-right: 0; margin-bottom: 15px; }
    .material-image { width: 100%; height: 150px; margin-right: 0; margin-bottom: 15px; }
    .material-content .btn { align-self: center; }

    /* Калькулятор — шире, меньше отступов по краям */
    .calculator {
        margin-left: -18px;
        margin-right: -18px;
        padding: 20px 16px;
    }
    .calculator h3 {
        font-size: 1.05rem;
        margin-bottom: 16px;
    }
    .calculator .form-row {
        gap: 0;
    }
    .calculator .form-group {
        margin-bottom: 18px;
    }
}

/* --- 18.7. ЭТАП 5b: бургер справа, показ mobile-bar (≤500px) --- */
@media (max-width: 500px) {
    /* Бургер — вправо */
    .mobile-menu-btn {
        order: 1;
        margin: 0 0 0 auto;
    }
    .logo { margin-right: 0; }

    /* Header actions скрываем — работают через mobile-bar */
    .header-actions { display: none; }

    /* Показ бара */
    .mobile-action-bar { display: flex; }

    /* Компенсация: бар внизу → padding на body */
    body.mobile-bar-position-bottom {
        padding-bottom: calc(69px + env(safe-area-inset-bottom));
    }

    /* Компенсация: бар вверху → padding на hero */
    /* 74 (шапка) + 69 (бар) + 86 (прежний зазор до H1) ≈ 230px */
    body.mobile-bar-position-top .hero {
        padding-top: 230px;
    }
}


/* ============================================================
   --- 19. ПЛАВАЮЩИЕ МЕТКИ И ПОЛЯ КАЛЬКУЛЯТОРА ---
   ============================================================ */

.calculator .form-group.floating,
.calculator .floating-wrap {
    position: relative;
}

.calculator .form-group.floating > .form-control,
.calculator .form-group.floating .suggestions-wrapper > .form-control,
.calculator .floating-wrap > .form-control,
.calculator .floating-wrap .suggestions-wrapper > .form-control {
    padding: 26px 18px 8px;
    height: 62px;
    min-height: 62px;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background-color: #f8fafc;
    transition: border-color .18s ease,
                box-shadow .18s ease,
                background-color .18s ease;
}

.calculator .form-group.floating > .form-control:focus,
.calculator .floating-wrap > .form-control:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(232,181,107,.18);
}

.calculator .form-group.floating > .form-control:disabled,
.calculator .floating-wrap > .form-control:disabled {
    background-color: #eef1f5;
    border-color: #e5e9ef;
    color: #94a3b8;
    cursor: not-allowed;
    padding-right: 42px;
    box-shadow: none;
}

.calculator .form-group.floating:has(> input.form-control:disabled)::after,
.calculator .form-group.floating:has(> select.form-control:disabled)::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 3;
}

.calculator .form-group.floating > label,
.calculator .floating-wrap > label {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    font-size: 1rem;
    font-weight: 400;
    color: #94a3b8;
    background: transparent;
    pointer-events: none;
    transition: top .18s cubic-bezier(.4,0,.2,1),
                transform .18s cubic-bezier(.4,0,.2,1),
                font-size .18s cubic-bezier(.4,0,.2,1),
                color .18s cubic-bezier(.4,0,.2,1);
    z-index: 2;
    line-height: 1;
    white-space: nowrap;
}

.calculator .form-group.floating:focus-within > label,
.calculator .form-group.floating.has-value > label,
.calculator .form-group.floating:has(> select.form-control > option:checked:not([value=""])) > label,
.calculator .form-group.floating:has(> input.form-control:not(:placeholder-shown)) > label,
.calculator .form-group.floating:has(.suggestions-wrapper > input.form-control:not(:placeholder-shown)) > label,
.calculator .floating-wrap:focus-within > label,
.calculator .floating-wrap.has-value > label,
.calculator .form-group.floating:has(.floating-wrap > select.form-control > option:checked:not([value=""])) .floating-wrap > label,
.calculator .form-group.floating:has(.floating-wrap > input.form-control:not(:placeholder-shown)) .floating-wrap > label {
    top: 11px;
    transform: translateY(0);
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: .01em;
}

.calculator .form-group.floating > select.form-control:invalid,
.calculator .floating-wrap > select.form-control:invalid {
    color: transparent;
}
.calculator .form-group.floating > select.form-control:invalid option,
.calculator .floating-wrap > select.form-control:invalid option {
    color: var(--dark);
}

.calculator .form-group.floating > select.form-control:disabled,
.calculator .floating-wrap > select.form-control:disabled {
    background-image: none;
    background-color: #eef2f7;
    padding-right: 42px;
    cursor: default;
    color: var(--dark);
}

.calculator .floating-wrap:has(> select.form-control:disabled)::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 3;
}

.calculator .form-row {
    align-items: flex-end;
}

.calculator .purpose-mode-switch {
    display: inline-flex;
    gap: 3px;
    margin-bottom: 6px;
    background: #f1f5f9;
    border-radius: 9px;
    padding: 3px;
    width: fit-content;
    max-width: 100%;
    transition: opacity .18s ease;
}

.calculator .purpose-mode-switch.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.calculator .purpose-mode-link {
    appearance: none;
    background: transparent;
    border: none;
    font: inherit;
    min-height: 32px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.calculator .purpose-mode-link:hover {
    color: #334155;
}

.calculator .purpose-mode-link.active {
    background: #ffffff;
    color: var(--dark);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(15,23,42,.1);
}

.calculator .btn-large {
    padding: 18px 36px;
    font-size: 1.05rem;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(232,181,107,.35);
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.calculator .btn-large:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(232,181,107,.45);
}
.calculator .btn-large:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(232,181,107,.3);
}

#result.active {
    animation: resultFadeIn .35s cubic-bezier(.4,0,.2,1);
}
@keyframes resultFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .calculator .form-group.floating > .form-control,
    .calculator .form-group.floating .suggestions-wrapper > .form-control,
    .calculator .floating-wrap > .form-control,
    .calculator .floating-wrap .suggestions-wrapper > .form-control {
        padding: 24px 14px 6px;
        height: 58px;
        min-height: 58px;
    }

    .calculator .form-group.floating > label,
    .calculator .floating-wrap > label {
        left: 14px;
        font-size: 0.95rem;
    }

    .calculator .form-group.floating:focus-within > label,
    .calculator .form-group.floating.has-value > label,
    .calculator .form-group.floating:has(> select.form-control > option:checked:not([value=""])) > label,
    .calculator .form-group.floating:has(> input.form-control:not(:placeholder-shown)) > label,
    .calculator .form-group.floating:has(.suggestions-wrapper > input.form-control:not(:placeholder-shown)) > label,
    .calculator .floating-wrap:focus-within > label,
    .calculator .floating-wrap.has-value > label,
    .calculator .form-group.floating:has(.floating-wrap > select.form-control > option:checked:not([value=""])) .floating-wrap > label,
    .calculator .form-group.floating:has(.floating-wrap > input.form-control:not(:placeholder-shown)) .floating-wrap > label {
        top: 9px;
        font-size: 0.72rem;
    }
}

@media (max-width: 576px) {
    .calculator .form-row {
        align-items: stretch;
    }
    .calculator .purpose-mode-switch {
        width: 100%;
    }
    .calculator .purpose-mode-link {
        flex: 1;
        padding: 0 8px;
        min-height: 40px;
        font-size: 0.8rem;
    }
    .calculator .purpose-group {
        display: grid;
        grid-template-rows: 1fr auto;
        transition: grid-template-rows .25s cubic-bezier(.4,0,.2,1);
    }
    .calculator .purpose-group.has-hidden-switch {
        grid-template-rows: 0fr auto;
    }
    .calculator .purpose-group.has-hidden-switch .purpose-mode-switch {
        min-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        margin-bottom: 0;
    }
}

.btn.is-awaiting-phone {
    opacity: 0.85;
    cursor: pointer;
    transition: opacity .15s ease;
}
.btn.is-awaiting-phone:hover {
    opacity: 1;
}

#phone.shake {
    animation: shake 0.4s;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    caret-color: #ef4444 !important;
}
#phone.shake + label {
    color: #ef4444 !important;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}

body:has(.nav-links.active) {
    overflow: hidden;
}
body:has(.nav-links.active)::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 900;
    animation: menuOverlayIn 0.2s ease;
    pointer-events: none;
}
@keyframes menuOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ============================================================
   --- 21. HERO CTA — плавный скролл к калькулятору ---
   Показывается ТОЛЬКО на мобильном (≤500px) и только
   если в конфиге showCta !== false (класс .hero-cta-visible на body).
   На десктопе — скрыта (калькулятор и так перед глазами).
   ============================================================ */

/* По умолчанию (десктоп) — скрыта */
.hero-cta-wrap {
    display: none;
    text-align: center;
}

/* Кнопка */
.hero-cta {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 28px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;                    /* карточка, а не пилюля — кнопка стала выше */
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    max-width: 280px;                        /* страховка от переполнения на 320px */
}

.hero-cta:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

.hero-cta:active {
    background: rgba(255, 255, 255, 0.16);
}

.hero-cta-text {
    display: block;
}

.hero-cta-arrow {
    font-size: 0.95rem;
    opacity: 0.8;
    margin-top: 2px;
    animation: heroCtaBounce 1.6s ease-in-out infinite;
}

@keyframes heroCtaBounce {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.8;
    }
    50% {
        transform: translateY(5px);
        opacity: 1;
    }
}

/* Уважаем пользователей с «уменьшенной анимацией» в системе */
@media (prefers-reduced-motion: reduce) {
    .hero-cta-arrow { animation: none; }
}


/* ============================================================
   --- 21.1. МОБИЛЬНЫЙ РЕЖИМ: CTA + полный первый экран ---
   Условия:
   - ширина ≤500px (там, где работает mobile-bar)
   - body.hero-cta-visible (из конфига showCta)
   
   Логика:
   - .hero-top растягивается на высоту экрана (минус шапка/бар)
   - CTA прижимается к низу через margin-top: auto
   - калькулятор начинается ЗА нижней границей экрана
   ============================================================ */
@media (max-width: 500px) {
    body.hero-cta-visible .hero-cta-wrap {
        display: block;
    }

    /* Верхняя часть hero (h1 + p + CTA) — flex-колонка,
       чтобы CTA прижималась к низу */
    body.hero-cta-visible .hero-top {
        display: flex;
        flex-direction: column;
    }

    /* bar ВВЕРХУ: 230 (padding-top hero) + 40 (gap до calc) = 270 */
    body.hero-cta-visible.mobile-bar-position-top .hero-top {
        min-height: calc(100vh - 270px);
        min-height: calc(100dvh - 270px);
    }

    /* bar ВНИЗУ: 160 (padding-top hero) + 40 (gap до calc) = 200 */
    body.hero-cta-visible.mobile-bar-position-bottom .hero-top {
        min-height: calc(100vh - 200px);
        min-height: calc(100dvh - 200px);
    }

    /* CTA — у нижнего края hero-top */
    body.hero-cta-visible .hero-cta-wrap {
        margin-top: auto;
        margin-bottom: 0;
    }

    /* bar ВНИЗУ: сдвигаем CTA вверх */
    body.hero-cta-visible.mobile-bar-position-bottom .hero-cta-wrap {
        margin-bottom: calc(120px + env(safe-area-inset-bottom) - 20px);
    }

    /* bar ВВЕРХУ: сдвигаем CTA вверх */
    body.hero-cta-visible.mobile-bar-position-top .hero-cta-wrap {
        margin-bottom: calc(45px + env(safe-area-inset-bottom) - 20px);
    }

    /* Калькулятор — с отступом от CTA (уедет за экран) */
    body.hero-cta-visible .calculator {
        margin-top: 40px;
    }

}


/* ============================================================
   --- ЛАЙФХАЧНЫЕ СТИЛИ ---
   ============================================================ */

@media (max-width: 500px) {

    .hero-p {
        letter-spacing: unset;
        word-spacing: unset;
    }

    #calculate-btn {
        width: 100%;
    }

}

@media (max-width: 350px) {
    body { min-width: 350px; }
    body.modal-open, .modal, .fixed-top, .fixed-bottom, .sticky-top, .is-fixed { padding-right: 0 !important; margin-right: 0 !important; }
    .modal-backdrop { width: 100%; height: 100%; min-width: 350px; }
}

