/**
 * AnnounceKit Front-End Popup Styles
 *
 * Uses CSS background-image approach for the popup image which:
 * - Guarantees full coverage of the container (via background-size: cover)
 * - Handles any aspect ratio automatically
 * - No dependency on child element heights
 * - Native browser handling — no CSS tricks needed
 *
 * File Path: announcekit/public/css/announcekit-popup.css
 */

/* ═══════════════════════════════════════════════════════════════
   OVERLAY BACKDROP
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.announcekit-popup-overlay.announcekit-popup-visible {
    opacity: 1;
    visibility: visible;
}

.announcekit-popup-hidden {
    display: none !important;
}

.announcekit-popup-overlay *,
.announcekit-popup-overlay *::before,
.announcekit-popup-overlay *::after {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   POPUP CARD
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-card {
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    overflow: hidden;
}

.announcekit-popup-overlay.announcekit-popup-visible .announcekit-popup-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   DEFAULT POPUP TEMPLATE
   ═══════════════════════════════════════════════════════════════
   Uses FLEXBOX (not grid) for perfect equal-height columns.
   Flexbox naturally stretches children to equal heights,
   which allows the left side to have a defined height that
   the background-image can properly cover.
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-default {
    display: flex;
    flex-direction: row;
    align-items: stretch;                    /* Both sides stretch to equal height */
    background: #0a1628;
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 168, 75, 0.1);
    color: #fff;
    overflow: hidden;
    min-height: 500px;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   LEFT: IMAGE SIDE
   ═══════════════════════════════════════════════════════════════
   Uses background-image (set via inline style from PHP for uploaded
   images) or displays the SVG fallback if no image is uploaded.
   
   background-size: cover ensures the image ALWAYS covers the entire
   area regardless of its aspect ratio.
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-image-side {
    position: relative;
    flex: 0 0 45%;                           /* Fixed 45% width */
    min-height: 500px;                        /* Ensures minimum height */
    overflow: hidden;
    background-color: #0a1628;
    background-image: linear-gradient(135deg, #0a1628 0%, #142644 100%);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When admin uploads a custom image, the inline style overrides
   the gradient background with the actual image */

/* SVG fallback side — extra styling when no image is uploaded */
.announcekit-popup-svg-side {
    background: linear-gradient(135deg, #0a1628 0%, #142644 50%, #1e3a5f 100%);
}

/* SVG wrapper — centers the gift SVG in the container */
.announcekit-popup-svg-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    z-index: 2;
}

.announcekit-gift-svg {
    width: 100%;
    max-width: 340px;
    height: auto;
    max-height: 90%;
    display: block;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
    animation: announcekit-gift-float 4s ease-in-out infinite;
}

/* Gift box gentle floating animation */
@keyframes announcekit-gift-float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Confetti gentle rotation animation */
.announcekit-svg-confetti {
    animation: announcekit-confetti-shimmer 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes announcekit-confetti-shimmer {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Decorative circle overlay — visible on both image and SVG modes */
.announcekit-popup-decorative-circle {
    position: absolute;
    right: -50%;
    top: 50%;
    transform: translateY(-50%);
    width: 130%;
    height: 130%;
    border: 2px solid rgba(212, 168, 75, 0.35);
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
}

/* ═══════════════════════════════════════════════════════════════
   RIGHT: CONTENT SIDE
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-content-side {
    flex: 1 1 55%;                           /* Fills remaining space */
    padding: 45px 45px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    color: #fff;
    min-height: 500px;
    background: #0a1628;
    position: relative;
    z-index: 2;
}

/* Sub-heading (script text with dashes) */
.announcekit-popup-sub-heading {
    font-family: 'Brush Script MT', 'Lucida Handwriting', cursive;
    color: #d4a84b;
    font-size: 26px;
    font-weight: 400;
    margin: 0 0 8px;
    line-height: 1;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.announcekit-popup-dash {
    color: #d4a84b;
    font-family: Arial, sans-serif;
    font-size: 16px;
    opacity: 0.8;
    font-style: normal;
}

/* Main heading */
.announcekit-popup-heading {
    color: #ffffff;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 1px;
    margin: 5px 0 8px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Offer box with gold border */
.announcekit-popup-offer-box {
    border: 2px solid #d4a84b;
    border-radius: 12px;
    padding: 18px 20px 14px;
    margin: 18px 0;
    background: rgba(212, 168, 75, 0.03);
}

.announcekit-popup-offer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.announcekit-popup-offer-label {
    color: #d4a84b;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
    text-align: left;
    max-width: 60px;
}

.announcekit-popup-offer-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: #d4a84b;
    line-height: 1;
}

.announcekit-popup-offer-number {
    font-size: 56px;
    font-weight: 900;
    color: #d4a84b;
    letter-spacing: -1px;
    text-shadow: 0 2px 8px rgba(212, 168, 75, 0.3);
}

.announcekit-popup-offer-off {
    font-size: 24px;
    font-weight: 800;
    color: #d4a84b;
}

.announcekit-popup-offer-divider {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(212, 168, 75, 0.4);
    text-align: center;
}

.announcekit-popup-offer-limited {
    color: #d4a84b;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Description */
.announcekit-popup-description {
    color: #ffffff;
    font-size: 15px;
    line-height: 1.5;
    margin: 15px 0 22px;
    opacity: 0.85;
}

/* CTA Button */
.announcekit-popup-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #f4c464 0%, #d4a84b 50%, #b8912e 100%);
    color: #0a1628 !important;
    padding: 16px 40px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 20px rgba(212, 168, 75, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    align-self: center;
    min-width: 260px;
}

.announcekit-popup-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(212, 168, 75, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
    color: #0a1628 !important;
}

.announcekit-popup-cta-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(212, 168, 75, 0.4);
}

.announcekit-popup-btn-icon {
    stroke: #0a1628;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   CLOSE BUTTON
═══════════════════════════════════════════════════════════════ */
.announcekit-popup-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(10, 22, 40, 0.7);
    border: 1.5px solid #d4a84b;
    color: #d4a84b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 0;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.announcekit-popup-close:hover {
    background: #d4a84b;
    color: #0a1628;
    transform: rotate(90deg);
}

.announcekit-popup-close:focus {
    outline: 2px solid #d4a84b;
    outline-offset: 2px;
}

.announcekit-popup-close svg {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 768px)
   Layout stacks vertically. Image on top, content on bottom.
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .announcekit-popup-overlay {
        padding: 15px;
        align-items: flex-start;
        padding-top: 30px;
    }

    .announcekit-popup-default {
        flex-direction: column;               /* Stack vertically */
        max-width: 500px;
        min-height: 0;
    }

    /* Image side — fixed height on mobile, full width */
    .announcekit-popup-image-side {
        flex: 0 0 auto;
        width: 100%;
        height: 280px;
        min-height: 280px;
    }

    .announcekit-popup-svg-wrapper {
        padding: 20px;
    }

    .announcekit-gift-svg {
        max-width: 260px;
        max-height: 240px;
    }

    .announcekit-popup-decorative-circle {
        right: -25%;
        top: -25%;
        width: 150%;
        height: 150%;
        transform: none;
    }

    .announcekit-popup-content-side {
        flex: 1 1 auto;
        width: 100%;
        padding: 25px 25px 30px;
        min-height: auto;
    }

    .announcekit-popup-sub-heading {
        font-size: 22px;
    }

    .announcekit-popup-heading {
        font-size: 26px;
    }

    .announcekit-popup-offer-number {
        font-size: 42px;
    }

    .announcekit-popup-offer-off {
        font-size: 20px;
    }

    .announcekit-popup-offer-label {
        font-size: 12px;
        max-width: 50px;
    }

    .announcekit-popup-description {
        font-size: 14px;
    }

    .announcekit-popup-cta-button {
        padding: 14px 28px;
        font-size: 14px;
        min-width: 220px;
        width: 100%;
    }

    .announcekit-popup-close {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 480px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .announcekit-popup-overlay {
        padding: 10px;
        padding-top: 20px;
    }

    .announcekit-popup-image-side {
        height: 220px;
        min-height: 220px;
    }

    .announcekit-popup-svg-wrapper {
        padding: 15px;
    }

    .announcekit-gift-svg {
        max-width: 200px;
        max-height: 190px;
    }

    .announcekit-popup-content-side {
        padding: 20px 20px 25px;
    }

    .announcekit-popup-sub-heading {
        font-size: 20px;
    }

    .announcekit-popup-heading {
        font-size: 22px;
        letter-spacing: 0.5px;
    }

    .announcekit-popup-offer-box {
        padding: 14px 12px 10px;
    }

    .announcekit-popup-offer-inner {
        gap: 8px;
    }

    .announcekit-popup-offer-number {
        font-size: 36px;
    }

    .announcekit-popup-offer-off {
        font-size: 18px;
    }

    .announcekit-popup-offer-label {
        font-size: 11px;
        max-width: 45px;
    }

    .announcekit-popup-offer-limited {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .announcekit-popup-description {
        font-size: 13px;
    }

    .announcekit-popup-cta-button {
        padding: 13px 20px;
        font-size: 13px;
        min-width: 100%;
    }

    .announcekit-popup-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — EXTRA SMALL (≤ 360px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .announcekit-popup-image-side {
        height: 180px;
        min-height: 180px;
    }

    .announcekit-gift-svg {
        max-width: 160px;
        max-height: 150px;
    }

    .announcekit-popup-content-side {
        padding: 18px 15px 20px;
    }

    .announcekit-popup-heading {
        font-size: 20px;
    }

    .announcekit-popup-offer-number {
        font-size: 32px;
    }

    .announcekit-popup-offer-off {
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   BODY SCROLL LOCK (when popup is open)
═══════════════════════════════════════════════════════════════ */
body.announcekit-popup-open {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY — REDUCED MOTION
═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .announcekit-popup-overlay,
    .announcekit-popup-card,
    .announcekit-popup-close,
    .announcekit-popup-cta-button,
    .announcekit-gift-svg,
    .announcekit-svg-confetti {
        transition: none !important;
        transform: none !important;
        animation: none !important;
    }

    .announcekit-popup-overlay.announcekit-popup-visible .announcekit-popup-card {
        transform: none !important;
    }
}