/* =========================================================
   SDR PREMIUM MAP POPUP / MODAL
   Glass / SaaS / RTL / Minimal
   ========================================================= */


/* =========================================================
   POPUP ROOT CONTAINER
   ========================================================= */

#popup {
    position: fixed !important;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 999999;

    display: none;
    flex-direction: column;

    width: min(88vw, 340px);
    box-sizing: border-box;

    padding: 22px 20px 18px 20px;

    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.95);

    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.94),
        rgba(242, 252, 248, 0.88)
    );

    box-shadow:
        0 4px 10px rgba(15, 23, 42, 0.04),
        0 14px 30px rgba(15, 23, 42, 0.10),
        0 30px 65px rgba(7, 145, 130, 0.14);

    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);

    direction: rtl;
    text-align: right;
    user-select: none;
    -webkit-user-select: none;
    isolation: isolate;

    animation: sdr-popup-enter 0.32s cubic-bezier(.16, 1, .3, 1) both;
}

/* Subtle outer boundary glow */
#popup::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95),
        rgba(207, 244, 228, 0.35),
        rgba(255, 255, 255, 0.85)
    );
    z-index: -1;
    pointer-events: none;
}

/* Top glass light reflection */
#popup::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 1px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.95),
        transparent
    );
    pointer-events: none;
}


/* =========================================================
   POPUP CONTENT
   ========================================================= */

#popup-content {
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.65;
    color: #173b38;

    margin: 4px 0 16px 0;
    padding: 0 4px;

    text-align: right;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
}


/* =========================================================
   BUTTONS BASE
   ========================================================= */

#popup button {
    position: relative;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 42px;

    padding: 10px 16px;
    margin-top: 8px;

    border-radius: 14px;
    border: 1px solid transparent;
    outline: none;

    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;

    cursor: pointer;
    overflow: hidden;

    transition:
        transform 0.28s cubic-bezier(.16, 1, .3, 1),
        background 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        color 0.25s ease;
}

#popup button:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.1s;
}

#popup button:focus-visible {
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 5px rgba(7, 145, 130, 0.32) !important;
}


/* =========================================================
   GOOGLE MAPS BUTTON (PRIMARY CALL-TO-ACTION)
   ========================================================= */

#popup-goto {
    margin-top: 4px;

    background: linear-gradient(
        135deg,
        #0b9a89 0%,
        #078e80 48%,
        #06766b 100%
    );

    color: #fbf1e7;
    border-color: rgba(255, 255, 255, 0.20);

    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.24),
        0 3px 8px rgba(7, 145, 130, 0.16),
        0 8px 20px rgba(7, 145, 130, 0.20);

    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.10);
}

/* Primary button shine sweep */
#popup-goto::before {
    content: "";
    position: absolute;
    top: -80%;
    left: -40%;
    width: 45%;
    height: 260%;
    transform: rotate(25deg) translateX(-180%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.35),
        transparent
    );
    pointer-events: none;
    transition: transform 0.65s cubic-bezier(.16, 1, .3, 1);
}

#popup-goto:hover::before {
    transform: rotate(25deg) translateX(440%);
}

#popup-goto:hover {
    transform: translateY(-2px) scale(1.015);

    background: linear-gradient(
        135deg,
        #0da08f 0%,
        #079486 48%,
        #067c71 100%
    );

    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.30),
        0 5px 12px rgba(7, 145, 130, 0.20),
        0 12px 26px rgba(7, 145, 130, 0.26);
}


/* =========================================================
   COPY LINK BUTTON (SECONDARY GLASS)
   ========================================================= */

#popup-copy {
    background: rgba(255, 255, 255, 0.85);
    color: #078e80;
    border-color: rgba(7, 145, 130, 0.16);

    box-shadow:
        inset 0 1px 1px #ffffff,
        0 2px 6px rgba(15, 23, 42, 0.04);
}

#popup-copy:hover {
    transform: translateY(-2px);
    background: linear-gradient(
        145deg,
        #ffffff 0%,
        #e8faf2 100%
    );
    color: #06766b;
    border-color: rgba(7, 145, 130, 0.32);

    box-shadow:
        inset 0 1px 1px #ffffff,
        0 4px 12px rgba(7, 145, 130, 0.12);
}


/* =========================================================
   CLOSE BUTTON (TERTIARY / SOFT DANGER)
   ========================================================= */

#popup-close {
    background: transparent;
    color: #a63a38;
    border-color: transparent;
    box-shadow: none;
    font-weight: 600;
}

#popup-close:hover {
    transform: translateY(-1px);
    background: rgba(220, 53, 69, 0.08);
    color: #c92a2a;
    border-color: rgba(220, 53, 69, 0.15);
}


/* =========================================================
   MOBILE & RESPONSIVE
   ========================================================= */

@media (max-width: 600px) {
    #popup {
        width: calc(100vw - 32px);
        max-width: 320px;
        padding: 18px 16px 14px 16px;
        border-radius: 20px;
    }

    #popup-content {
        font-size: 14px;
        margin-bottom: 12px;
    }

    #popup button {
        min-height: 40px;
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (max-width: 380px) {
    #popup {
        width: calc(100vw - 20px);
        max-width: 290px;
        padding: 16px 14px 12px 14px;
    }

    #popup button {
        min-height: 38px;
        font-size: 12.5px;
        margin-top: 6px;
    }
}


/* =========================================================
   ENTRANCE ANIMATION & ACCESSIBILITY
   ========================================================= */

@keyframes sdr-popup-enter {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.95);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    #popup {
        animation: none !important;
    }
    #popup button,
    #popup-goto::before {
        transition: none !important;
    }
}