/* Utilidades y mejoras visuales */

/* ============================================
   LAZY LOADING
   ============================================ */

img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

img.lazy-loaded {
    opacity: 1;
}

/* Placeholder mientras carga */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   BOTÓN VOLVER ARRIBA
   ============================================ */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 5rem;
    height: 5rem;
    background-color: #82ee1d;
    color: #001338;
    border: none;
    border-radius: 50%;
    font-size: 2.4rem;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999; /* Menor que WhatsApp */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #75e111;
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.back-to-top:active {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .back-to-top {
        width: 4.5rem;
        height: 4.5rem;
        font-size: 2rem;
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

/* ============================================
   ANIMACIONES DE SCROLL
   ============================================ */

.carrera,
.card,
.columna {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.carrera.animate-in,
.card.animate-in,
.columna.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Retraso escalonado para elementos en grid */
.carrera:nth-child(1) { transition-delay: 0s; }
.carrera:nth-child(2) { transition-delay: 0.1s; }
.carrera:nth-child(3) { transition-delay: 0.2s; }
.carrera:nth-child(4) { transition-delay: 0.3s; }

.card:nth-child(1) { transition-delay: 0s; }
.card:nth-child(2) { transition-delay: 0.1s; }
.card:nth-child(3) { transition-delay: 0.2s; }
.card:nth-child(4) { transition-delay: 0.3s; }
.card:nth-child(5) { transition-delay: 0.4s; }

/* ============================================
   VALIDACIÓN DE FORMULARIOS
   ============================================ */

.error-field {
    border-color: #ec5700 !important;
    background-color: #fff5f5 !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #82ee1d;
    outline-offset: 2px;
}

/* ============================================
   BOTONES COMPARTIR REDES SOCIALES
   ============================================ */

.social-share {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    justify-content: center;
    flex-wrap: wrap;
}

.social-share__button {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.social-share__button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-share__button--facebook {
    background-color: #1877f2;
}

.social-share__button--twitter {
    background-color: #1da1f2;
}

.social-share__button--whatsapp {
    background-color: #25d366;
}

.social-share__button--telegram {
    background-color: #0088cc;
}

.social-share__button--email {
    background-color: #666;
}

.social-share__button--copy {
    background-color: #82ee1d;
    color: #001338;
}

/* Responsive para botones sociales */
@media (max-width: 768px) {
    .social-share {
        gap: 0.8rem;
        margin: 1.5rem 0;
    }

    .social-share__button {
        padding: 1.2rem 1.8rem;
        font-size: 1.3rem;
        gap: 0.6rem;
        min-height: 4.4rem; /* Tamaño táctil accesible */
    }
}

@media (max-width: 480px) {
    .social-share {
        flex-direction: column;
        gap: 1rem;
    }

    .social-share__button {
        width: 100%;
        justify-content: center;
        padding: 1.4rem 2rem;
        font-size: 1.4rem;
        min-height: 4.8rem;
    }
}

/* ============================================
   BOTÓN FLOTANTE WHATSAPP
   ============================================ */

.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 6rem;
    height: 6rem;
    background-color: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    background-color: #20ba5a;
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.whatsapp-float:active {
    transform: scale(1.05) translateY(-2px);
}

.whatsapp-float svg {
    width: 3.2rem;
    height: 3.2rem;
}

/* Animación de pulso */
@keyframes whatsapp-pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.whatsapp-float {
    animation: whatsapp-pulse 2s infinite;
}

@media (max-width: 768px) {
    .whatsapp-float {
        width: 5.5rem;
        height: 5.5rem;
        bottom: 1.5rem;
        left: 1.5rem;
    }

    .whatsapp-float svg {
        width: 2.8rem;
        height: 2.8rem;
    }
}

@media (max-width: 480px) {
    .whatsapp-float {
        width: 5rem;
        height: 5rem;
        bottom: 1rem;
        left: 1rem;
    }

    .whatsapp-float svg {
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* ============================================
   BREADCRUMBS
   ============================================ */

.breadcrumbs {
    padding: 2rem 0;
    font-size: 1.4rem;
}

.breadcrumbs__list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.breadcrumbs__item {
    display: flex;
    align-items: center;
}

.breadcrumbs__item:not(:last-child)::after {
    content: '›';
    margin: 0 1rem;
    color: #666;
    font-size: 1.6rem;
}

.breadcrumbs__link {
    color: #001338;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumbs__link:hover {
    color: #82ee1d;
    text-decoration: underline;
}

.breadcrumbs__current {
    color: #666;
    font-weight: 600;
}

/* ============================================
   ESTADOS DE CARGA
   ============================================ */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3rem;
    height: 3rem;
    margin: -1.5rem 0 0 -1.5rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #82ee1d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   UTILIDADES DE ACCESIBILIDAD
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Resaltar focus para navegación por teclado */
*:focus-visible {
    outline: 2px solid #82ee1d;
    outline-offset: 2px;
}

/* ============================================
   MEJORAS DE PERFORMANCE
   ============================================ */

/* Hint al navegador para optimizar animaciones */
.carrera,
.card,
.back-to-top {
    will-change: transform, opacity;
}

/* Optimización de fuentes */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE PREPARACIÓN
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Por si en el futuro quieres implementar dark mode */
    /* body {
        background-color: #121212;
        color: #ffffff;
    } */
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .header,
    .footer,
    .back-to-top,
    .social-share {
        display: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        text-decoration: underline;
        color: #000;
    }

    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}
