.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;

    background: rgba(0, 0, 0, 0.6);

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

    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));

    box-sizing: border-box;
    z-index: 10000;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}



.modal-box {
    background: var(--white);

    width: 100%;
    max-width: 500px;

    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;

    padding: clamp(20px, 5vw, 30px);

    border-radius: 12px;
    box-shadow: var(--shadow);

    text-align: center;
    position: relative;

    box-sizing: border-box;

    transform: translateY(-20px) scale(0.98);

    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}



.modal-box h3 {
    color: var(--text-dark);

    font-size: clamp(19px, 4vw, 22px);
    line-height: 1.3;

    margin: 0 25px 12px;
    overflow-wrap: break-word;
}

.modal-box p {
    color: var(--text-light);

    font-size: clamp(13px, 3vw, 14px);
    line-height: 1.6;

    margin-bottom: 25px;
    overflow-wrap: break-word;
}

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

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;

    width: 38px;
    height: 38px;

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

    background: none;
    border: none;

    font-size: 22px;
    color: var(--text-light);

    cursor: pointer;
    border-radius: 50%;

    transition:
        color 0.3s ease,
        background 0.3s ease;
}

.modal-close:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

/* ================================
   MODAL BUTTONS
================================ */

.modal-buttons {
    display: flex;
    flex-wrap: wrap;

    gap: 15px;
    justify-content: center;

    width: 100%;
}

/* ================================
   LOCATION BUTTONS
================================ */

.btn-sede {
    flex: 1 1 180px;
    min-width: 0;

    background: var(--primary);
    color: white;

    padding: 15px 20px;

    border-radius: 8px;
    border: none;

    font-weight: 600;
    font-size: clamp(14px, 3vw, 15px);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    text-align: center;
    overflow-wrap: break-word;

    cursor: pointer;

    transition:
        background 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.btn-sede:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
}

.btn-sede span {
    font-size: 12px;
    font-weight: 300;
    opacity: 0.9;
    line-height: 1.4;
}



@media (max-width: 768px) {
    .modal-overlay {
        padding: 18px;
    }

    .modal-box {
        max-width: 460px;
    }

    .modal-buttons {
        gap: 12px;
    }

    .btn-sede {
        padding: 14px 15px;
    }
}



@media (max-width: 480px) {
    .modal-overlay {
        padding: 15px;
    }

    .modal-box {
        width: 100%;
        padding: 25px 18px 20px;
        border-radius: 12px;
    }

    .modal-box h3 {
        margin: 0 20px 10px;
    }

    .modal-box p {
        margin-bottom: 20px;
    }

    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn-sede {
        width: 100%;
        flex: none;
        min-height: 55px;
        padding: 13px 15px;
    }

    .modal-close {
        top: 8px;
        right: 8px;
    }
}



@media (max-width: 350px) {
    .modal-overlay {
        padding: 10px;
    }

    .modal-box {
        padding: 22px 14px 16px;
    }

    .modal-box h3 {
        font-size: 18px;
    }

    .modal-box p {
        font-size: 13px;
    }

    .btn-sede {
        font-size: 13px;
        min-height: 50px;
    }
}



@media (max-height: 500px) {
    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal-box {
        margin: auto 0;
        max-height: calc(100dvh - 30px);
    }
}



@media (hover: none) {
    .btn-sede:hover {
        transform: none;
        box-shadow: none;
    }

    .modal-close:hover {
        background: none;
    }

    .btn-sede:active {
        background: var(--primary-dark);
        transform: scale(0.98);
    }
}



@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-box,
    .btn-sede,
    .modal-close {
        transition: none;
    }
}
