/**
 * Kajinga Elementor - Pop-Up Styles
 *
 * @package Kajinga_Elementor
 * @since 0.13.0
 * @version 0.13.1 - Phase 5 Token-Migration
 */

/* ==========================================================================
   POPUP TRIGGER WIDGET
   ========================================================================== */

.ke-popup-trigger-wrapper {
    display: block;
}

/* Button Trigger */
.ke-popup-trigger-button {
    display: inline-flex;
    align-items: center;
    gap: var(--ke-space-2);
    padding: var(--ke-space-3) var(--ke-space-6);
    background-color: var(--ke-primary);
    color: #fff;
    border: none;
    border-radius: var(--ke-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--ke-transition-fast);
}

.ke-popup-trigger-button:hover {
    background-color: var(--ke-primary-dark);
}

.ke-popup-trigger-button:focus {
    outline: 2px solid var(--ke-primary);
    outline-offset: 2px;
}

.ke-popup-trigger-button i,
.ke-popup-trigger-button svg {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Link Trigger */
.ke-popup-trigger-link {
    color: var(--ke-primary);
    text-decoration: underline;
    cursor: pointer;
    transition: color var(--ke-transition-fast);
}

.ke-popup-trigger-link:hover {
    color: var(--ke-primary-dark);
}

/* Image Trigger */
.ke-popup-trigger-image {
    display: inline-block;
    cursor: pointer;
    transition: opacity var(--ke-transition-fast);
}

.ke-popup-trigger-image:hover {
    opacity: 0.85;
}

.ke-popup-trigger-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Icon Trigger */
.ke-popup-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--ke-transition-fast);
}

.ke-popup-trigger-icon:hover {
    transform: scale(1.1);
}

.ke-popup-trigger-icon i,
.ke-popup-trigger-icon svg {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Notice for editor */
.ke-popup-trigger-notice {
    padding: 20px;
    background: var(--ke-info-bg);
    border: 1px dashed var(--ke-primary);
    border-radius: var(--ke-radius-sm);
    text-align: center;
    color: var(--ke-text-light);
}

/* ==========================================================================
   POPUP CONTAINER
   ========================================================================== */

.ke-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ke-transition, 0.3s ease), visibility var(--ke-transition, 0.3s ease);
}

.ke-popup-container.ke-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when popup is open */
body.ke-popup-open {
    overflow: hidden;
}

/* ==========================================================================
   POPUP OVERLAY
   ========================================================================== */

.ke-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(var(--ke-black-rgb, 0, 0, 0), 0.6);
}

/* ==========================================================================
   POPUP MODAL
   ========================================================================== */

.ke-popup-modal {
    position: relative;
    background: var(--ke-card, #ffffff);
    border-radius: var(--ke-radius-md, 12px);
    box-shadow: var(--ke-shadow-lg, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.95);
    transition: transform var(--ke-transition, 0.3s ease);
    z-index: 1;
}

.ke-popup-visible .ke-popup-modal {
    transform: scale(1);
}

/* ==========================================================================
   POPUP POSITIONS
   ========================================================================== */

/* Center (default) */
.ke-popup-position-center {
    /* Already centered via flexbox on container */
}

/* Top */
.ke-popup-container:has(.ke-popup-position-top) {
    align-items: flex-start;
    padding-top: 5vh;
}

/* Bottom */
.ke-popup-container:has(.ke-popup-position-bottom) {
    align-items: flex-end;
    padding-bottom: 5vh;
}

/* Left */
.ke-popup-container:has(.ke-popup-position-left) {
    justify-content: flex-start;
    padding-left: 5vw;
}

/* Right */
.ke-popup-container:has(.ke-popup-position-right) {
    justify-content: flex-end;
    padding-right: 5vw;
}

/* Top Left */
.ke-popup-container:has(.ke-popup-position-top-left) {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 5vh 0 0 5vw;
}

/* Top Right */
.ke-popup-container:has(.ke-popup-position-top-right) {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 5vh 5vw 0 0;
}

/* Bottom Left */
.ke-popup-container:has(.ke-popup-position-bottom-left) {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 5vh 5vw;
}

/* Bottom Right */
.ke-popup-container:has(.ke-popup-position-bottom-right) {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 5vw 5vh 0;
}

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

/* Fade (default) */
[data-animation="fade"] .ke-popup-modal {
    transform: none;
    opacity: 0;
    transition: opacity var(--ke-transition, 0.3s ease);
}

[data-animation="fade"].ke-popup-visible .ke-popup-modal {
    opacity: 1;
}

/* Slide */
[data-animation="slide"] .ke-popup-modal {
    transform: translateY(-30px);
    transition: transform var(--ke-transition, 0.3s ease);
}

[data-animation="slide"].ke-popup-visible .ke-popup-modal {
    transform: translateY(0);
}

/* Zoom */
[data-animation="zoom"] .ke-popup-modal {
    transform: scale(0.8);
    transition: transform var(--ke-transition, 0.3s ease);
}

[data-animation="zoom"].ke-popup-visible .ke-popup-modal {
    transform: scale(1);
}

/* None */
[data-animation="none"] .ke-popup-modal {
    transform: none;
    transition: none;
}

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

.ke-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--ke-black-rgb, 0, 0, 0), 0.05);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: var(--ke-text-light, #666);
    cursor: pointer;
    transition: all var(--ke-transition-fast, 0.15s ease);
    z-index: 10;
}

.ke-popup-close:hover {
    background: rgba(var(--ke-black-rgb, 0, 0, 0), 0.1);
    color: var(--ke-text, #333);
}

.ke-popup-close:focus {
    outline: 2px solid var(--ke-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   POPUP CONTENT
   ========================================================================== */

.ke-popup-content {
    padding: 0;
}

/* Elementor content inside popup */
.ke-popup-content .elementor-section {
    margin-bottom: 0;
}

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

@media (max-width: 768px) {
    .ke-popup-modal {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: var(--ke-radius-sm);
    }

    /* All positions become centered on mobile */
    .ke-popup-container:has(.ke-popup-position-left),
    .ke-popup-container:has(.ke-popup-position-right),
    .ke-popup-container:has(.ke-popup-position-top-left),
    .ke-popup-container:has(.ke-popup-position-top-right),
    .ke-popup-container:has(.ke-popup-position-bottom-left),
    .ke-popup-container:has(.ke-popup-position-bottom-right) {
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .ke-popup-close {
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 20px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus trap indicator */
.ke-popup-modal:focus {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ke-popup-container,
    .ke-popup-modal,
    .ke-popup-trigger-button,
    .ke-popup-trigger-link,
    .ke-popup-trigger-image,
    .ke-popup-trigger-icon,
    .ke-popup-close {
        transition: none;
    }
}
