/**
 * Tonic Abandoned Cart Popup Styles
 *
 * @package Tonic_Abandoned_Cart
 * @since 1.0.0
 */

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

.tonic-popup {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 99999;
    display: none;
}

/* Dark overlay */
.tonic-popup-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background-color: #000;
    opacity: 0.5;
    z-index: 1;
}

/* Main popup container */
.tonic-popup-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 900px;
    max-width: 95%;
}

/* Content wrapper (image + form) */
.tonic-popup-content {
    display: flex;
    background-color: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    min-height: 500px;
    position: relative;
}

/* ========================================
   LEFT IMAGE SECTION
   ======================================== */

.tonic-popup-image {
    width: 35%;
    flex-shrink: 0;
}

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

/* ========================================
   RIGHT BODY/FORM SECTION
   ======================================== */

.tonic-popup-body {
    width: 65%;
    padding: 70px 55px;
    text-align: center;
    position: relative;
}

/* Close button */
.tonic-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    padding: 5px;
    line-height: 1;
    transition: opacity 0.2s;
    z-index: 10;
}

.tonic-popup-close:hover {
    opacity: 0.6;
}

.tonic-popup-close svg {
    display: block;
}

/* ========================================
   STEP TRANSITIONS
   ======================================== */

.tonic-popup-steps-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.tonic-popup-step {
    width: 100%;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.tonic-popup-step.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

/* Eyebrow text */
.tonic-popup-eyebrow {
    display: block;
    font-family: 'Sweet Sans Pro Medium', 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    letter-spacing: 3px;
    color: #333;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Main title */
.tonic-popup-title {
    font-family: 'IvyOra Display Light', 'Times New Roman', serif;
    font-size: 52px;
    line-height: 1.05;
    color: #1a1a1a;
    margin: 0 0 20px 0;
    font-weight: 300;
}

/* Subtitle */
.tonic-popup-subtitle {
    font-family: 'HK Grotesk Regular', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    color: #555;
    margin: 0 0 30px 0;
}

/* Terms text */
.tonic-popup-terms {
    font-family: 'HK Grotesk Regular', 'Helvetica Neue', Arial, sans-serif;
    font-size: 11px;
    line-height: 1.5;
    color: #888;
    margin: 20px 0 15px 0;
    text-align: center;
}

.tonic-popup-terms a {
    color: #888;
    text-decoration: underline;
}

.tonic-popup-terms a:hover {
    color: #555;
}

/* ========================================
   FORM FIELDS
   ======================================== */

.tonic-popup-field {
    position: relative;
    margin-bottom: 20px;
}

.tonic-popup-field-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tonic-popup-field-icon svg {
    width: 22px;
    height: 22px;
}

/* Input fields */
.tonic-popup input[type="email"],
.tonic-popup input[type="text"] {
    width: 100%;
    padding: 18px 18px 18px 55px;
    font-family: 'HK Grotesk Regular', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    border: none;
    border-radius: 50px;
    background-color: #f7f5f1;
    color: #333;
    outline: none;
    box-sizing: border-box;
    transition: box-shadow 0.2s;
}

.tonic-popup input[type="email"]::placeholder,
.tonic-popup input[type="text"]::placeholder {
    color: #888;
}

.tonic-popup input[type="email"]:focus,
.tonic-popup input[type="text"]:focus {
    box-shadow: 0 0 0 2px #957b66;
}

.tonic-popup input.invalid-input {
    box-shadow: 0 0 0 2px #dc3545;
}

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

.tonic-popup-btn {
    display: block;
    width: 100%;
    padding: 18px 30px;
    font-family: 'Knockout Junior Welter', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
    background-color: #957b66;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.tonic-popup-btn:hover {
    background-color: #806a58;
}

.tonic-popup-btn:active {
    transform: scale(0.98);
}

.tonic-popup-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Skip link */
.tonic-popup-skip {
    display: inline-block;
    margin-top: 15px;
    font-family: 'HK Grotesk Regular', 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
}

.tonic-popup-skip:hover {
    color: #555;
}

/* ========================================
   COUPON DISPLAY
   ======================================== */

.tonic-popup-coupon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: #f7f5f1;
    padding: 20px 30px;
    border-radius: 8px;
    margin: 25px 0 15px;
    border: 2px dashed #957b66;
}

.tonic-popup-coupon-code {
    font-family: 'HK Grotesk Regular', monospace;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #000;
}

.tonic-popup-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #957b66;
    padding: 5px;
    transition: transform 0.2s;
}

.tonic-popup-copy-btn:hover {
    transform: scale(1.1);
}

.tonic-popup-copied {
    display: block;
    font-family: 'HK Grotesk Regular', sans-serif;
    font-size: 13px;
    color: #28a745;
    margin-bottom: 15px;
}

.tonic-popup-expiry {
    font-family: 'HK Grotesk Regular', sans-serif;
    font-size: 13px;
    line-height: 1.3;
    color: #888;
    margin: 0 0 25px 0;
}

/* ========================================
   LOADING STATE
   ======================================== */

.tonic-popup-btn.loading {
    position: relative;
    color: transparent;
}

.tonic-popup-btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tonic-popup-spin 0.8s linear infinite;
}

@keyframes tonic-popup-spin {
    to {
        transform: rotate(360deg);
    }
}

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

@media (max-width: 768px) {
    .tonic-popup-container {
        max-width: 92%;
        max-height: 90vh;
    }
    
    .tonic-popup-content {
        flex-direction: column;
        min-height: auto;
        max-height: 90vh;
        overflow: hidden;
    }
    
    .tonic-popup-image {
        width: 100%;
        height: 180px;
        flex-shrink: 0;
    }
    
    .tonic-popup-body {
        width: 100%;
        padding: 35px 25px;
        box-sizing: border-box;
        overflow-y: auto;
        flex: 1;
        position: static; /* Allow close button to position relative to .tonic-popup-content */
    }
    
    .tonic-popup-steps-wrapper {
        position: relative;
        min-height: auto;
    }
    
    .tonic-popup-step {
        position: relative;
        display: none;
    }
    
    .tonic-popup-step.active {
        display: block;
    }
    
    .tonic-popup-title {
        font-size: 48px;
    }
    
    /* Position X button over the image on mobile */
    .tonic-popup-close {
        position: absolute;
        top: 15px;
        right: 15px;
        z-index: 20;
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        padding: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

@media (max-width: 480px) {
    .tonic-popup-image {
        height: 140px;
    }
    
    .tonic-popup-body {
        padding: 25px 20px;
    }
    
    .tonic-popup-title {
        font-size: 48px;
    }
    
    .tonic-popup-eyebrow {
        font-size: 10px;
    }
    
    .tonic-popup-btn {
        padding: 15px 25px;
        font-size: 13px;
    }
    
    .tonic-popup input[type="email"],
    .tonic-popup input[type="text"] {
        padding: 15px 15px 15px 50px;
        font-size: 14px;
    }
    
    .tonic-popup-coupon-code {
        font-size: 16px;
        letter-spacing: 2px;
    }
    
    .tonic-popup-coupon-box {
        padding: 15px 20px;
    }
}

/* ========================================
   STICKY BADGE (after dismissal)
   ======================================== */

.tonic-popup-badge {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: #000;
    color: #fff;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'HK Grotesk Regular', 'Helvetica Neue', Arial, sans-serif;
}

.tonic-popup-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Badge close button */
.tonic-popup-badge-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
    z-index: 1;
}

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

.tonic-popup-badge-close:hover {
    background: #333;
    transform: scale(1.1);
}

.tonic-popup-badge-close svg {
    color: #fff;
}

.tonic-popup-badge:active {
    transform: scale(0.98);
}

.tonic-popup-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tonic-badge-pulse 2s ease-in-out infinite;
}

.tonic-popup-badge-icon svg {
    width: 18px;
    height: 18px;
}

.tonic-popup-badge-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Subtle pulse animation for the badge icon */
@keyframes tonic-badge-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}

/* Mobile adjustments for badge */
@media (max-width: 768px) {
    .tonic-popup-badge {
        bottom: 16px;
        left: 16px;
        padding: 12px 16px;
    }
    
    .tonic-popup-badge-text {
        font-size: 13px;
    }
    
    .tonic-popup-badge-icon svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .tonic-popup-badge {
        bottom: 12px;
        left: 12px;
        padding: 10px 14px;
        gap: 6px;
    }
    
    .tonic-popup-badge-text {
        font-size: 12px;
    }
    
    .tonic-popup-badge-icon svg {
        width: 14px;
        height: 14px;
    }
}
