/* =========================================
   Popup Module - Africa Digital Connect
   ========================================= */

/* Base: hidden by default - !important to override format display values */
[id^="popup-"] { display: none !important; }
[id^="popup-"].popup-visible { display: flex !important; }
[id^="popup-"].popup-visible.popup-banner { display: flex !important; }
[id^="popup-"].popup-closing { pointer-events: none; }

/* =========================================
   Modal Format
   ========================================= */

.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.popup-overlay.popup-visible {
    animation: popupFadeIn 0.3s ease;
}

.popup-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-overlay.popup-closing {
    animation: popupFadeOut 0.3s ease forwards;
}

@keyframes popupFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* =========================================
   Banner Format
   ========================================= */

.popup-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 9998;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.popup-banner.top {
    top: 0;
    animation: popupSlideDown 0.4s ease;
}

.popup-banner.bottom {
    bottom: 0;
    animation: popupSlideUp 0.4s ease;
}

@keyframes popupSlideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

@keyframes popupSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.popup-banner.popup-closing.top {
    animation: popupSlideUpOut 0.3s ease forwards;
}

.popup-banner.popup-closing.bottom {
    animation: popupSlideDownOut 0.3s ease forwards;
}

@keyframes popupSlideUpOut {
    from { transform: translateY(0); }
    to   { transform: translateY(-100%); }
}

@keyframes popupSlideDownOut {
    from { transform: translateY(0); }
    to   { transform: translateY(100%); }
}

/* =========================================
   Slide-in Format
   ========================================= */

.popup-slidein {
    position: fixed;
    z-index: 9998;
    max-width: 380px;
    width: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.popup-slidein.bottom-right {
    bottom: 20px;
    right: 20px;
    animation: popupSlideInRight 0.4s ease;
}

.popup-slidein.bottom-left {
    bottom: 20px;
    left: 20px;
    animation: popupSlideInLeft 0.4s ease;
}

@keyframes popupSlideInRight {
    from { transform: translateX(120%); }
    to   { transform: translateX(0); }
}

@keyframes popupSlideInLeft {
    from { transform: translateX(-120%); }
    to   { transform: translateX(0); }
}

.popup-slidein.popup-closing.bottom-right {
    animation: popupSlideOutRight 0.3s ease forwards;
}

.popup-slidein.popup-closing.bottom-left {
    animation: popupSlideOutLeft 0.3s ease forwards;
}

@keyframes popupSlideOutRight {
    from { transform: translateX(0); }
    to   { transform: translateX(120%); }
}

@keyframes popupSlideOutLeft {
    from { transform: translateX(0); }
    to   { transform: translateX(-120%); }
}

/* =========================================
   Common Elements
   ========================================= */

.popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    z-index: 1;
    transition: opacity 0.2s;
}

.popup-close:hover {
    opacity: 1;
}

.popup-btn {
    display: inline-block;
    padding: 10px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.popup-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup-image {
    width: 100%;
    display: block;
    object-fit: cover;
}

.popup-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.popup-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 8px 0 12px;
    line-height: 1.2;
}

.popup-content {
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.popup-body {
    padding: 24px;
}

/* =========================================
   Two-column Layout (Landing Template)
   Balafon-style design
   ========================================= */

.popup-modal-landing {
    max-width: 820px;
    overflow: hidden;
    background: #fff;
}

.popup-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
}

/* --- Close button (landing) --- */
.popup-close-landing {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-size: 16px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    opacity: 1;
}
.popup-close-landing:hover {
    background: rgba(0,0,0,0.35);
    opacity: 1;
}

/* --- Left column (text) --- */
.popup-col-text {
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.popup-col-text-landing {
    position: relative;
    overflow: hidden;
    padding: 24px 28px 20px;
}

.popup-col-text-inner {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Decorative blur circles */
.popup-deco-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.popup-deco-circle-1 {
    left: -10%;
    top: -10%;
    width: 160px;
    height: 160px;
    background: rgba(255,255,255,0.18);
    filter: blur(40px);
}
.popup-deco-circle-2 {
    right: -8%;
    bottom: -12%;
    width: 176px;
    height: 176px;
    background: rgba(15,110,110,0.14);
    filter: blur(40px);
}

/* Decorative rings */
.popup-deco-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    pointer-events: none;
}
.popup-deco-ring-1 {
    left: 16px;
    top: 12px;
    width: 60px;
    height: 60px;
}
.popup-deco-ring-2 {
    left: 50px;
    top: 38px;
    width: 40px;
    height: 40px;
    border-color: rgba(255,255,255,0.14);
}

/* Heading (surtitre + logo) */
.popup-heading-landing {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #3a5a5e;
    opacity: 1;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.popup-heading-landing img {
    height: 42px;
    width: auto;
}

/* Title - large and impactful like Balafon */
.popup-title-landing {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.01em;
    margin: 0 0 18px;
}
.popup-title-landing span {
    display: block;
}

/* Content text */
.popup-content-landing {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Form */
.popup-form-landing {
    margin-top: 0;
    max-width: 100%;
    text-align: center;
}
.popup-form-landing input {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 8px;
    background: #fff;
    font-size: 0.95rem;
    color: #1a1a2e;
    outline: none;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.popup-form-landing input::placeholder {
    color: #999;
}
.popup-form-landing input:focus {
    box-shadow: 0 0 0 2px rgba(45,110,134,0.3);
}

/* CTA button */
.popup-btn-landing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0 32px;
    height: 44px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    transition: all 0.25s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.popup-btn-landing:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

/* Footer text */
.popup-footer-landing {
    margin-top: auto;
    padding-top: 16px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.7;
}
.popup-footer-landing a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 4px;
    font-size: 0.58rem;
    letter-spacing: 0.12em;
}

/* --- Right column (image) --- */
.popup-col-image {
    position: relative;
    overflow: hidden;
}
.popup-col-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-col-image-landing {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(246,248,249,1), rgba(229,237,239,1));
    padding: 16px 12px;
}

.popup-image-card-landing {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 320px;
    border-radius: 14px;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 24px rgba(26,54,65,0.10);
    /* animation removed - was causing layout shift */
}
.popup-image-card-landing img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}


/* =========================================
   Countdown Display
   ========================================= */

.popup-countdown {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 20px 0;
}

.popup-countdown-item {
    text-align: center;
}

.popup-countdown-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

.popup-countdown-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-top: 4px;
}

.popup-countdown-separator {
    font-size: 2rem;
    font-weight: 300;
    opacity: 0.3;
    align-self: center;
}

/* =========================================
   Form Elements (Newsletter Template)
   ========================================= */

.popup-form {
    margin-top: 16px;
}

.popup-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.popup-form input:focus {
    border-color: currentColor;
    outline: none;
}

.popup-form .popup-btn {
    width: 100%;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 768px) {
    .popup-modal { max-width: 95%; }
    .popup-modal-landing { max-width: 95%; }
    .popup-slidein { max-width: 90%; bottom: 10px; right: 5%; left: auto; }
    .popup-slidein.bottom-left { left: 5%; right: auto; }
    .popup-two-column { grid-template-columns: 1fr; }
    .popup-two-column .popup-col-image { max-height: 200px; }
    .popup-col-image-landing { min-height: 0; padding: 16px 12px; }
    .popup-image-card-landing { min-height: 220px; }
    .popup-title { font-size: 1.2rem; }
    .popup-title-landing { font-size: 2rem; }
    .popup-countdown-number { font-size: 1.5rem; }
}
