/**
 * Custom Styles
 * Loading states, error states, and dynamic content enhancements
 */

/* Loading States */
.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Loading animation */
@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Error States */
.has-error {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

.has-error::placeholder {
    color: #dc3545;
}

/* Smooth transitions for dynamic content */
[data-dynamic-contact],
[data-dynamic="services-dropdown"],
[data-dynamic="navigation"],
[data-dynamic="hero-slider"],
[data-dynamic-social] {
    transition: opacity 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}

/* Contact info links - ensure they're visible */
[data-dynamic-contact] {
    display: inline-block;
    min-width: 100px;
}

/* Services dropdown styling */
select[data-dynamic="services-dropdown"] {
    min-height: 40px;
    transition: all 0.3s ease;
}

select[data-dynamic="services-dropdown"]:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Social links */
[data-dynamic-social] {
    display: inline-block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

[data-dynamic-social]:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

/* Navigation items */
[data-dynamic="navigation"] li {
    transition: background-color 0.2s ease;
}

/* Loading spinner for various elements */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Accessibility improvements */
.is-loading:focus,
.is-loading:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Fade in animation for dynamic content */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

[data-dynamic-contact],
[data-dynamic="services-dropdown"],
[data-dynamic-social] {
    animation: fadeIn 0.3s ease;
}

/* Print styles - hide loading states in print */
@media print {
    .is-loading,
    .is-loading::after,
    .spinner {
        display: none !important;
    }

    [data-dynamic-contact],
    [data-dynamic="services-dropdown"],
    [data-dynamic-social] {
        animation: none;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .is-loading::after {
        width: 16px;
        height: 16px;
        border-width: 1px;
    }

    select[data-dynamic="services-dropdown"] {
        min-height: 36px;
        font-size: 16px;
    }
}

/* ============================================
   Welcome Popup Modal Styles
   ============================================ */

/* Popup Overlay - Full screen backdrop */
.welcome-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
    overflow-y: auto;
}

/* Show popup when active */
.welcome-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.welcome-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: popupSlideIn 0.5s ease forwards;
}

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

@keyframes popupSlideIn {
    from {
        transform: scale(0.8) translateY(30px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.welcome-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.welcome-popup-close:hover {
    background: #dc3545;
    color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.welcome-popup-close i {
    font-size: 18px;
    color: #333;
    transition: color 0.3s ease;
}

.welcome-popup-close:hover i {
    color: #ffffff;
}

/* Popup Content */
.welcome-popup-content {
    position: relative;
}

/* Banner Wrapper */
.popup-banner-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Banner Image */
.popup-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 450px;
    transition: transform 0.3s ease;
}

.popup-banner-wrapper:hover .popup-banner-image {
    transform: scale(1.05);
}

/* Text Content Section */
.popup-text-content {
    padding: 30px 40px;
    text-align: center;
    background: #ffffff;
}

.popup-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.popup-description {
    font-size: 16px;
    color: #666;
    margin: 0 0 25px 0;
    line-height: 1.6;
}

/* CTA Button */
.popup-cta {
    display: inline-block;
    padding: 14px 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.popup-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: #ffffff;
}

/* Alternative: Banner-only style (hide text content) */
.welcome-popup-overlay.banner-only .popup-text-content {
    display: none;
}

.welcome-popup-overlay.banner-only .popup-banner-wrapper {
    border-radius: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .welcome-popup-overlay {
        padding: 15px;
    }

    .welcome-popup-container {
        max-width: 100%;
        border-radius: 15px;
    }

    .welcome-popup-close {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }

    .welcome-popup-close i {
        font-size: 16px;
    }

    .popup-banner-image {
        max-height: 300px;
    }

    .popup-text-content {
        padding: 25px 20px;
    }

    .popup-title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .popup-description {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .popup-cta {
        padding: 12px 28px;
        font-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .popup-title {
        font-size: 20px;
    }

    .popup-banner-image {
        max-height: 250px;
    }
}
