/* Accessibility Critical Fixes - Casa Alta
   P0: Improve WCAG compliance from 3/10 to basic compliance
   Focus: Critical accessibility barriers for mobile users */

/* 1. FOCUS MANAGEMENT - Critical for keyboard navigation */
:focus {
    outline: 3px solid #f4a261 !important;
    outline-offset: 2px !important;
    background-color: rgba(244, 162, 97, 0.1) !important;
}

button:focus,
.lang-btn:focus,
.cta-primary:focus,
.cta-secondary:focus,
.pricing-cta:focus {
    outline: 3px solid #f4a261 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(244, 162, 97, 0.3) !important;
}

/* Skip to main content link - WCAG requirement */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--dark);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #f4a261;
}

/* 2. COLOR CONTRAST - WCAG AA compliance */
.urgency-bar {
    background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
    color: #ffffff !important;
}

.hero .subtitle {
    color: #f8f9fa !important;
    opacity: 1 !important;
}

.section-subtitle {
    color: #495057 !important;
}

.review-text {
    color: #212529 !important;
}

.pricing-period {
    opacity: 1 !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* 3. TEXT ALTERNATIVES AND LABELS */
.trust-item .icon::before {
    content: attr(aria-label);
    position: absolute;
    left: -10000px;
}

/* 4. INTERACTIVE ELEMENTS - Minimum 44px touch targets */
.lang-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

.whatsapp-float {
    min-width: 56px;
    min-height: 56px;
}

/* All buttons and links minimum touch target */
button,
.cta-primary,
.cta-secondary,
.pricing-cta,
a[href^="tel:"],
a[href^="mailto:"],
a[href^="https://wa.me/"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
}

/* 5. READABLE FONTS AND SPACING */
body {
    font-size: 16px !important;
    line-height: 1.6 !important;
}

.hero h1 {
    line-height: 1.2 !important;
}

.section-title {
    line-height: 1.3 !important;
}

p, li {
    line-height: 1.6 !important;
    margin-bottom: 1rem;
}

/* 6. FORM ACCESSIBILITY */
input, select, textarea {
    border: 2px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

input:focus, select:focus, textarea:focus {
    border-color: #f4a261 !important;
    outline: 3px solid rgba(244, 162, 97, 0.3) !important;
    outline-offset: 0 !important;
}

/* 7. ERROR AND SUCCESS STATES */
.error-state {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.success-state {
    border-color: #28a745 !important;
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.error-message {
    color: #721c24 !important;
    background-color: #f8d7da !important;
    border: 1px solid #f5c6cb !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
    margin-top: 0.5rem !important;
}

.success-message {
    color: #155724 !important;
    background-color: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
    margin-top: 0.5rem !important;
}

/* 8. ANIMATION RESPECT - Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .urgency-bar,
    .hero-badge,
    .whatsapp-float {
        animation: none !important;
    }
}

/* 9. HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
    .cta-primary {
        background: #000000 !important;
        color: #ffffff !important;
        border: 3px solid #ffffff !important;
    }
    
    .cta-secondary {
        background: #ffffff !important;
        color: #000000 !important;
        border: 3px solid #000000 !important;
    }
    
    .pricing-card {
        border: 3px solid #000000 !important;
    }
}

/* 10. MOBILE ACCESSIBILITY */
@media (max-width: 768px) {
    /* Larger touch targets on mobile */
    .lang-btn {
        min-height: 48px;
        min-width: 48px;
        margin: 0.2rem;
    }
    
    .whatsapp-float {
        min-width: 60px;
        min-height: 60px;
        bottom: 24px;
        right: 24px;
    }
    
    /* Improve text readability */
    .hero h1 {
        font-size: clamp(2.2rem, 8vw, 3.5rem) !important;
    }
    
    .hero .subtitle {
        font-size: clamp(1rem, 4vw, 1.3rem) !important;
    }
    
    /* Better spacing for mobile */
    .cta-container {
        gap: 1rem !important;
    }
    
    .pricing-card {
        margin: 1rem 0.5rem !important;
    }
    
    /* Ensure adequate spacing between interactive elements */
    .trust-indicators {
        gap: 1.5rem !important;
    }
}

/* 11. KEYBOARD NAVIGATION IMPROVEMENTS */
.skip-nav:focus,
.nav-link:focus,
.cta-primary:focus,
.cta-secondary:focus {
    z-index: 1000;
    position: relative;
}

/* Tab order optimization */
.lang-switcher {
    order: 1;
}

.hero-content {
    order: 2;
}

/* 12. ARIA LIVE REGIONS FOR DYNAMIC CONTENT */
.countdown[role="timer"] {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 1rem;
}

.countdown-item {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Status indicators */
.status-available {
    font-weight: 700;
    color: #28a745;
}

.status-unavailable {
    font-weight: 700;
    color: #dc3545;
}

/* 13. PRINT ACCESSIBILITY */
@media print {
    .whatsapp-float,
    .urgency-bar,
    .lang-switcher {
        display: none !important;
    }
    
    .hero {
        background: none !important;
        color: #000000 !important;
    }
    
    .cta-primary::after {
        content: " (WhatsApp: +34 660 560 634)" !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")" !important;
        font-size: 0.8em !important;
        color: #666 !important;
    }
}

/* 14. LOADING STATES - Accessibility for slow connections */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #f4a261;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #6c757d;
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* 15. SEMANTIC IMPROVEMENTS */
.pricing-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.pricing-card {
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    background: #ffffff;
    border: 2px solid transparent;
}

.pricing-card:focus-within {
    border-color: #f4a261;
    transform: translateY(-4px);
}

/* Ensure proper heading hierarchy */
.section-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.pricing-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}