/* Animaciones fade-up con IntersectionObserver */
.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-fade-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Focus states mejorados para accesibilidad */
input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Mejoras de contraste para texto */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Transiciones suaves globales */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Hover effects para botones */
.group:hover .group-hover-scale {
    transform: scale(1.05);
}

/* Animación de bounce más suave */
@keyframes bounce-subtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Responsive utilities */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Print styles */
@media print {
    nav,
    footer,
    .no-print {
        display: none !important;
    }
}

/* Skeleton loading para imágenes */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* Mejoras para formularios */
input[type="text"]:invalid:not(:placeholder-shown),
input[type="email"]:invalid:not(:placeholder-shown),
input[type="tel"]:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

input[type="text"]:valid:not(:placeholder-shown),
input[type="email"]:valid:not(:placeholder-shown),
input[type="tel"]:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

/* Mejoras para accesibilidad de enlaces */
a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Modo oscuro (preparado para futura implementación) */
@media (prefers-color-scheme: dark) {
    /* Se puede activar en el futuro si se requiere */
}

/* Animación para modales y overlays */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Grid layout helpers */
.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Utilidades para overflow */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mejoras para tablas responsivas */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Estados de disabled mejorados */
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mejoras para imágenes responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Aspect ratio utilities (fallback para navegadores antiguos) */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Protección contra FOUC (Flash of Unstyled Content) */
.no-js {
    opacity: 0;
}

html.js-loaded .no-js {
    opacity: 1;
}

/* Mejoras de rendimiento */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Container queries (preparado para futura implementación) */
@supports (container-type: inline-size) {
    .container-responsive {
        container-type: inline-size;
    }
}
