/**
 * Phone Landing Styles
 *
 * Styles for the phone number landing pages, including loading state
 * and placeholder handling for optimal performance.
 *
 * @package ticoneXion
 */

/* ==========================================================================
   Loading State - Shows while connecting animation
   ========================================================================== */

/* Hide body content while loading */
body.phone-landing-loading .phone-landing-content,
body.phone-landing-loading .site-main {
    opacity: 0;
    visibility: hidden;
}

/* Show content after reveal */
body.phone-landing-revealed .phone-landing-content,
body.phone-landing-revealed .site-main {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Loader Overlay
   ========================================================================== */

#phone-landing-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #030712 0%, #1E3A8A 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#phone-landing-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Loader Content */
.phone-loader-content {
    text-align: center;
    padding: 2rem;
}

/* Animated Phone Icon */
.phone-loader-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.phone-loader-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #60A5FA;
    stroke-width: 1.5;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

/* Animated rings around phone */
.phone-loader-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
}

.phone-loader-rings::before,
.phone-loader-rings::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(96, 165, 250, 0.3);
    border-radius: 50%;
    animation: ring-expand 1.5s ease-out infinite;
}

.phone-loader-rings::before {
    width: 100%;
    height: 100%;
}

.phone-loader-rings::after {
    width: 100%;
    height: 100%;
    animation-delay: 0.5s;
}

@keyframes ring-expand {
    0% {
        width: 80px;
        height: 80px;
        opacity: 0.8;
    }
    100% {
        width: 160px;
        height: 160px;
        opacity: 0;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.5));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(96, 165, 250, 0.8));
        transform: scale(1.05);
    }
}

/* Loader Text */
.phone-loader-text {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.phone-loader-subtext {
    color: #94A3B8;
    font-size: 0.9rem;
}

/* Loading dots animation */
.phone-loader-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 4px;
}

.phone-loader-dots span {
    width: 6px;
    height: 6px;
    background: #60A5FA;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.phone-loader-dots span:nth-child(1) { animation-delay: 0s; }
.phone-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.phone-loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ==========================================================================
   Placeholder Elements - Hidden until JS processes them
   ========================================================================== */

/* Elements with placeholder attribute stay hidden */
[data-phone-placeholder] {
    visibility: hidden;
    opacity: 0;
}

/* Class-based hiding for elements containing placeholders */
.phone-placeholder-hidden {
    visibility: hidden;
    opacity: 0;
}

/* Revealed state after JS processes */
.phone-revealed {
    visibility: visible !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Phone Number Display Styles
   ========================================================================== */

.ticonexion-phone-display {
    display: inline;
    font-weight: 700;
    color: #60A5FA;
}

.ticonexion-phone-number-wrapper {
    display: block;
}

/* Ensure phone elements have smooth reveal */
.ticonexion-phone-number-wrapper,
.ticonexion-phone-display {
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Connection Success Indicator (optional enhancement)
   ========================================================================== */

.phone-connection-success {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 20px;
    color: #22C55E;
    font-size: 0.875rem;
    margin-top: 1rem;
    animation: fade-in-up 0.5s ease;
}

.phone-connection-success svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Costa Rica Badge Enhancement
   ========================================================================== */

.phone-landing-main .cr-badge {
    animation: fade-in-up 0.5s ease 0.2s both;
}

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

@media (max-width: 768px) {
    .phone-loader-icon {
        width: 60px;
        height: 60px;
    }

    .phone-loader-text {
        font-size: 1.1rem;
    }

    .phone-loader-subtext {
        font-size: 0.85rem;
    }

    @keyframes ring-expand {
        0% {
            width: 60px;
            height: 60px;
            opacity: 0.8;
        }
        100% {
            width: 120px;
            height: 120px;
            opacity: 0;
        }
    }
}

/* ==========================================================================
   Print Styles - Show everything when printing
   ========================================================================== */

@media print {
    #phone-landing-loader {
        display: none !important;
    }

    body.phone-landing-loading .phone-landing-content,
    body.phone-landing-loading .site-main {
        opacity: 1 !important;
        visibility: visible !important;
    }

    [data-phone-placeholder],
    .phone-placeholder-hidden {
        visibility: visible !important;
        opacity: 1 !important;
    }
}
