/**
 * Universal Modal Styles
 * 
 * Full featured modal: positions, animations, overlays.
 * Better than Elementor Pro ðŸ˜Ž
 * 
 * @package hello-elementor-child
 * @since 1.0.0
 */

/* ============================================
   CSS VARIABLES (can be overridden inline)
   ============================================ */
   
   /* Hide scrollbar in modal */
.hec-modal__container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.hec-modal__container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}


.hec-modal {
    --modal-overlay-color: rgba(0, 0, 0, 0.6);
    --modal-overlay-blur: 4px;
    --modal-radius: 20px;
    --modal-transition: 0.3s ease;
}

/* ============================================
   MODAL BASE
   ============================================ */

.hec-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal, 500);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4, 16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--modal-transition), visibility var(--modal-transition);
}

.hec-modal.is-open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MODAL OVERLAY
   ============================================ */

.hec-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay-color);
    backdrop-filter: blur(var(--modal-overlay-blur));
    -webkit-backdrop-filter: blur(var(--modal-overlay-blur));
    cursor: pointer;
}

/* ============================================
   MODAL CONTAINER
   ============================================ */

.hec-modal__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: calc(100vh - 62px);
    overflow-y: auto;
    transition: transform var(--modal-transition), opacity var(--modal-transition);
}

/* ============================================
   MODAL CONTENT
   ============================================ */

.hec-modal__content {
    position: relative;
    background: var(--color-bg, #ffffff);
    border-radius: var(--modal-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 100%;
}

.hec-modal__body {
    color: var(--color-text, #333);
}

/* ============================================
   MODAL SIZES
   ============================================ */

.hec-modal--small .hec-modal__container {
    max-width: 400px;
}

.hec-modal--medium .hec-modal__container {
    max-width: 560px;
}

.hec-modal--large .hec-modal__container {
    max-width: 800px;
}

.hec-modal--xlarge .hec-modal__container {
    max-width: 1000px;
}

.hec-modal--fullscreen {
    padding: 0;
}

.hec-modal--fullscreen .hec-modal__container {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
}

.hec-modal--fullscreen .hec-modal__content {
    border-radius: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hec-modal--fullscreen .hec-modal__body {
    flex: 1;
    overflow-y: auto;
}

/* ============================================
   MODAL POSITIONS
   ============================================ */

/* Center (default) */
.hec-modal--pos-center {
    align-items: center;
    justify-content: center;
}

/* Top */
.hec-modal--pos-top {
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}

/* Bottom */
.hec-modal--pos-bottom {
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0;
}

.hec-modal--pos-bottom .hec-modal__content {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Left Sidebar */
.hec-modal--pos-left {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}

.hec-modal--pos-left .hec-modal__container {
    max-width: 400px;
    height: 100%;
    max-height: 100%;
}

.hec-modal--pos-left .hec-modal__content {
    height: 100%;
    border-radius: 0;
    border-top-right-radius: var(--modal-radius);
    border-bottom-right-radius: var(--modal-radius);
}

/* Right Sidebar */
.hec-modal--pos-right {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
}

.hec-modal--pos-right .hec-modal__container {
    max-width: 400px;
    height: 100%;
    max-height: 100%;
}

.hec-modal--pos-right .hec-modal__content {
    height: 100%;
    border-radius: 0;
    border-top-left-radius: var(--modal-radius);
    border-bottom-left-radius: var(--modal-radius);
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Fade + Scale (default) */
.hec-modal--anim-fade-scale .hec-modal__container {
    transform: scale(0.95);
    opacity: 0;
}

.hec-modal--anim-fade-scale.is-open .hec-modal__container {
    transform: scale(1);
    opacity: 1;
}

/* Fade Only */
.hec-modal--anim-fade .hec-modal__container {
    opacity: 0;
}

.hec-modal--anim-fade.is-open .hec-modal__container {
    opacity: 1;
}

/* Slide Up */
.hec-modal--anim-slide-up .hec-modal__container {
    transform: translateY(50px);
    opacity: 0;
}

.hec-modal--anim-slide-up.is-open .hec-modal__container {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Down */
.hec-modal--anim-slide-down .hec-modal__container {
    transform: translateY(-50px);
    opacity: 0;
}

.hec-modal--anim-slide-down.is-open .hec-modal__container {
    transform: translateY(0);
    opacity: 1;
}

/* Slide Left */
.hec-modal--anim-slide-left .hec-modal__container {
    transform: translateX(50px);
    opacity: 0;
}

.hec-modal--anim-slide-left.is-open .hec-modal__container {
    transform: translateX(0);
    opacity: 1;
}

/* Slide Right */
.hec-modal--anim-slide-right .hec-modal__container {
    transform: translateX(-50px);
    opacity: 0;
}

.hec-modal--anim-slide-right.is-open .hec-modal__container {
    transform: translateX(0);
    opacity: 1;
}

/* Zoom */
.hec-modal--anim-zoom .hec-modal__container {
    transform: scale(0.5);
    opacity: 0;
}

.hec-modal--anim-zoom.is-open .hec-modal__container {
    transform: scale(1);
    opacity: 1;
}

/* Flip */
.hec-modal--anim-flip .hec-modal__container {
    transform: perspective(1000px) rotateX(-10deg);
    opacity: 0;
}

.hec-modal--anim-flip.is-open .hec-modal__container {
    transform: perspective(1000px) rotateX(0);
    opacity: 1;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */

.hec-modal__close {
    position: absolute;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.hec-modal__close:hover {
    background: #fff;
    color: #000;
    transform: rotate(90deg);
}

.hec-modal__close svg {
    width: 20px;
    height: 20px;
}

/* Close Inside */
.hec-modal--close-inside .hec-modal__close {
    top: 15px;
    right: 15px;
}

/* Close Outside */
.hec-modal--close-outside .hec-modal__close {
    top: -50px;
    right: 0;
    background: #fff;
}

/* Close Corner */
.hec-modal--close-corner .hec-modal__close {
    top: -12px;
    right: -12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* ============================================
   BODY SCROLL LOCK
   ============================================ */

body.hec-modal-open {
    overflow: hidden;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .hec-modal {
        padding: 10px;
    }
    
    .hec-modal--pos-top {
        padding-top: 20px;
    }
    
    .hec-modal--small .hec-modal__container,
    .hec-modal--medium .hec-modal__container,
    .hec-modal--large .hec-modal__container,
    .hec-modal--xlarge .hec-modal__container {
        max-width: 100%;
    }
    
    .hec-modal--pos-left .hec-modal__container,
    .hec-modal--pos-right .hec-modal__container {
        max-width: 85%;
    }
    
    .hec-modal__close {
        width: 36px;
        height: 36px;
    }
    
    .hec-modal--close-outside .hec-modal__close {
        top: -45px;
    }
    
    .hec-modal--close-corner .hec-modal__close {
        top: -10px;
        right: -10px;
    }
}


/* ============================================
   Amelia inside HEC modal — remove Amelia spacing only
   ============================================ */

/* ============================================
   Amelia inside HEC modal — safe spacing fix
   Elementor is NOT touched
   ============================================ */

.hec-modal.hec-modal--amelia .hec-modal__container {
    max-width: 1000px !important;
    width: min(1000px, calc(100vw - 20px)) !important;
}

.hec-modal.hec-modal--amelia .hec-modal__content,
.hec-modal.hec-modal--amelia .hec-modal__body {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Отступ самой модалки, не Amelia */
.hec-modal.hec-modal--amelia .hec-modal__body {
    padding: 60px 20px 40px 20px !important;
}

/* Amelia root */
.hec-modal.hec-modal--amelia .amelia-v2-booking {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Главный контейнер Amelia — убираем её margin: 100px auto */
.hec-modal.hec-modal--amelia #amelia-container.am-fs__wrapper {
    width: 760px !important;
    max-width: 760px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
}

/* Основная часть Amelia */
.hec-modal.hec-modal--amelia .am-fs__main {
    margin: 0 !important;
}

/* Desktop: удерживаем нормальную ширину формы */
@media (min-width: 769px) {
    .hec-modal.hec-modal--amelia .amelia-v2-booking {
        min-width: 760px !important;
    }

    .hec-modal.hec-modal--amelia #amelia-container.am-fs__wrapper {
        min-width: 760px !important;
    }

    .hec-modal.hec-modal--amelia .am-fs__main {
        width: 520px !important;
        max-width: 520px !important;
        min-width: 520px !important;
        flex: 0 0 520px !important;
    }
}

/* Mobile / tablet — не ломаем dropdown, только убираем отступы Amelia */
@media (max-width: 768px) {
    .hec-modal.hec-modal--amelia .hec-modal__container {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
    }

    .hec-modal.hec-modal--amelia .hec-modal__body {
        padding: 60px 20px 30px 20px !important;
    }

    .hec-modal.hec-modal--amelia .amelia-v2-booking,
    .hec-modal.hec-modal--amelia #amelia-container.am-fs__wrapper,
    .hec-modal.hec-modal--amelia .am-fs__main,
    .hec-modal.hec-modal--amelia .am-fs__main.am-fs__main-mobile {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        flex: none !important;
    }
}

/* ============================================
   Amelia dropdown inside HEC modal
   ============================================ */

.el-popper.el-select__popper.am-service-dropdown {
    z-index: 999999 !important;
}

.el-popper.el-select__popper.am-service-dropdown .el-select-dropdown {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.el-popper.el-select__popper.am-service-dropdown .el-select-dropdown__wrap {
    max-height: 45vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.el-popper.el-select__popper.am-service-dropdown .el-select-dropdown__item {
    white-space: normal !important;
    height: auto !important;
    line-height: 1.35 !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.hec-modal.hec-modal--amelia #amelia-container.am-fs__wrapper {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ============================================
   HEC MODAL CLOSE BUTTON — UNIVERSAL FINAL
   фон не пропадает + крестик виден + вращение работает
   ============================================ */

body .hec-modal button.hec-modal__close,
body .hec-modal button.hec-modal__close:focus,
body .hec-modal button.hec-modal__close:active {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;

    border: none !important;
    border-radius: 50% !important;

    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #212121 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    box-shadow: none !important;
    outline: none !important;
    line-height: 1 !important;
    cursor: pointer !important;

    transform: rotate(0deg) !important;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease !important;
}

/* hover отдельно, чтобы глобальные button:hover не забирали фон */
body .hec-modal button.hec-modal__close:hover {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #212121 !important;
    transform: rotate(90deg) !important;
}

/* SVG крестик */
body .hec-modal button.hec-modal__close svg {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;

    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;

    display: block !important;
    flex: 0 0 20px !important;

    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;

    color: #212121 !important;
    fill: none !important;
    stroke: currentColor !important;

    pointer-events: none !important;
}

/* линии крестика */
body .hec-modal button.hec-modal__close svg line {
    stroke: currentColor !important;
    stroke-width: 2 !important;
    opacity: 1 !important;
    visibility: visible !important;
}