/* Force white theme to prevent blue background issue */
:root {
    --tg-theme-bg-color: #ffffff !important;
    --tg-theme-text-color: #000000 !important;
    --tg-theme-hint-color: #707579 !important;
    --tg-theme-button-color: #2481cc !important;
    --tg-theme-button-text-color: #ffffff !important;
    --tg-theme-secondary-bg-color: #f1f3f4 !important;
}

/* Force white background everywhere to fix blue bleeding issue */
html, body, .app-container, .wizard-header, .steps-container, .step {
    background: #ffffff !important;
}

/* Ensure header is completely white */
.wizard-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e5e5e5 !important;
}

/* Clean up back button to prevent any background issues */
.back-button {
    background: rgba(0, 0, 0, 0.08) !important; /* Slightly more visible but still clean */
}

/* Hide custom back button when Telegram is in fullscreen mode - preserve space for layout */
.back-button[data-hidden-by-fullscreen="true"] {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Make step counter clean */
.step-counter {
    color: #707579 !important;
    background: none !important;
}

#custom-services:not(:empty) {
    margin-top: 12px;
}

/* Fix status-message and hide it completely by default */
.status-message,
.status-message.info,
.status-message.loading,
.status-message.error,
.status-message.success {
    display: none !important; /* Completely hide by default */
}

/* Modal-style status messages with backdrop */
.status-message.show,
.status-message.info.show,
.status-message.loading.show,
.status-message.error.show,
.status-message.success.show {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important; /* Dark backdrop */
    z-index: 10001 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

.status-message.show::before,
.status-message.info.show::before,
.status-message.loading.show::before,
.status-message.error.show::before,
.status-message.success.show::before {
    content: attr(data-message) !important;
    background: #ffffff !important;
    border-radius: 20px !important;
    padding: 24px 28px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    border-left: 6px solid #10b981 !important; /* Default green */
    color: #000 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    max-width: 300px !important;
    text-align: center !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
}

/* Specific colors for different message types */
.status-message.error.show::before {
    border-left-color: #ef4444 !important;
    background: #ffffff !important;
    color: #dc2626 !important;
}

.status-message.success.show::before {
    border-left-color: #10b981 !important;
    background: #ffffff !important;
    color: #059669 !important;
}

.status-message.loading.show::before {
    border-left-color: #3b82f6 !important;
    background: #ffffff !important;
    color: #1d4ed8 !important;
}

/* Full-screen loading overlay - Modern 2025 Style */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.show .loading-content {
    transform: scale(1);
}

.loading-icon {
    font-size: 80px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
    animation: smoothFloat 3s ease-in-out infinite;
    transition: opacity 0.2s ease;
}

.loading-text {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: opacity 0.2s ease;
}

.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.loading-dots .dot {
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    animation: smoothBounce 1.4s ease-in-out infinite;
}

.loading-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Modern smooth animations */
@keyframes smoothFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

@keyframes smoothBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-16px) scale(1.2);
        opacity: 1;
    }
}

/* Comprehensive zoom and touch behavior prevention */
* {
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Prevent pinch zoom gestures */
html, body {
    touch-action: manipulation !important; /* Changed from pan-x pan-y to manipulation */
    -ms-touch-action: manipulation !important;
    overscroll-behavior: none !important;
    -webkit-user-scalable: no !important;
    -moz-user-scalable: no !important;
    -ms-user-scalable: no !important;
    user-scalable: no !important;
}

/* Specific button and interactive element zoom prevention */
button, .back-button, .skip-button, .step-back-button,
.clickable, .tab-button, .service-item, .paste-area {
    touch-action: manipulation !important;
    -webkit-user-scalable: no !important;
    user-scalable: no !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Additional spacing fallback when flex gap is not supported (older mobile browsers) */
@supports not (gap: 1rem) {
    #custom-services .service-card-clean + .service-card-clean {
        margin-top: 16px;
    }
}

/* Allow text selection in input fields */
input, textarea, [contenteditable] {
    -webkit-user-select: auto !important;
    user-select: auto !important;
    touch-action: manipulation !important;
}

/* Prevent zoom on focus for input fields on iOS */
input, textarea, select {
    font-size: 16px !important; /* Prevents zoom on iOS */
}
