/* ============================================================
   Стили страницы калькулятора доставки
   Файл: css/public_delivery_cost_calculator/delivery_cost_calculator.css
   ============================================================ */

/* Используем переменные из custom.scss */
:root {
    --gold: #d4af37;
    --gold-dark: #9e791d;
    --gold-light: #f4eac1;
    --bg: #fdfdfc;
    --card-bg: #ffffff;
    --border: #e6e4df;
    --text: #262626;
    --text-muted: #6b6b6b;
    --shadow-1: 0 6px 18px rgba(212, 175, 55, 0.06);
}

body {
    background: var(--bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Главный контент */
.main-content {
    height: calc(100vh - 70px);   /* было min-height */
    overflow: hidden;             /* было overflow: auto */
    padding: 28px;
    display: flex;
    flex-direction: column;
}

/* Карточка калькулятора - убираем анимацию смещения */
.calc-card {
    border-radius: 12px;
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    flex: 1;
    background: #fff;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Форма внутри карточки */
.calc-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 25px 30px;
    min-height: 0;
}

/* Заголовок страницы */
.page-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.page-header h1 {
    color: var(--text);
    font-weight: 700;
    font-size: 1.65rem;
    margin-left: 30px;
}

/* Кнопка "Добавить карьер" */
.btn-outline-primary {
    border-color: var(--border);
    color: #1976d2;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: #1976d2;
    border-color: #1976d2;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
}

/* Основной ряд (Карта + Параметры) - занимает всю высоту */
.calc-row {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
    max-height: 100%;
}

#deliveryForm {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Левая колонка (Карта) - растягивается по высоте */
.map-col {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.map-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-1);
}

/* Убираем hover-эффект для всех карточек параметров */
.map-card:hover,
.params-col .card:hover,
.accordion-item:hover {
    transform: none;
    box-shadow: var(--shadow-1);
}

.map-card .card-header {
    background: rgba(248, 249, 250, 0.8);
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.map-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
    min-height: 0;
}

.map-card .p-2 {
    padding: 6px 10px !important;
    background: rgba(248, 249, 250, 0.5);
    border-bottom: 1px solid var(--border);
}

/* Поле ввода адреса */
#address {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.8);
}

#address:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
    background: white;
}

/* Карта - растягивается на всю доступную высоту */
#container {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

/* Правая колонка (Параметры) */
.params-col {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;    /* ← запрещаем колонке выходить за высоту родителя */
    overflow: hidden;    /* ← обрезаем всё, что выше */
}

/* Табы */
.static-tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--card-bg);
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
    padding-top: 5px;
    border-radius: 12px 12px 0 0;
}

.static-tabs .nav-link {
    color: var(--text-muted);
    background-color: transparent;
    border: none;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.static-tabs .nav-link:hover {
    color: var(--gold-dark);
}

.static-tabs .nav-link.active {
    color: var(--gold-dark);
    font-weight: 700;
    background-color: transparent;
    border: none;
}

.static-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 3px 3px 0 0;
}

/* Область контента табов - управляется через JS, изначально без ограничений */
.tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-top: 15px;
    min-height: 0;
}

/* Карточки параметров - без hover-эффектов */
.params-col .card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow-1);
    /* Убираем transform при наведении */
}

.params-col .card-header {
    background: rgba(248, 249, 250, 0.7);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.params-col .card-body {
    padding: 15px;
}

/* Скроллируемые чекбоксы */
.scrollable-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.scrollable-checkboxes::-webkit-scrollbar {
    width: 4px;
}

.scrollable-checkboxes::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

.scrollable-checkboxes::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* Стилизация чекбоксов */
.form-check {
    padding-left: 1.8rem;
    margin-bottom: 0.4rem;
}

.form-check-input:checked {
    background-color: var(--gold);
    border-color: var(--gold);
}

.form-check-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
}

.form-check-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Аккордеоны - без hover-эффектов */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--card-bg);
    overflow: hidden;
}

.accordion-button {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 12px 15px;
    transition: all 0.3s ease;
    background: var(--card-bg);
}

.accordion-button:not(.collapsed) {
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold-dark);
    box-shadow: none;
}

.accordion-button:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.1);
}

/* Селекты и инпуты */
.form-control-sm, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.8);
}

.form-control-sm:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
    background: white;
}

/* Прогресс бар */
#progressOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
}

#progressBarContainer {
    width: 60%;
    max-width: 500px;
    z-index: 9999;
    position: relative;
}

.progress {
    height: 20px;                    /* толще */
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(
        90deg,
        var(--gold-dark) 0%,
        var(--gold) 20%,
        #f0d060 40%,
        var(--gold) 60%,
        var(--gold-dark) 80%,
        #f0d060 100%
    );
    background-size: 200% 100%;
    border-radius: 12px;
    transition: width 0.1s ease;
    animation: shimmer 2s linear infinite;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Кнопка "Поиск" */
#searchButton {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    width: 100%;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

#searchButton:hover {
    background: linear-gradient(135deg, #8b6915, var(--gold-dark));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

#searchButton:disabled {
    background: linear-gradient(135deg, #999, #666);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Индикатор лимита */
.bg-light.rounded {
    background: #f8f9fa !important;
    border: 1px solid var(--border);
    border-radius: 12px !important;
}

.badge.bg-primary {
    background: var(--gold) !important;
    font-size: 0.85rem;
    padding: 5px 12px;
    border-radius: 15px;
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, #4caf50, #66bb6a) !important;
}

.progress-bar.bg-danger {
    background: linear-gradient(90deg, #c62828, #e53935) !important;
}

/* Бейджи */
.badge-premium {
    background: var(--gold);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-outline {
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
}

/* Модальное окно */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px 25px;
}

.modal-title {
    font-weight: 700;
}

.btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 30px;
}

.modal-icon-btn {
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.modal-icon-btn:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
}

.modal-icon-btn i,
.modal-icon-btn img {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* Анимация только для карточки при загрузке */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-card {
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================================
   МЕДИА-ЗАПРОСЫ
   ============================================================ */

/* Планшеты и мобильные (до 992px) */
@media (max-width: 992px) {
    /* ===== Сбрасываем десктопные ограничения ===== */
    .main-content {
        height: auto;
        overflow: visible;
        padding: 15px;
    }

    /* calc-card перестаёт быть flex-элементом, занимающим весь экран */
    .calc-card {
        overflow: visible;
        flex: none;
    }

    /* card-body больше не растягивается и не обрезает содержимое */
    .calc-card .card-body {
        flex: none;
        overflow: visible;
        height: auto;
        padding: 15px;
    }

    /* deliveryForm тоже отключаем от flex-растяжения */
    #deliveryForm {
        flex: none;
    }

    /* Строка карта+параметры – колонка, без ограничений */
    .calc-row {
        flex-direction: column;
        gap: 15px;
        flex: none;
        min-height: 0;
        max-height: none;
    }

    /* ===== Карта – фиксированная высота, независимая от контента ===== */
    .map-col {
        min-width: 100%;
        flex: none;
        height: 50vh;          /* 50% высоты окна */
        min-height: 350px;
        max-height: 600px;
        display: flex;         /* уже было, но убедимся */
        flex-direction: column;
    }

    /* Внутренние элементы карты растягиваются внутри .map-col */
    .map-card {
        flex: 1;               /* остаётся из общих стилей */
    }
    .map-card .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    #container {
        flex: 1;
    }

    /* ===== Правая колонка – свободное течение ===== */
    .params-col {
        min-width: 100%;
        flex: none;
        max-height: none;
        overflow: visible;
    }

    .tab-content-wrapper {
        flex: none;
        max-height: none;
        overflow-y: visible;
    }

    /* Компактный заголовок карты */
    .map-card .card-header {
        padding: 8px 12px;
        font-size: 0.85rem;
        line-height: 1.2;
    }
    .map-card .p-2 {
        padding: 5px 8px !important;
    }

    .page-header {
        margin-bottom: 15px;
    }
    .page-header h1 {
        font-size: 1.5rem;
        margin-left: 0;
    }

    .accordion-button {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    .accordion-body {
        padding: 10px;
    }
}

/* Планшеты в ландшафте (768px - 992px) */
@media (min-width: 768px) and (max-width: 992px) {
    .map-col {
        min-height: 300px;
    }
}

/* Очень маленькие экраны (до 576px) */
@media (max-width: 576px) {
    .main-content {
        padding: 10px;
        height: auto;
        overflow: visible;
    }

    .calc-card .card-body {
        padding: 10px;
    }

    .calc-row {
        gap: 10px;
    }

    .map-col {
        height: 55vh;
        min-height: 250px;
    }

    .form-control-sm {
        font-size: 0.85rem;
        padding: 0.375rem 0.5rem;
    }

    .form-check {
        padding-left: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .static-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    #searchButton {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .card-header {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .card-body {
        padding: 10px;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }
}

/* Десктопы и выше - нет искусственных ограничений высоты */
@media (min-width: 993px) {
    .calc-row {
        flex: 1;
        max-height: 100%;
    }
    .params-col {
        max-height: 100%;
        overflow: hidden;
    }
    .tab-content-wrapper {
        overflow-y: auto;
        max-height: none;
    }
}