/* ========================================
   CTV Registration Popup - Premium Style
   ======================================== */

/* Overlay */
.ctv-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ctv-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.ctv-popup {
    background: var(--white);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    position: relative;
    overflow: hidden;
    transform: scale(0.85) translateY(30px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.ctv-popup-overlay.active .ctv-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Close Button */
.ctv-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-600);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ctv-popup-close:hover {
    background: #fff;
    color: var(--error);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Header */
.ctv-popup-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, #6366f1 100%);
    padding: 36px 32px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ctv-popup-header::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: ctv-shimmer 4s ease-in-out infinite;
}

@keyframes ctv-shimmer {
    0%, 100% { transform: translateX(-30%) rotate(0deg); }
    50% { transform: translateX(30%) rotate(5deg); }
}

.ctv-popup-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--white);
    border-radius: 24px 24px 0 0;
}

.ctv-popup-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 26px;
    color: #fff;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: ctv-icon-pulse 2.5s ease-in-out infinite;
}

@keyframes ctv-icon-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
}

.ctv-popup-header h2 {
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.ctv-popup-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

/* Body */
.ctv-popup-body {
    padding: 24px 32px 20px;
}

/* Form */
.ctv-form-group {
    margin-bottom: 16px;
    position: relative;
}

.ctv-form-group label {
    display: none;
}

.ctv-form-group .ctv-input-wrapper {
    position: relative;
}

.ctv-form-group .ctv-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
    transition: color 0.25s ease;
    pointer-events: none;
    z-index: 1;
}

.ctv-form-group input,
.ctv-form-group select,
.ctv-form-group textarea {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 15px;
    font-family: var(--font-primary);
    border: 2px solid var(--gray-200);
    border-radius: 14px;
    background: var(--gray-50);
    color: var(--gray-800);
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

.ctv-form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.ctv-textarea-wrapper .ctv-input-icon {
    top: 18px;
    transform: none;
}

.ctv-form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 16px) center;
    padding-right: 40px;
}

.ctv-form-group input::placeholder,
.ctv-form-group textarea::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.ctv-form-group input:focus,
.ctv-form-group select:focus,
.ctv-form-group textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(70, 50, 218, 0.1);
}

.ctv-form-group input:focus + .ctv-input-icon,
.ctv-form-group input:focus ~ .ctv-input-icon,
.ctv-form-group select:focus ~ .ctv-input-icon,
.ctv-form-group textarea:focus ~ .ctv-input-icon {
    color: var(--primary);
}

/* Submit Button */
.ctv-submit-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-primary);
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ctv-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.ctv-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(70, 50, 218, 0.4);
}

.ctv-submit-btn:hover::before {
    left: 100%;
}

.ctv-submit-btn:active {
    transform: translateY(-1px);
}

.ctv-submit-btn i {
    font-size: 18px;
}

/* Countdown Section */
.ctv-countdown-section {
    padding: 0 32px 28px;
}

.ctv-countdown-label {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ctv-countdown-label i {
    font-size: 14px;
    animation: ctv-bell-ring 1.5s ease infinite;
}

@keyframes ctv-bell-ring {
    0%, 70%, 100% { transform: rotate(0); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-14deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-8deg); }
    50% { transform: rotate(4deg); }
    60% { transform: rotate(-2deg); }
}

.ctv-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ctv-countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 68px;
}

.ctv-countdown-value {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-dark);
    background: linear-gradient(145deg, #f0f2ff, #e8ebff);
    border-radius: 16px;
    border: 2px solid rgba(70, 50, 218, 0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ctv-countdown-value::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(70, 50, 218, 0.08);
}

.ctv-countdown-unit {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ctv-countdown-sep {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    padding-bottom: 22px;
    animation: ctv-blink 1s step-end infinite;
}

@keyframes ctv-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ========== Toast Notifications ========== */
.ctv-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    animation: ctv-toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.ctv-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    animation: ctv-toast-timer 4s linear forwards;
}

@keyframes ctv-toast-timer {
    from { width: 100%; }
    to { width: 0%; }
}

.ctv-toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.ctv-toast-error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.ctv-toast-error i {
    color: #dc2626;
}

.ctv-toast-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.ctv-toast-success i {
    color: #059669;
}

@keyframes ctv-toast-in {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ctv-toast-hide {
    animation: ctv-toast-out 0.4s ease forwards;
}

@keyframes ctv-toast-out {
    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
}

/* ========== Success Message ========== */
.ctv-success-message {
    text-align: center;
    padding: 28px 0;
}

.ctv-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    margin-bottom: 18px;
    animation: ctv-success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ctv-success-icon i {
    font-size: 36px;
    color: #059669;
}

@keyframes ctv-success-pop {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    60% {
        transform: scale(1.15);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ctv-success-message h3 {
    color: #111827;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.ctv-success-message p {
    color: #6B7280;
    font-size: 15px;
    line-height: 1.6;
}

/* ========== Responsive ========== */
@media (max-width: 520px) {
    .ctv-popup {
        max-width: 100%;
        border-radius: 20px;
    }

    .ctv-popup-header {
        padding: 28px 20px 24px;
    }

    .ctv-popup-header h2 {
        font-size: 20px;
    }

    .ctv-popup-header p {
        font-size: 13px;
    }

    .ctv-popup-body {
        padding: 20px 20px 16px;
    }

    .ctv-form-group input,
    .ctv-form-group select,
    .ctv-form-group textarea {
        padding: 12px 14px 12px 42px;
        font-size: 14px;
        border-radius: 12px;
    }

    .ctv-form-group .ctv-input-icon {
        left: 14px;
        font-size: 14px;
    }

    .ctv-submit-btn {
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 12px;
    }

    .ctv-countdown-section {
        padding: 0 20px 24px;
    }

    .ctv-countdown-value {
        width: 56px;
        height: 56px;
        font-size: 22px;
        border-radius: 12px;
    }

    .ctv-countdown-item {
        min-width: 58px;
    }

    .ctv-countdown-gap {
        gap: 6px;
    }

    .ctv-popup-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .ctv-popup-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}
