/* ========================================
   🔧 ERROR FIXES - TAZDUCA
   Corrección de errores y estilos faltantes
======================================== */

/* ===== ESTILOS DE ERROR PARA FORMULARIOS ===== */
.error {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1) !important;
}

.error::placeholder {
    color: #dc3545 !important;
    opacity: 0.7;
}

/* ===== PREVENCIÓN DE SCROLL EN MÓVIL ===== */
body.mobile-menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

/* ===== ESTILOS PARA IMÁGENES LAZY LOADING ===== */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

img.fade-in {
    animation: fadeInImage 0.5s ease-in-out;
}

@keyframes fadeInImage {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== FALLBACKS PARA IMÁGENES FALTANTES ===== */
img[src*="hero-jardin.jpg"] {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

img[src*="hero-jardin.jpg"]::before {
    content: "🌿 Jardín";
    font-size: 2rem;
}

/* ===== CORRECCIONES DE CONSOLA ===== */
.console-error-fix {
    display: none !important;
}

/* ===== ESTILOS PARA ELEMENTOS DE CONTACTO ===== */
.contact-btn,
.btn-cotizar,
.cta-button {
    transition: transform 0.15s ease;
    cursor: pointer;
}

.contact-btn:active,
.btn-cotizar:active,
.cta-button:active {
    transform: scale(0.95);
}

/* ===== CORRECCIÓN DE SCROLL SUAVE ===== */
html {
    scroll-behavior: smooth;
}

/* ===== MEJORAS DE ACCESIBILIDAD ===== */
[aria-hidden="true"] {
    display: none !important;
}

[aria-expanded="false"] + .premium-mobile-menu {
    visibility: hidden;
    opacity: 0;
}

[aria-expanded="true"] + .premium-mobile-menu {
    visibility: visible;
    opacity: 1;
}

/* ===== CORRECCIONES PARA DESARROLLO ===== */
.debug-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 10000;
    display: none;
}

/* Solo mostrar en desarrollo */
body[data-env="development"] .debug-info {
    display: block;
}

/* ===== PREVENCIÓN DE ERRORES DE JAVASCRIPT ===== */
.js-error-boundary {
    min-height: 1px;
}

/* Ocultar elementos hasta que JS cargue completamente */
.js-dependent {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.js-loaded .js-dependent {
    opacity: 1;
}

/* ===== OPTIMIZACIONES DE RENDIMIENTO ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

img, video {
    max-width: 100%;
    height: auto;
}

/* ===== CORRECCIONES ESPECÍFICAS PARA MÓVIL ===== */
@media (max-width: 768px) {
    /* Prevenir zoom en inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Mejorar área de toque */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ===== ESTILOS DE CARGA ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: var(--primary-red, #ff0000);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}