/**
 * GL Popup - Frontend Styles
 *
 * @author    GL Modules
 * @copyright 2024 GL Modules
 * @license   Academic Free License (AFL 3.0)
 */

/* =============================================
   OVERLAY
   ============================================= */
.gl-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gl-popup-overlay.gl-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* =============================================
   CONTAINER
   ============================================= */
.gl-popup-container {
    position: relative;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gl-popup-visible .gl-popup-container {
    transform: scale(1);
}

/* =============================================
   POSITIONS
   ============================================= */
.gl-popup-overlay {
    justify-content: center;
    align-items: center;
}

.gl-popup-position-top {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
}

.gl-popup-visible .gl-popup-position-top {
    transform: translateX(-50%) translateY(0);
}

.gl-popup-position-bottom {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
}

.gl-popup-visible .gl-popup-position-bottom {
    transform: translateX(-50%) translateY(0);
}

.gl-popup-position-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    left: auto;
    transform: translateX(30px);
}

.gl-popup-visible .gl-popup-position-bottom-right {
    transform: translateX(0);
}

.gl-popup-position-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: auto;
    transform: translateX(-30px);
}

.gl-popup-visible .gl-popup-position-bottom-left {
    transform: translateX(0);
}

/* =============================================
   ANIMATIONS
   ============================================= */

/* Fade In */
.gl-popup-animation-fadeIn {
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.gl-popup-visible .gl-popup-animation-fadeIn {
    opacity: 1;
}

/* Slide Down */
.gl-popup-animation-slideDown {
    transform: translateY(-50px) scale(1);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.gl-popup-visible .gl-popup-animation-slideDown {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Slide Up */
.gl-popup-animation-slideUp {
    transform: translateY(50px) scale(1);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.gl-popup-visible .gl-popup-animation-slideUp {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Zoom In */
.gl-popup-animation-zoomIn {
    transform: scale(0.3);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.gl-popup-visible .gl-popup-animation-zoomIn {
    transform: scale(1);
    opacity: 1;
}

/* Bounce In */
.gl-popup-animation-bounceIn {
    transform: scale(0.5);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
}

.gl-popup-visible .gl-popup-animation-bounceIn {
    transform: scale(1);
    opacity: 1;
}

/* =============================================
   CLOSE BUTTON
   ============================================= */
.gl-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    color: inherit;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.gl-popup-close:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: rotate(90deg);
}

.gl-popup-close:focus {
    outline: 2px solid #2fb5d2;
    outline-offset: 2px;
}

.gl-popup-close svg {
    width: 18px;
    height: 18px;
}

/* =============================================
   IMAGE
   ============================================= */
.gl-popup-image {
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.gl-popup-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Con border-radius heredado del contenedor */
.gl-popup-container .gl-popup-image img {
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* =============================================
   BODY / CONTENT
   ============================================= */
.gl-popup-body {
    padding: 30px;
}

.gl-popup-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 15px;
    line-height: 1.3;
    padding-right: 30px;
}

.gl-popup-content {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.gl-popup-content p {
    margin-bottom: 10px;
}

.gl-popup-content p:last-child {
    margin-bottom: 0;
}

.gl-popup-content a {
    color: inherit;
    text-decoration: underline;
}

.gl-popup-content a:hover {
    opacity: 0.8;
}

/* =============================================
   ACTIONS / BUTTON
   ============================================= */
.gl-popup-actions {
    margin-top: 25px;
    text-align: center;
}

.gl-popup-btn {
    display: inline-block;
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.gl-popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.gl-popup-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.gl-popup-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* =============================================
   SCROLLBAR
   ============================================= */
.gl-popup-container::-webkit-scrollbar {
    width: 6px;
}

.gl-popup-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.gl-popup-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* =============================================
   CLOSING ANIMATION
   ============================================= */
.gl-popup-overlay.gl-popup-closing {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gl-popup-closing .gl-popup-container {
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .gl-popup-container {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 85vh;
    }

    .gl-popup-body {
        padding: 20px;
    }

    .gl-popup-title {
        font-size: 20px;
    }

    .gl-popup-content {
        font-size: 14px;
    }

    .gl-popup-btn {
        padding: 10px 30px;
        font-size: 14px;
        width: 100%;
    }

    .gl-popup-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }

    /* Posiciones en móvil: centrar todo */
    .gl-popup-position-bottom-right,
    .gl-popup-position-bottom-left,
    .gl-popup-position-top,
    .gl-popup-position-bottom {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
    }

    .gl-popup-visible .gl-popup-position-bottom-right,
    .gl-popup-visible .gl-popup-position-bottom-left,
    .gl-popup-visible .gl-popup-position-top,
    .gl-popup-visible .gl-popup-position-bottom {
        transform: none;
    }
}

@media (max-width: 480px) {
    .gl-popup-body {
        padding: 15px;
    }

    .gl-popup-title {
        font-size: 18px;
    }

    .gl-popup-actions {
        margin-top: 20px;
    }
}

/* =============================================
   ACCESIBILIDAD - Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .gl-popup-overlay,
    .gl-popup-container,
    .gl-popup-close,
    .gl-popup-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* =============================================
   PRINT - Ocultar en impresión
   ============================================= */
@media print {
    .gl-popup-overlay {
        display: none !important;
    }
}