/* Premium Modal System - "White Platinum" System Harmony */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4); /* Deep slate overlay for contrast */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

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

.modal {
    background: var(--surf); /* System white background */
    width: 100%;
    max-width: 500px; /* Platinum card width */
    border-radius: 20px;
    border: 1px solid rgba(2, 132, 199, 0.15); /* Soft primary border */
    border-top: 1px solid rgba(2, 132, 199, 0.3);
    box-shadow: 0 40px 80px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--bord) inset, 0 -10px 30px rgba(2, 132, 199, 0.05) inset;
    position: relative;
    overflow: hidden;
    transform: translateY(30px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.modal-overlay.is-open .modal {
    transform: translateY(0) scale(1);
}

.modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--mut);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.modal__close:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    transform: rotate(90deg);
}

.modal__body {
    padding: 56px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.modal__icon-wrap {
    color: var(--prim); /* System Primary */
    margin: 0 auto 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: var(--prim-soft);
    border-radius: 22px;
    box-shadow: 0 12px 24px rgba(2, 132, 199, 0.15);
    border: 1px solid transparent; /* Replaced solid border with animated one */
    position: relative;
    z-index: 1;
}

/* Sharp Laser Core */
.modal__icon-wrap::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(90deg, transparent 15%, rgba(56, 189, 248, 0.4) 30%, #38bdf8 42%, #ffffff 50%, #7dd3fc 58%, rgba(56, 189, 248, 0.4) 70%, transparent 85%);
    background-size: 300% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: modal-border-sweep 3s ease-in-out infinite alternate;
}

/* Volumetric Moving Fog */
.modal__icon-wrap::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 24px;
    background: linear-gradient(90deg, transparent 30%, rgba(56, 189, 248, 0.3) 42%, rgba(56, 189, 248, 0.7) 50%, rgba(56, 189, 248, 0.3) 58%, transparent 70%);
    background-size: 300% 100%;
    filter: blur(14px);
    opacity: 0.9;
    pointer-events: none;
    animation: modal-border-sweep 3s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes modal-border-sweep { 
    0% { background-position: 0% 0%; } 
    100% { background-position: 300% 0%; } 
}

.modal__icon-wrap svg {
    width: 36px;
    height: 36px;
    stroke-width: 1.5;
}

.modal__cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--prim);
    background: var(--prim-soft);
    padding: 6px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-transform: uppercase;
    border: 1px solid rgba(2, 132, 199, 0.12);
}

.modal__title {
    font-size: 24px;
    font-weight: 700; /* Sleeker, less chunky */
    color: var(--text); /* Solid slate for a serious premium look */
    margin-bottom: 16px;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.modal__desc {
    font-size: 15px;
    color: var(--mut); /* System muted text */
    line-height: 1.7;
    font-weight: 400;
    margin-bottom: 24px;
    max-width: 95%;
}

/* Bullet Point Feature Highlights */
.modal__features {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    text-align: left;
}

.modal__features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text);
    background: var(--bg-soft);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--bord);
    line-height: 1.45;
    font-weight: 500;
}

.modal__features li svg {
    color: #16a34a; /* Vibrant emerald green checkmark */
    flex-shrink: 0;
    margin-top: 1px;
}

.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    background: #25D366; /* Classic WhatsApp Green */
    color: #fff;
    border-radius: 12px;
    font-weight: 600; /* Less aggressive */
    letter-spacing: 0.01em;
    font-size: 15px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.25);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-whatsapp:hover {
    background: #1ebd59; /* Slightly darker WhatsApp green for hover */
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .modal-overlay { padding: 16px; }
    .modal__body { padding: 48px 24px; }
    .modal__icon-wrap { width: 60px; height: 60px; margin-bottom: 24px; }
    .modal__icon-wrap svg { width: 30px; height: 30px; }
    .modal__title { font-size: 22px; }
}

/* ── Modal Interactive Gallery Styles ── */
.modal-gallery {
    position: relative;
    width: 100%;
    background: #090e17;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    user-select: none;
}

.modal-gallery__main {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #020617;
}

.modal-gallery__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease;
}

.modal-gallery__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 40%, rgba(15, 23, 42, 0.85) 100%);
    pointer-events: none;
}

.modal-gallery__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s ease;
}

.modal-gallery__btn:hover {
    background: #0284c7;
    border-color: #38bdf8;
    transform: translateY(-50%) scale(1.1);
}

.modal-gallery__btn--prev { left: 14px; }
.modal-gallery__btn--next { right: 14px; }

.modal-gallery__counter {
    position: absolute;
    bottom: 14px;
    right: 16px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Modal Shimmer Badge */
.modal-gallery__cat {
    position: absolute;
    bottom: 14px;
    left: 16px;
    background: rgba(11, 19, 41, 0.85);
    backdrop-filter: blur(12px);
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    animation: badge-glow-pulse 3s ease-in-out infinite alternate;
}

.modal-gallery__cat svg {
    width: 13px;
    height: 13px;
    color: #38bdf8;
}

.modal-gallery__thumbs {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    scrollbar-width: thin;
    flex-shrink: 0;
}

.modal-gallery__thumb {
    width: 54px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.55;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: #1e293b;
}

.modal-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal-gallery__thumb:hover {
    opacity: 0.85;
}

.modal-gallery__thumb.is-active {
    opacity: 1;
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
    transform: scale(1.05);
}

.modal--has-gallery .modal__body {
    padding: 24px 28px 28px;
}

.modal--has-gallery .modal__close {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    top: 16px;
    right: 16px;
}

.modal--has-gallery .modal__close:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

/* ── Desktop Horizontal Split Layout (PC & Tablet) ── */
@media (min-width: 820px) {
    .modal--has-gallery {
        width: 1024px;
        max-width: 96vw;
        height: 600px; /* Fixed height to prevent ANY jumping */
        display: flex;
        flex-direction: row;
        align-items: stretch;
        text-align: left;
    }

    .modal--has-gallery .modal-gallery {
        width: 50%; /* Slightly more space for gallery */
        height: 100%;
        border-radius: 20px 0 0 20px;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        overflow: hidden;
    }

    .modal--has-gallery .modal-gallery__main {
        height: 100% !important; /* Override the 280px from mobile */
        flex: 1;
        min-height: 0;
    }

    .modal--has-gallery .modal__body {
        width: 50%;
        height: 100%;
        padding: 40px 42px 36px; /* A bit more padding for the larger modal */
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        justify-content: flex-start;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .modal--has-gallery .modal__title {
        text-align: left;
        font-size: 22px;
        margin-bottom: 12px;
    }

    .modal--has-gallery .modal__desc {
        text-align: left;
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 18px;
        max-width: 100%;
    }

    .modal--has-gallery .modal__features {
        margin-bottom: 24px;
        width: 100%;
    }

    .modal--has-gallery .btn-whatsapp {
        margin-top: auto;
        width: 100%;
        flex-shrink: 0;
    }

    .modal--has-gallery .modal__close {
        top: 16px;
        right: 16px;
        background: var(--bg-soft);
        color: var(--mut);
        border: 1px solid var(--bord);
    }

    .modal--has-gallery .modal__close:hover {
        background: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.3);
        color: #ef4444;
    }
}
