/* ==========================================================================
   ARGENTINA EXTREMA CONTACT FORM - MÁXIMA ESPECIFICIDAD
   Para subir a /css/aex-contact-form.css
   Sobrescribe Bootstrap y otros CSS con máxima prioridad
   ========================================================================== */

/* ==========================================================================
   INDICADOR DE CARGA (DEBUG - REMOVER EN PRODUCCIÓN)
   ========================================================================== */
.aex-contact-form::before {
    content: "✅ AEX CONTACT CSS LOADED";
    position: fixed;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    z-index: 99999;
    font-size: 10px;
    border-radius: 4px;
    font-family: monospace;
    display: none; /* Cambiar a 'block' para debug */
}

/* ==========================================================================
   VARIABLES CSS CON NAMESPACE
   ========================================================================== */
.aex-contact-form {
    --aex-primary: #fd7e14;
    --aex-primary-dark: #e8650e;
    --aex-primary-light: rgba(253, 126, 20, 0.1);
    --aex-success: #28a745;
    --aex-danger: #dc3545;
    --aex-light: #f8f9fa;
    --aex-border: #dee2e6;
    --aex-text: #495057;
    --aex-text-muted: #6c757d;
    --aex-border-radius: 8px;
    --aex-transition: all 0.2s ease;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
}

/* ==========================================================================
   LAYOUT PRINCIPAL - MINIMALISTA Y ANCHO (80% de la pantalla)
   ========================================================================== */
html body .aex-contact-form .form-wrapper {
    max-width: 80% !important;
    width: 80% !important;
    margin: 0 auto !important;
}

@media (min-width: 768px) {
    html body .aex-contact-form .form-wrapper {
        max-width: 85% !important;
        width: 85% !important;
    }
}

@media (min-width: 1200px) {
    html body .aex-contact-form .form-wrapper {
        max-width: 80% !important;
        width: 80% !important;
    }
}

@media (min-width: 1400px) {
    html body .aex-contact-form .form-wrapper {
        max-width: 75% !important;
        width: 75% !important;
    }
}

html body .aex-contact-form .modern-card {
    border: 1px solid var(--aex-border) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    background: white !important;
}

html body .aex-contact-form .card-header.bg-gradient {
    background: linear-gradient(135deg, var(--aex-primary), var(--aex-primary-dark)) !important;
    border: none !important;
    padding: 1rem 1.5rem !important;
    text-align: center !important;
}

html body .aex-contact-form .card-header h3 {
    color: white !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

html body .aex-contact-form .card-header p {
    color: rgba(255, 255, 255, 0.9) !important;
    margin: 0.25rem 0 0 0 !important;
    font-size: 0.85rem !important;
}

/* ==========================================================================
   CARD BODY Y ESPACIADO - COMPACTO Y MINIMALISTA
   ========================================================================== */
html body .aex-contact-form .card-body {
    padding: 1.25rem 2rem !important;
}

html body .aex-contact-form .row.g-4 > * {
    margin-bottom: 0.75rem !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

html body .aex-contact-form .row.g-4 > *:last-child {
    margin-bottom: 0 !important;
}

/* ==========================================================================
   FORM FLOATING - COMPACTO
   ========================================================================== */
html body .aex-contact-form .form-floating {
    position: relative !important;
    margin-bottom: 0 !important;
}

html body .aex-contact-form .form-floating > .form-control,
html body .aex-contact-form .form-floating > .form-select {
    height: auto !important;
    padding: 1rem 0.875rem 0.375rem 0.875rem !important;
    border: 1px solid var(--aex-border) !important;
    border-radius: var(--aex-border-radius) !important;
    background: white !important;
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
    transition: var(--aex-transition) !important;
    box-shadow: none !important;
    min-height: 3rem !important;
}

html body .aex-contact-form .form-floating > .form-control:focus,
html body .aex-contact-form .form-floating > .form-select:focus {
    border-color: var(--aex-primary) !important;
    background: white !important;
    box-shadow: 0 0 0 2px var(--aex-primary-light) !important;
    outline: none !important;
}

html body .aex-contact-form .form-floating > .form-control:not(:placeholder-shown),
html body .aex-contact-form .form-floating > .form-control:focus,
html body .aex-contact-form .form-floating > .form-select:focus,
html body .aex-contact-form .form-floating > .form-select:not([multiple]):not([size]) {
    padding-top: 1.25rem !important;
    padding-bottom: 0.375rem !important;
}

/* ==========================================================================
   LABELS FLOTANTES - COMPACTOS
   ========================================================================== */
html body .aex-contact-form .form-floating > label {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0.875rem !important;
    pointer-events: none !important;
    border: none !important;
    background: transparent !important;
    color: var(--aex-text-muted) !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    transition: var(--aex-transition) !important;
    transform-origin: 0 0 !important;
    display: flex !important;
    align-items: center !important;
    z-index: 2 !important;
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
    white-space: normal !important;
}

html body .aex-contact-form .form-floating > .form-control:focus ~ label,
html body .aex-contact-form .form-floating > .form-control:not(:placeholder-shown) ~ label,
html body .aex-contact-form .form-floating > .form-select:focus ~ label,
html body .aex-contact-form .form-floating > .form-select:not([multiple]):not([size]) ~ label {
    opacity: 1 !important;
    transform: scale(0.75) translateY(-0.5rem) !important;
    color: var(--aex-primary) !important;
    background: white !important;
    padding: 0.125rem 0.375rem !important;
    width: auto !important;
    height: auto !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    font-size: 0.7rem !important;
}

/* Iconos en labels */
html body .aex-contact-form .form-floating > label i {
    margin-right: 0.4rem !important;
    color: var(--aex-primary) !important;
    font-size: 0.85rem !important;
}

/* ==========================================================================
   CAMPO DE CELULAR - REDISEÑADO COMPLETAMENTE
   ========================================================================== */
html body .aex-contact-form .phone-container {
    position: relative !important;
}

/* Wrapper principal del campo celular */
html body .aex-contact-form .phone-field-wrapper {
    position: relative !important;
    border: 1px solid var(--aex-border) !important;
    border-radius: var(--aex-border-radius) !important;
    background: white !important;
    transition: var(--aex-transition) !important;
    min-height: 3rem !important;
    display: flex !important;
    align-items: stretch !important;
}

html body .aex-contact-form .phone-field-wrapper:focus-within {
    border-color: var(--aex-primary) !important;
    box-shadow: 0 0 0 2px var(--aex-primary-light) !important;
}

html body .aex-contact-form .phone-field-wrapper.is-invalid {
    border-color: var(--aex-danger) !important;
    background: #fff5f5 !important;
}

html body .aex-contact-form .phone-field-wrapper.is-valid {
    border-color: var(--aex-success) !important;
    background: #f8fff8 !important;
}

/* Label flotante para celular */
html body .aex-contact-form .phone-floating-label {
    position: absolute !important;
    top: 0 !important;
    left: 0.875rem !important;
    background: white !important;
    padding: 0.125rem 0.375rem !important;
    font-size: 0.7rem !important;
    color: var(--aex-primary) !important;
    font-weight: 600 !important;
    z-index: 10 !important;
    border-radius: 3px !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
}

html body .aex-contact-form .phone-floating-label i {
    margin-right: 0.4rem !important;
    color: var(--aex-primary) !important;
    font-size: 0.65rem !important;
}

/* Select de país */
html body .aex-contact-form .phone-field-wrapper .country-select {
    border: none !important;
    background: transparent !important;
    padding: 1rem 0.5rem 0.375rem 0.875rem !important;
    max-width: 110px !important;
    min-width: 100px !important;
    font-size: 0.8rem !important;
    border-right: 1px solid var(--aex-border) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex: 0 0 auto !important;
    outline: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.5rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1rem !important;
    padding-right: 2rem !important;
}

/* Input de teléfono */
html body .aex-contact-form .phone-field-wrapper .phone-input {
    border: none !important;
    background: transparent !important;
    padding: 1rem 0.875rem 0.375rem 0.875rem !important;
    flex: 1 1 auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    font-size: 0.9rem !important;
    outline: none !important;
    min-width: 0 !important;
}

html body .aex-contact-form .phone-field-wrapper .country-select:focus,
html body .aex-contact-form .phone-field-wrapper .phone-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Feedback de error para celular */
html body .aex-contact-form .phone-feedback {
    display: block !important;
    font-size: 0.75rem !important;
    color: var(--aex-danger) !important;
    margin-top: 0.2rem !important;
}

/* Hint container */
html body .aex-contact-form .phone-hint-container {
    margin-top: 0.2rem !important;
}

html body .aex-contact-form .phone-format-hint {
    font-size: 0.7rem !important;
    color: var(--aex-text-muted) !important;
}

/* ==========================================================================
   TEXTAREA PERSONALIZADO - COMPACTO
   ========================================================================== */
html body .aex-contact-form .modern-textarea {
    min-height: 80px !important;
    resize: vertical !important;
    font-family: inherit !important;
}

/* ==========================================================================
   CHECKBOX - COMPACTO
   ========================================================================== */
html body .aex-contact-form .modern-checkbox {
    background: white !important;
    border: 1px solid var(--aex-border) !important;
    border-radius: var(--aex-border-radius) !important;
    padding: 0.625rem !important;
    transition: var(--aex-transition) !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    position: relative !important;
}

html body .aex-contact-form .modern-checkbox:hover {
    border-color: var(--aex-primary) !important;
    background: white !important;
}

html body .aex-contact-form .modern-checkbox .form-check-input {
    width: 1rem !important;
    height: 1rem !important;
    margin: 0 !important;
    border: 1px solid var(--aex-border) !important;
    border-radius: 3px !important;
    background: white !important;
    flex-shrink: 0 !important;
    margin-top: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    float: none !important;
}

html body .aex-contact-form .modern-checkbox .form-check-input:checked {
    background-color: var(--aex-primary) !important;
    border-color: var(--aex-primary) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
}

html body .aex-contact-form .modern-checkbox .form-check-input:focus {
    border-color: var(--aex-primary) !important;
    box-shadow: 0 0 0 2px var(--aex-primary-light) !important;
}

html body .aex-contact-form .modern-checkbox .form-check-label {
    margin-left: 0.625rem !important;
    font-size: 0.85rem !important;
    color: var(--aex-text) !important;
    cursor: pointer !important;
    line-height: 1.3 !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    position: relative !important;
}

html body .aex-contact-form .modern-checkbox .form-check-label i {
    color: var(--aex-primary) !important;
    margin-right: 0.4rem !important;
    font-size: 0.8rem !important;
}

/* ==========================================================================
   BOTÓN DE ENVÍO - COMPACTO
   ========================================================================== */
html body .aex-contact-form .modern-submit-btn {
    background: linear-gradient(135deg, var(--aex-primary), var(--aex-primary-dark)) !important;
    border: none !important;
    color: white !important;
    padding: 0.625rem 1.75rem !important;
    border-radius: var(--aex-border-radius) !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    transition: var(--aex-transition) !important;
    position: relative !important;
    overflow: hidden !important;
    min-width: 140px !important;
    text-decoration: none !important;
    cursor: pointer !important;
    display: inline-block !important;
}

html body .aex-contact-form .modern-submit-btn:hover {
    background: linear-gradient(135deg, var(--aex-primary-dark), var(--aex-primary)) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.3) !important;
    color: white !important;
    text-decoration: none !important;
}

html body .aex-contact-form .modern-submit-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px var(--aex-primary-light) !important;
    color: white !important;
}

html body .aex-contact-form .modern-submit-btn:active {
    transform: translateY(0) !important;
}

html body .aex-contact-form .modern-submit-btn:disabled {
    background: var(--aex-text-muted) !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.6 !important;
}

/* ==========================================================================
   LAYOUT HORIZONTAL PARA CAMPOS
   ========================================================================== */
html body .aex-contact-form .form-row-horizontal {
    display: flex !important;
    gap: 1rem !important;
    align-items: flex-start !important;
}

html body .aex-contact-form .form-row-horizontal > * {
    flex: 1 !important;
    margin-bottom: 0 !important;
}

/* Ajuste específico para campos en línea */
html body .aex-contact-form .inline-field {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}

/* ==========================================================================
   ESTADOS DE CARGA
   ========================================================================== */
html body .aex-contact-form.submitting .modern-submit-btn {
    pointer-events: none !important;
    opacity: 0.8 !important;
}

html body .aex-contact-form .submit-text,
html body .aex-contact-form .loading-text {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

html body .aex-contact-form.submitting .submit-text {
    display: none !important;
}

html body .aex-contact-form .loading-text {
    display: none !important;
}

html body .aex-contact-form.submitting .loading-text {
    display: flex !important;
}

/* ==========================================================================
   ESTADOS DE VALIDACIÓN
   ========================================================================== */
html body .aex-contact-form .form-control.is-invalid,
html body .aex-contact-form .phone-input-group.is-invalid {
    border-color: var(--aex-danger) !important;
    background: #fff5f5 !important;
    animation: shake 0.4s ease-in-out;
}

html body .aex-contact-form .form-control.is-valid,
html body .aex-contact-form .phone-input-group.is-valid {
    border-color: var(--aex-success) !important;
    background: #f8fff8 !important;
}

html body .aex-contact-form .invalid-feedback,
html body .aex-contact-form .phone-feedback {
    display: block !important;
    font-size: 0.75rem !important;
    color: var(--aex-danger) !important;
    margin-top: 0.2rem !important;
}

/* Animación de error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ==========================================================================
   MENSAJE DE ÉXITO
   ========================================================================== */
html body .aex-contact-form .success-checkmark {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: var(--aex-success) !important;
    margin: 0 auto 1rem !important;
    position: relative !important;
    display: block !important;
}

html body .aex-contact-form .success-checkmark::after {
    content: '✓' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: white !important;
    font-size: 1.5rem !important;
    font-weight: bold !important;
}

/* ==========================================================================
   UTILIDADES
   ========================================================================== */
html body .aex-contact-form .char-counter {
    font-size: 0.7rem !important;
    color: var(--aex-text-muted) !important;
    font-weight: 500 !important;
}

html body .aex-contact-form .fade-out {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
    transition: all 0.3s ease !important;
}

html body .aex-contact-form .fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: all 0.3s ease !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    html body .aex-contact-form .card-body {
        padding: 1rem !important;
    }
    
    html body .aex-contact-form .card-header {
        padding: 0.875rem !important;
    }
    
    html body .aex-contact-form .phone-input-group .form-select {
        max-width: 85px !important;
        font-size: 0.75rem !important;
    }
    
    html body .aex-contact-form .modern-submit-btn {
        width: 100% !important;
        min-width: auto !important;
    }
    
    html body .aex-contact-form .row.g-4 > * {
        margin-bottom: 1rem !important;
    }
    
    html body .aex-contact-form .form-row-horizontal {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
}

@media (max-width: 576px) {
    html body .aex-contact-form .form-wrapper {
        width: 95% !important;
        margin: 0 2.5% !important;
    }
    
    html body .aex-contact-form .card-body {
        padding: 0.875rem !important;
    }
    
    html body .aex-contact-form .phone-input-group .form-select {
        max-width: 80px !important;
        font-size: 0.7rem !important;
        padding: 0.75rem 0.25rem !important;
    }
    
    html body .aex-contact-form .modern-checkbox {
        padding: 0.75rem !important;
    }
    
    html body .aex-contact-form .modern-checkbox .form-check-label {
        font-size: 0.8rem !important;
    }
}

/* ==========================================================================
   SOBRESCRIBIR BOOTSTRAP FLOATING LABELS
   ========================================================================== */
html body .aex-contact-form .form-floating > .form-control:focus,
html body .aex-contact-form .form-floating > .form-control:not(:placeholder-shown),
html body .aex-contact-form .form-floating > .form-select:focus,
html body .aex-contact-form .form-floating > .form-select:not([multiple]):not([size]) {
    padding-top: 1.375rem !important;
    padding-bottom: 0.375rem !important;
}

html body .aex-contact-form .form-floating > label {
    height: 3rem !important;
    padding: 0.875rem !important;
    font-size: 0.9rem !important;
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out !important;
}

html body .aex-contact-form .form-floating > .form-control:focus ~ label,
html body .aex-contact-form .form-floating > .form-control:not(:placeholder-shown) ~ label,
html body .aex-contact-form .form-floating > .form-select:focus ~ label,
html body .aex-contact-form .form-floating > .form-select:not([multiple]):not([size]) ~ label {
    transform: scale(0.75) translateY(-0.625rem) translateX(0.125rem) !important;
    opacity: 1 !important;
    color: var(--aex-primary) !important;
}

/* ==========================================================================
   ACCESIBILIDAD Y OTROS ESTADOS
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html body .aex-contact-form *,
    html body .aex-contact-form *::before,
    html body .aex-contact-form *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible mejorado */
html body .aex-contact-form .form-control:focus-visible,
html body .aex-contact-form .modern-submit-btn:focus-visible,
html body .aex-contact-form .form-check-input:focus-visible {
    outline: 2px solid var(--aex-primary) !important;
    outline-offset: 2px !important;
}

/* ==========================================================================
   VALIDACIÓN FINAL - ASEGURAR QUE TODO FUNCIONA
   ========================================================================== */

/* Reset absoluto para evitar conflictos */
html body .aex-contact-form * {
    box-sizing: border-box !important;
}

html body .aex-contact-form input,
html body .aex-contact-form select,
html body .aex-contact-form textarea,
html body .aex-contact-form button {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Asegurar que los placeholders funcionen */
html body .aex-contact-form .form-control::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

html body .aex-contact-form .form-control:focus::placeholder {
    color: var(--aex-text-muted) !important;
    opacity: 0.7 !important;
}

/* ==========================================================================
   FIN DEL ARCHIVO CSS
   ========================================================================== */