/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Variables */
:root {
    --primary-color: #dc2626;
    --primary-hover: #b91c1c;
    --secondary-color: #1f2937;
    --text-color: #374151;
    --light-gray: #f3f4f6;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Clases de Animación */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-600 {
    animation-delay: 600ms;
}

/* Header y Navegación */
.nav-link {
    position: relative;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link:hover::after {
    width: 100%;
}

/* Botones */
.btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    color: white;
    font-weight: 600;
    border: 2px solid white;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--primary-color);
}

/* Cards y Contenedores */
.stat-card {
    padding: 1.5rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.6),
        transparent
    );
    transition: 0.5s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.service-card {
    background-color: white;
    border-radius: 0.75rem;
    padding: 2rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    position: relative;
    z-index: 1;
}

.service-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: linear-gradient(to top, var(--primary-color) 0%, transparent 100%);
    opacity: 0.1;
    transition: height 0.3s ease;
    z-index: -1;
    border-radius: 0.75rem;
}

.service-card:hover::after {
    height: 100%;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    background-color: var(--light-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.icon-wrapper i {
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.service-card:hover .icon-wrapper {
    background-color: var(--primary-color);
}

.service-card:hover .icon-wrapper i {
    color: white;
}

/* Valores animation */
.valores-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: all 0.3s ease;
}

.valores-card:hover {
    transform: translateY(-5px) rotateX(10deg);
}

.valores-card:hover i {
    animation: glow 1.5s ease-in-out infinite alternate;
    transform: scale(1.2);
}

.valores-card i {
    transition: all 0.3s ease;
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
    }
    to {
        filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
    }
}

.benefit-card {
    text-align: center;
    padding: 2rem;
    background-color: white;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.benefit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Testimonials Slider */
.testimonials-carousel {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.testimonials-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.testimonial-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    flex: 0 0 100%;
    margin-right: 2rem;
}

@media (min-width: 768px) {
    .testimonial-card {
        flex: 0 0 calc(33.333% - 1.333rem);
    }
    
    .slider-arrow {
        display: flex !important;
    }
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.slider-arrow {
    opacity: 0.8;
    transition: all 0.3s ease;
}

.slider-arrow:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.curso-card {
    background-color: white;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.curso-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Formulario */
.form-group {
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding-left: 1rem !important;
}

.form-input::placeholder {
    color: #9ca3af;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.form-input:focus::placeholder {
    opacity: 0.5;
}

.form-input:hover:not(:disabled) {
    border-color: #d1d5db;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

.form-input.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-input.success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.form-label {
    position: absolute;
    left: 1rem;
    top: 0.75rem;
    color: #6b7280;
    transition: all 0.2s ease;
    background-color: #fff;
    padding: 0 0.25rem;
    pointer-events: none;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
    top: -0.5rem;
    left: 0.75rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.error-message i {
    margin-right: 0.5rem;
}


.submit-button {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--primary-color), #ef4444, var(--primary-color));
    background-size: 200% 100%;
    border: none;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(40%);
}

.submit-button .button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
    padding: 0.25rem 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    gap: 2rem;
}

.submit-button .button-content span {
    flex: 1;
    text-align: center;
    margin-left: -24px;
}

.submit-button .button-content i {
    font-size: 1.35rem;
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.35),
                inset 0 2px 4px rgba(255, 255, 255, 0.4);
    background-position: 100% 0;
}

.submit-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translate(-50%, -50%) rotate(45deg);
    transition: transform 0.6s ease;
}

.submit-button:hover::after {
    transform: translate(50%, 50%) rotate(45deg);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.2);
}

.submit-button.loading {
    pointer-events: none;
}

.submit-button.loading .button-content {
    opacity: 0;
}

.submit-button.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

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

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 0.875rem 1rem !important;
    }

    .slider-arrow {
        display: none !important;
    }
}

/* Scroll Top Button */
#scroll-top {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Tarjetas de Información de Contacto */
.contact-info-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background-color: white;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.contact-info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.contact-info-card i {
    padding: 0.75rem;
    background-color: #fef2f2;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.contact-info-card:hover i {
    background-color: var(--primary-color);
    color: white !important;
}

.contact-info-card h4 {
    color: var(--secondary-color);
}

.contact-info-card p {
    color: var(--text-color);
    line-height: 1.5;
}

.contact-info-card a {
    transition: color 0.3s ease;
}

.contact-info-card a:hover {
    color: var(--primary-color);
}

/* Pulse Animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hover-pulse:hover {
    animation: pulse 1.5s ease-in-out infinite;
    transform-origin: center;
}

/* Media Queries */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .grid:not(.grid-cols-2) {
        grid-template-columns: 1fr;
    }

    .flex-wrap {
        flex-wrap: wrap;
    }

    .nav-link::after {
        display: none;
    }

    /* Ajustes del Hero para mobile */
    #inicio {
        min-height: 100vh;
        padding-top: 5rem;
    }

    #inicio h2 {
        font-size: 2.5rem !important;
        line-height: 1.2;
    }

    #inicio p {
        font-size: 1.125rem !important;
        line-height: 1.5;
    }

    #inicio .flex.gap-8 {
        flex-direction: column;
        gap: 1rem !important;
    }

    #inicio .flex.gap-4 {
        flex-direction: column;
        width: 100%;
    }

    #inicio .btn-primary,
    #inicio .btn-secondary {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    #inicio .flex.items-center {
        font-size: 0.875rem;
    }

    #inicio .absolute.inset-0 {
        background-position: 70% center;
    }
}

@media (max-width: 640px) {
    #inicio h2 {
        font-size: 2rem !important;
    }

    #inicio .container {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

/* Utilidades */
.transition-all {
    transition: all 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Animación de shake para campos inválidos */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Scroll Behavior */
html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 5rem;
}
