/* ============================================
   EINSOFT - CONTACT FORM STYLES
   Modern & Professional Design
   Compatible with Bootstrap 3.3.7
   ============================================ */

/* === Variables CSS === */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1e293b;
    --text-medium: #475569;
    --text-light: #94a3b8;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #2563eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* === Form Container === */
.contact-form-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 0;
    max-width: 550px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

/* === Form Header with Icon === */
.contact-form-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    padding: 35px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.contact-form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.contact-form-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-white);
    border-radius: 50% 50% 0 0;
}

.contact-form-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
}

.contact-form-icon svg {
    width: 40px;
    height: 40px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.contact-form-header h3 {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contact-form-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* === Form Body === */
.contact-form-body {
    padding: 30px 35px 35px;
}

/* === Form Groups === */
#frmContacto .form-group {
    margin-bottom: 22px;
    position: relative;
}

#frmContacto .form-group:last-of-type {
    margin-bottom: 25px;
}

/* === Input Labels (si se usan) === */
#frmContacto label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

/* === Form Controls Base === */
#frmContacto .form-control {
    height: 54px;
    padding: 15px 20px 15px 50px;
    font-size: 15px;
    color: var(--text-dark);
    background-color: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    box-shadow: none;
    transition: all var(--transition-normal);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#frmContacto .form-control:hover {
    background-color: #f1f5f9;
    border-color: var(--border-color);
}

#frmContacto .form-control:focus {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

/* === Placeholder Styles === */
#frmContacto .form-control::placeholder {
    color: var(--text-light);
    font-weight: 400;
    transition: opacity var(--transition-fast);
}

#frmContacto .form-control:focus::placeholder {
    opacity: 0.5;
}

/* === Input Icons === */
#frmContacto .form-group {
    position: relative;
}

#frmContacto .form-group::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
    transition: opacity var(--transition-normal);
    z-index: 2;
    pointer-events: none;
}

#frmContacto .form-group:focus-within::before {
    opacity: 1;
}

/* Icon for Name field */
#frmContacto .form-group:has(#name)::before,
#frmContacto .form-group.icon-user::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3E%3C/path%3E%3Ccircle cx='12' cy='7' r='4'%3E%3C/circle%3E%3C/svg%3E");
}

/* Icon for Email field */
#frmContacto .form-group:has(#email)::before,
#frmContacto .form-group.icon-email::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'%3E%3C/path%3E%3Cpolyline points='22,6 12,13 2,6'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Icon for Phone field */
#frmContacto .form-group:has(#phone)::before,
#frmContacto .form-group.icon-phone::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'%3E%3C/path%3E%3C/svg%3E");
}

/* Icon for Service select */
#frmContacto .form-group:has(#service)::before,
#frmContacto .form-group.icon-service::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'%3E%3C/path%3E%3Cpolyline points='3.27 6.96 12 12.01 20.73 6.96'%3E%3C/polyline%3E%3Cline x1='12' y1='22.08' x2='12' y2='12'%3E%3C/line%3E%3C/svg%3E");
}

/* Icon for Message textarea */
#frmContacto .form-group:has(#message)::before,
#frmContacto .form-group.icon-message::before {
    top: 27px;
    transform: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E");
}

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
    #frmContacto .form-group::before {
        display: none;
    }
    
    #frmContacto .form-control {
        padding-left: 20px;
    }
}

/* === Select Specific Styles === */
#frmContacto select.form-control {
    cursor: pointer;
    padding-right: 45px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
}

#frmContacto select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

#frmContacto select.form-control option {
    padding: 12px;
    background: var(--bg-white);
    color: var(--text-dark);
}

/* === Textarea Specific Styles === */
#frmContacto textarea.form-control {
    height: auto;
    min-height: 130px;
    padding-top: 18px;
    resize: vertical;
    line-height: 1.6;
}

/* === Submit Button === */
#frmContacto .btn-custom,
#frmContacto #send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 56px;
    padding: 0 30px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    text-transform: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

#frmContacto .btn-custom::before,
#frmContacto #send::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

#frmContacto .btn-custom:hover,
#frmContacto #send:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

#frmContacto .btn-custom:hover::before,
#frmContacto #send:hover::before {
    left: 100%;
}

#frmContacto .btn-custom:active,
#frmContacto #send:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Button icon */
#frmContacto .btn-custom .btn-icon,
#frmContacto #send .btn-icon {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-normal);
}

#frmContacto .btn-custom:hover .btn-icon,
#frmContacto #send:hover .btn-icon {
    transform: translateX(5px);
}

/* === Loading State === */
#frmContacto .btn-custom.loading,
#frmContacto #send.loading {
    pointer-events: none;
    opacity: 0.8;
}

#frmContacto .btn-custom.loading::after,
#frmContacto #send.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

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

/* === Validation States === */
#frmContacto .form-control.error,
#frmContacto .form-control:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
    background-color: #fef2f2;
}

#frmContacto .form-control.error:focus,
#frmContacto .form-control:invalid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

#frmContacto .form-control.success,
#frmContacto .form-control:valid:not(:placeholder-shown) {
    border-color: var(--success-color);
}

#frmContacto .form-control.success:focus,
#frmContacto .form-control:valid:not(:placeholder-shown):focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* Error message */
#frmContacto .error-message {
    display: none;
    font-size: 12px;
    color: var(--error-color);
    margin-top: 6px;
    padding-left: 5px;
}

#frmContacto .form-group.has-error .error-message {
    display: block;
}

/* === Form Footer === */
.contact-form-footer {
    text-align: center;
    padding: 20px 35px 25px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.contact-form-footer p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.contact-form-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.contact-form-footer a:hover {
    text-decoration: underline;
}

/* === Privacy Note === */
.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 15px;
    padding: 12px 15px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.privacy-note svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    stroke: var(--text-light);
}

/* === Success Message === */
.form-success-message {
    display: none;
    text-align: center;
    padding: 50px 30px;
}

.form-success-message.show {
    display: block;
}

.form-success-message .success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    animation: success-bounce 0.5s ease;
}

@keyframes success-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.form-success-message .success-icon svg {
    width: 40px;
    height: 40px;
    stroke: #ffffff;
    stroke-width: 2.5;
}

.form-success-message h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 10px 0;
}

.form-success-message p {
    font-size: 15px;
    color: var(--text-medium);
    margin: 0;
    line-height: 1.6;
}

/* === WhatsApp Alternative CTA === */
.whatsapp-alternative {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}

.whatsapp-alternative span {
    font-size: 13px;
    color: var(--text-light);
}

.whatsapp-alternative a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background: #25D366;
    border-radius: 50px;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.whatsapp-alternative a:hover {
    background: #128C7E;
    transform: scale(1.05);
}

.whatsapp-alternative a svg {
    width: 16px;
    height: 16px;
    fill: #ffffff;
}

/* === Responsive Design === */
@media (max-width: 768px) {
    .contact-form-wrapper {
        margin: 0 15px;
        border-radius: var(--radius-lg);
    }
    
    .contact-form-header {
        padding: 30px 20px;
    }
    
    .contact-form-header h3 {
        font-size: 20px;
    }
    
    .contact-form-icon {
        width: 70px;
        height: 70px;
    }
    
    .contact-form-icon svg {
        width: 35px;
        height: 35px;
    }
    
    .contact-form-body {
        padding: 25px 20px 30px;
    }
    
    #frmContacto .form-control {
        height: 50px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 18px 14px 45px;
    }
    
    #frmContacto textarea.form-control {
        min-height: 120px;
    }
    
    #frmContacto .btn-custom,
    #frmContacto #send {
        height: 52px;
        font-size: 15px;
    }
    
    .contact-form-footer {
        padding: 15px 20px 20px;
    }
}

@media (max-width: 480px) {
    .contact-form-header::after {
        height: 40px;
        bottom: -20px;
    }
    
    .whatsapp-alternative {
        flex-direction: column;
        gap: 12px;
    }
}

/* === Dark Mode Support (opcional) === */
@media (prefers-color-scheme: dark) {
    .contact-form-wrapper.dark-mode {
        background: #1e293b;
    }
    
    .contact-form-wrapper.dark-mode .contact-form-header::after {
        background: #1e293b;
    }
    
    .contact-form-wrapper.dark-mode .form-control {
        background: #334155;
        color: #f1f5f9;
        border-color: transparent;
    }
    
    .contact-form-wrapper.dark-mode .form-control:focus {
        background: #475569;
        border-color: var(--primary-color);
    }
    
    .contact-form-wrapper.dark-mode .form-control::placeholder {
        color: #94a3b8;
    }
}

/* === Floating Labels Alternative (opcional) === */
.floating-label .form-group {
    position: relative;
}

.floating-label .form-group label {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    font-weight: 400;
    color: var(--text-light);
    pointer-events: none;
    transition: all var(--transition-normal);
    background: transparent;
    padding: 0 5px;
    margin: 0;
}

.floating-label .form-group.textarea label {
    top: 27px;
    transform: none;
}

.floating-label .form-control:focus ~ label,
.floating-label .form-control:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--bg-white);
}

.floating-label .form-group.textarea .form-control:focus ~ label,
.floating-label .form-group.textarea .form-control:not(:placeholder-shown) ~ label {
    top: -8px;
}

/* === Alertas de Error/Éxito === */
.form-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
    position: relative;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-alert svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.form-alert span {
    flex: 1;
    line-height: 1.4;
}

.form-alert .alert-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    padding: 0;
    line-height: 1;
    margin-left: 10px;
}

.form-alert .alert-close:hover {
    opacity: 1;
}

.form-alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.form-alert-error svg {
    stroke: #dc2626;
}

.form-alert-error .alert-close {
    color: #991b1b;
}

.form-alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.form-alert-success svg {
    stroke: #16a34a;
}

.form-alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.form-alert-warning svg {
    stroke: #d97706;
}

/* === Transición del formulario === */
#frmContacto {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* === Spinner del botón === */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* === Animaciones de entrada === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contact-form-wrapper.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

.contact-form-wrapper.animate-in .form-group {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.contact-form-wrapper.animate-in .form-group:nth-child(1) { animation-delay: 0.1s; }
.contact-form-wrapper.animate-in .form-group:nth-child(2) { animation-delay: 0.2s; }
.contact-form-wrapper.animate-in .form-group:nth-child(3) { animation-delay: 0.3s; }
.contact-form-wrapper.animate-in .form-group:nth-child(4) { animation-delay: 0.4s; }
.contact-form-wrapper.animate-in .form-group:nth-child(5) { animation-delay: 0.5s; }