/* ====================
   ADDRESS HERO MOBILE-FIRST STYLES
   Enhanced UX/UX for mobile devices with focus on autocomplete
   ==================== */

/* Mobile-First Base Variables */
:root {
    --touch-target-min: 44px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --border-radius: 12px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --z-suggestions: 9999;
    --z-backdrop: 9998;
}

/* Gradient background - Full Page */
.hero-background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f8faff 0%, #ffffff 50%, #f0f9ff 100%);
    z-index: -1;
    pointer-events: none;
}

.hero-background-gradient::before {
    content: '';
    position: absolute;
    top: 10%;
    right: -10%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-background-gradient::after {
    content: '';
    position: absolute;
    bottom: 10%;
    left: -10%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.06) 0%, transparent 70%);
    border-radius: 50%;
}

/* Container with better mobile spacing */
.address-hero-section {
    padding: var(--spacing-md) 0 var(--spacing-lg) 0;
    position: relative;
    text-align: center;
}

.hero-content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
    .hero-content-wrapper {
        padding: 0 var(--spacing-xl);
    }
}

@media (min-width: 1024px) {
    .hero-content-wrapper {
        max-width: 1400px;
    }
}

/* Enhanced Header */
.hero-header-enhanced {
    margin: 0 auto var(--spacing-md) auto;
    position: relative;
    z-index: 1;
    padding: var(--spacing-md) 0 0 0;
    max-width: 100%;
    width: 100%;
}

/* Premium Badge with highlight */
.hero-badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 24px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0 auto 1rem auto;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.hero-badge-premium .badge-icon {
    font-size: 1.125rem;
}

.hero-badge-premium .badge-highlight {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Title with highlight */
.hero-title-responsive {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
    color: #1a1a1a;
    font-family: var(--font-heading, 'Plus Jakarta Sans', -apple-system, sans-serif);
    text-align: center;
}

.title-highlight {
    color: #3b82f6;
    font-size: clamp(1.875rem, 7.5vw, 3rem);
    display: block;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.title-main {
    color: #1f2937;
    font-size: clamp(1.375rem, 5.5vw, 2.25rem);
    display: block;
    line-height: 1.3;
}

/* Enhanced Subtitle */
.hero-subtitle-enhanced {
    font-size: clamp(0.9375rem, 3.5vw, 1.0625rem);
    color: #6b7280;
    margin-bottom: var(--spacing-md);
    display: block;
    text-align: center;
    font-weight: 500;
}

/* Social Proof - Subtle and compact */
.social-proof {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
}

.proof-avatars {
    display: flex;
    align-items: center;
}

.proof-avatars .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border: 2px solid white;
    margin-left: -8px;
}

.proof-avatars .avatar:first-child {
    margin-left: 0;
}

.proof-avatars .avatar-more {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1e3a8a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    border: 2px solid white;
    margin-left: -8px;
}

.proof-text {
    font-size: 0.875rem;
    color: #4b5563;
    margin: 0;
}

.proof-text strong {
    color: #1f2937;
}

/* Enhanced Input Wrapper - Maximum prominence and centered */
.address-input-wrapper-enhanced {
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    max-width: 650px;
    background: white;
    padding: var(--spacing-xl);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.2);
    border: 2px solid rgba(59, 130, 246, 0.15);
    position: relative;
    text-align: left;
    display: block;
}

@media (min-width: 768px) {
    .address-input-wrapper-enhanced {
        max-width: 750px;
    }
}

@media (min-width: 1024px) {
    .address-input-wrapper-enhanced {
        max-width: 800px;
    }
}

.address-input-wrapper-enhanced::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa, #3b82f6);
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.address-input-wrapper-enhanced:hover::before {
    opacity: 0.3;
}

.input-label-enhanced {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.input-label-enhanced h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

@media (max-width: 480px) {
    .input-label-enhanced h3 {
        font-size: 1.25rem;
    }
}

@media (min-width: 640px) {
    .mobile-break {
        display: none;
    }
}

.input-label-enhanced p {
    font-size: 1.0625rem;
    color: #6b7280;
    margin: 0;
}

/* Address Input Container - Centered */
.address-input-container {
    max-width: 100%;
    margin: 0 auto;
}

.address-input-group {
    margin-bottom: var(--spacing-md);
}

/* Unified Input Field with Embedded Actions - Prominent */
.unified-input-field {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    transition: all var(--transition-fast);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-height: 60px;
}

.unified-input-field:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 8px 30px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* Touch-optimized action buttons */
.input-action-left,
.input-action-right {
    min-width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #6b7280;
    transition: all var(--transition-fast);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile: rendi l'icona GPS più piccola */
@media (max-width: 640px) {
    .input-action-left {
        min-width: 36px;
        width: 36px;
        padding: 0 0.25rem;
    }

    .input-action-left i {
        font-size: 0.875rem;
    }
}

.input-action-left:hover,
.input-action-right:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.input-action-left:active,
.input-action-right:active {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: scale(0.95);
}

.input-action-left i,
.input-action-right i {
    font-size: 1.125rem;
}

/* Input field optimized for mobile - Larger and more prominent */
.address-input-control {
    flex: 1;
    border: none;
    outline: none;
    padding: var(--spacing-md) var(--spacing-sm);
    font-size: 17px; /* Slightly larger but still prevents iOS zoom */
    background: transparent;
    min-height: 60px;
    color: #1a1a1a;
    font-weight: 500;
}

@media (max-width: 640px) {
    .address-input-control {
        padding: var(--spacing-md) var(--spacing-xs);
        font-size: 16px;
    }
}

.address-input-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-size: 16px;
}

@media (max-width: 640px) {
    .address-input-control::placeholder {
        font-size: 14px;
    }
}

/* Enhanced Analyze Button - More prominent */
.btn-analyze {
    min-width: 130px !important;
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white !important;
    border-radius: 0 13px 13px 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    padding: 0 var(--spacing-lg) !important;
    font-weight: 700 !important;
    font-size: 1.0625rem !important;
    transition: all var(--transition-normal) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-analyze:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af) !important;
    transform: translateX(2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

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

.btn-analyze .btn-text {
    display: inline;
    font-size: 1rem;
}

.btn-analyze i {
    font-size: 1.125rem;
}

@media (max-width: 479px) {
    .btn-analyze .btn-text {
        font-size: 0.875rem;
    }

    .btn-analyze {
        min-width: 100px !important;
    }
}

/* Enhanced hint text with privacy */
.input-hint-enhanced {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.input-hint-enhanced i {
    color: #10b981;
    font-size: 0.875rem;
}

.input-hint-enhanced small {
    color: #6b7280;
    font-size: 0.8125rem;
}

/* Loading indicator */
.search-loading-bar {
    height: 3px;
    background: #f3f4f6;
    border-radius: 3px;
    margin-top: var(--spacing-xs);
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    width: 30%;
    animation: loading-slide 1s ease-in-out infinite;
}

@keyframes loading-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Suggestions Overlay (Portal Pattern) - Mobile First */
.suggestions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-backdrop);
    display: flex;
    flex-direction: column;
    padding-top: 100px; /* Space for input */
}

.suggestions-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.suggestions-panel {
    position: relative;
    z-index: var(--z-suggestions);
    background: #ffffff;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Touch-optimized suggestion items */
.suggestion-item {
    display: flex;
    align-items: center;
    min-height: var(--touch-target-min);
    padding: var(--spacing-md);
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.suggestion-item:active {
    background-color: #f9fafb;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item.keyboard-active {
    background-color: #fef3c7;
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Icon for suggestions */
.suggestion-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    border-radius: 8px;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
    color: #f59e0b;
}

/* Suggestion text */
.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-primary {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-secondary {
    font-size: 0.8125rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* No results state */
.no-results {
    padding: var(--spacing-lg);
    text-align: center;
    color: #6b7280;
}

.no-results i {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    color: #d1d5db;
}

.no-results p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Error message */
.error-message {
    padding: var(--spacing-lg);
    text-align: center;
    color: #ef4444;
}

.error-message i {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.error-message p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Trust indicators (mobile-optimized) */
.trust-indicators-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    font-size: 0.8125rem;
    color: #6b7280;
    flex-wrap: wrap;
}

.indicator-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.indicator-item i {
    color: #10b981;
    font-size: 0.875rem;
}

.indicator-separator {
    color: #d1d5db;
}

/* Tablet adjustments (768px and up) */
@media (min-width: 768px) {
    .address-hero-section {
        padding: var(--spacing-lg) 0;
    }

    .hero-title-responsive {
        font-size: 2rem;
        margin-bottom: var(--spacing-md);
    }

    .hero-subtitle-mobile {
        font-size: 1.125rem;
    }

    /* Change overlay to dropdown on tablet/desktop */
    .suggestions-overlay {
        position: relative;
        padding-top: 0;
    }

    .suggestions-backdrop {
        display: none;
    }

    .suggestions-panel {
        position: absolute;
        top: calc(100% + var(--spacing-xs));
        left: 0;
        right: 0;
        max-height: 400px;
        border-radius: var(--border-radius);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    }

    .suggestion-item:hover {
        background-color: #f9fafb;
    }
}

/* Desktop adjustments (1024px and up) */
@media (min-width: 1024px) {
    .address-hero-section .container-fluid {
        max-width: 720px;
    }

    .unified-input-field {
        height: 56px;
    }

    .address-input-control {
        font-size: 1.125rem;
    }

    .input-action-left i,
    .input-action-right i {
        font-size: 1.25rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .unified-input-field {
        border-width: 3px;
    }

    .suggestion-item.keyboard-active {
        outline-width: 3px;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .address-hero-section {
        background: #1a1a1a;
    }

    .hero-title-responsive {
        color: #ffffff;
    }

    .hero-subtitle-mobile {
        color: #9ca3af;
    }

    .unified-input-field {
        background: #2d2d2d;
        border-color: #404040;
    }

    .address-input-control {
        color: #ffffff;
    }

    .suggestions-panel {
        background: #2d2d2d;
    }

    .suggestion-item {
        border-bottom-color: #404040;
    }

    .suggestion-primary {
        color: #ffffff;
    }

    .suggestion-secondary {
        color: #9ca3af;
    }
}

/* Enhanced Benefits Cards - Full Width */
.benefits-cards-full-width {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.benefit-card {
    background: white;
    border-radius: 16px;
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border: 1px solid rgba(59, 130, 246, 0.1);
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-width: 0;
    overflow: hidden;
}

.benefit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.2);
}

.benefit-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.benefit-icon i {
    color: white;
    font-size: 1.125rem;
}

.benefit-content {
    flex: 1;
    min-width: 0;
}

.benefit-content h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.125rem 0;
}

.benefit-content p {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
}

/* Tablet adjustments for benefits - 2 columns */
@media (min-width: 640px) {
    .benefits-cards-full-width {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
}

/* Desktop adjustments for benefits - 4 columns */
@media (min-width: 1024px) {
    .benefits-cards-full-width {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-lg);
        padding: var(--spacing-xl) var(--spacing-lg);
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    .benefit-card {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-lg);
    }

    .benefit-icon {
        width: 48px;
        height: 48px;
    }

    .benefit-icon i {
        font-size: 1.25rem;
    }

    .benefit-content h4 {
        font-size: 1rem;
    }

    .benefit-content p {
        font-size: 0.875rem;
    }
}

/* Animations for enhanced engagement */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Apply animations */
.hero-header-enhanced {
    animation: fadeInUp 0.6s ease-out;
}

.address-input-wrapper-enhanced {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.benefits-cards-full-width {
    animation: fadeInUp 1s ease-out 0.4s both;
}

.benefits-cards-full-width .benefit-card:nth-child(1) {
    animation: slideInFromLeft 0.6s ease-out 0.5s both;
}

.benefits-cards-full-width .benefit-card:nth-child(2) {
    animation: slideInFromLeft 0.6s ease-out 0.6s both;
}

.benefits-cards-full-width .benefit-card:nth-child(3) {
    animation: slideInFromLeft 0.6s ease-out 0.7s both;
}

.benefits-cards-full-width .benefit-card:nth-child(4) {
    animation: slideInFromLeft 0.6s ease-out 0.8s both;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .address-input-control {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }
}
