/* =====================================================
   GOOGLE FONTS — рукописный шрифт
===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap');

/* =====================================================
   ОБЁРТКА
===================================================== */
.msc-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    max-width: 1200px;
    margin: 20px auto;
}

.msc-left,
.msc-right {
    flex: 1;
}

.msc-right {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =====================================================
   КАЛЬКУЛЯТОР
===================================================== */
.msc-calculator {
    position: relative; /* важно для кнопки "Инструкция" */
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 10px;
}

.msc-calculator h2 {
    margin-bottom: 10px;
}

.msc-calculator label,
.msc-calculator h3 {
    display: block;
    margin: 10px 0 5px;
}

.msc-calculator input,
.msc-calculator select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

/* =====================================================
   КНОПКА РАСЧЁТА
===================================================== */
.msc-calculator button {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.msc-calculator button:hover {
    background-color: #218838;
}

.msc-calculator button:active {
    transform: scale(0.98);
}

.msc-calculator button:focus,
.msc-calculator button:focus-visible {
    outline: none;
    box-shadow: none;
}

/* =====================================================
   ТУМБЛЕР РЕЖИМА РАСЧЁТА
===================================================== */
.msc-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.toggle-label {
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: #28a745;
}

.toggle-label.inactive {
    color: #aaa;
}

.toggle-switch {
    position: relative;
    width: 120px;
    height: 32px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-circle {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 30px;
    height: 30px;
    background: #28a745;
    border-radius: 50%;
    transition: left 0.3s ease;
}

/* =====================================================
   ГРУЗОВИК
===================================================== */
.truck-box {
    width: 100%;
    position: relative;
}

.truck-base {
    width: 100%;
    height: auto;
}

.overload-message {
    margin-top: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #c00;
}

/* =====================================================
   КАРТА
===================================================== */
#map {
    width: 100%;
    height: 600px;
    margin-top: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* Заголовок карты (скролл на мобильных) */
#mapHeader {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

/* =====================================================
   FULLSCREEN КАРТА
===================================================== */
/* Полноэкранный режим карты через перемещение в body */
.map-fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

body.map-fullscreen-active {
    overflow: hidden;
}

/* Мобильная кнопка "Свернуть" (снизу по центру) */
.collapse-map-btn {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
}

/* Показываем кнопку только в полноэкранном режиме карты */
.map-fullscreen-mode .collapse-map-btn {
    display: block;
}





/* =====================================================
   АДАПТИВ
===================================================== */
@media (max-width: 768px) {

    .msc-wrapper {
        flex-direction: column;
        gap: 20px;
        max-width: 100%;
        margin: 10px;
    }

    .msc-left,
    .msc-right {
        width: 100%;
    }

    #map {
        height: 400px;
    }
}

/* =====================================================
   LEAFLET — скрытие атрибуции SVG/IMG
===================================================== */
.leaflet-control-attribution img,
.leaflet-control-attribution svg {
    display: none !important;
}

/* =====================================================
   MODAL
===================================================== */
.msc-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.msc-modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    max-width: 350px;
    width: 90%;
    text-align: center;
    animation: fadeIn 0.2s ease;
}

.msc-modal-content button {
    margin-top: 15px;
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    background: #28a745;
    color: #fff;
    cursor: pointer;
}

@keyframes fadeIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ================= КАСТОМНЫЙ POPUP ================= */
.leaflet-popup-content-wrapper {
    background: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
    padding: 10px !important;
}

.leaflet-popup-content {
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
}

.leaflet-popup-tip {
    background: #fff !important;
}

/* =====================================================
   ИНСТРУКЦИЯ К КАЛЬКУЛЯТОРУ
===================================================== */
/* ================= GUIDE 2.5 ================= */

/* Кнопка "Инструкция" внутри калькулятора */
.msc-calculator .msc-guide-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-family: 'Caveat', cursive;
    font-size: 28px;
    color: #d10000;
    cursor: pointer;
    transform: rotate(-5deg);
    z-index: 10; /* меньше, чтобы не перекрывать меню */
    user-select: none;
}

/* Затемнённый фон при инструкции */
.msc-guide-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
}

/* Подсветка элемента */
.msc-guide-highlight {
    position: absolute;
    box-shadow: 0 0 0 4px #fff, 0 0 25px rgba(255,255,255,0.9);
    border-radius: 8px;
    z-index: 9999;
}

/* пульсация */
.pulse {
    animation: pulseAnim 1.2s infinite;
}

@keyframes pulseAnim {
    0% { box-shadow: 0 0 0 4px #fff, 0 0 25px rgba(255,255,255,0.9); }
    50% { box-shadow: 0 0 0 6px #fff, 0 0 35px rgba(255,255,255,1); }
    100% { box-shadow: 0 0 0 4px #fff, 0 0 25px rgba(255,255,255,0.9); }
}

/* Всплывающая подсказка */
.msc-guide-tooltip {
    position: absolute;
    background: #fff;
    padding: 16px;
    border-radius: 10px;
    max-width: 260px;
    font-family: sans-serif;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: fadeIn .4s ease;
}

.msc-guide-tooltip h3 {
    margin: 0 0 5px;
}

.msc-guide-tooltip button {
    margin-top: 10px;
    padding: 6px 12px;
    border: 0;
    border-radius: 6px;
    background: #28a745;
    color: #fff;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* стрелка к элементу */
.msc-guide-arrow {
    position: absolute;
    width: 0; 
    height: 0; 
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 15px solid #d10000;
    z-index: 10000;
    animation: arrowBounce 1s infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

.highlight-text {
    color: #c00; /* основной цвет текста */
    text-shadow: 0 0 5px #c00, 0 0 10px #c00, 0 0 15px #c00;
    animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
    0% { text-shadow: 0 0 5px #c00, 0 0 10px #c00, 0 0 15px #c00; }
    100% { text-shadow: 0 0 15px #ff4d4d, 0 0 30px #ff4d4d, 0 0 45px #ff4d4d; }
}


/* =====================================================
   КНОПКА РАЗВЕРНУТЬ (ДЕСКТОП)
===================================================== */


/* На мобильных кнопку развёртывания не показываем */
@media (max-width: 768px) {
    .msc-expand-map-btn {
        display: none;
    }
}

.msc-map-control-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    border: 2px solid #ffc107;
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #ffc107;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: 0.2s;
}

.msc-map-control-btn:hover {
    background: #ffc107;
    color: #1e1e1e;
    border-color: #28a745;   /* зелёная рамка при наведении */
}

body.msc-map-fullscreen {
    overflow: hidden;
    
}

/* Плавающий калькулятор – полная копия основного */
.map-fullscreen-mode .msc-fs-calculator {
    position: absolute;
    top: 12px;
    left: 55px;
    width: 320px;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 15px;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: inherit;
}

.map-fullscreen-mode .msc-fs-calculator h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.map-fullscreen-mode .msc-fs-calculator label {
    display: block;
    margin: 10px 0 5px;
    font-weight: 600;
}

.map-fullscreen-mode .msc-fs-calculator select,
.map-fullscreen-mode .msc-fs-calculator input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #fff;
}

/* Тумблер – точная копия */
.map-fullscreen-mode .msc-fs-calculator .fs-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.map-fullscreen-mode .msc-fs-calculator .fs-toggle-label {
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
}

.map-fullscreen-mode .msc-fs-calculator .fs-toggle-label.active {
    color: #28a745;
}

.map-fullscreen-mode .msc-fs-calculator .fs-toggle-label.inactive {
    color: #aaa;
}

.map-fullscreen-mode .msc-fs-calculator .fs-toggle-switch {
    position: relative;
    width: 120px;
    height: 32px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.map-fullscreen-mode .msc-fs-calculator .fs-toggle-circle {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 30px;
    height: 30px;
    background: #28a745;
    border-radius: 50%;
    transition: left 0.3s ease;
}

.map-fullscreen-mode .msc-fs-calculator .fs-result-row {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 8px;
}

.map-fullscreen-mode .msc-fs-calculator .fs-result-row div {
    margin: 5px 0;
    font-size: 14px;
}

.map-fullscreen-mode .msc-fs-calculator .fs-result-row span {
    font-weight: bold;
    color: #28a745;
}


.leaflet-popup-content button {
    background: #28a745 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 5px !important;
    padding: 8px 16px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    width: 100% !important;
    transition: 0.2s;
}
.leaflet-popup-content button:hover {
    background: #218838 !important;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.poi-marker.bouncing {
    animation: bounce 0.5s ease infinite;
}