/* 
 * Estilos Personalizados
 * Archivo: assets/css/styles.css
 */

:root {
    --color-primary: #9333ea;
    --color-secondary: #4f46e5;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
}

* {
    box-sizing: border-box;
}

/* Tipografía */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

/* Entrada de formularios mejorada */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

/* Botones */
button {
    font-family: inherit;
    cursor: pointer;
}

button:active {
    transform: scale(0.98);
}

/* Tarjetas de memes */
article {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

article:hover {
    transform: translateY(-8px);
}

/* Animación de carga */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

article {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 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-width: 0;
}

/* Focus visible para navegación por teclado */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Contraste alto para mejor accesibilidad */
body {
    --tw-text-opacity: 1;
    color: rgb(255 255 255 / var(--tw-text-opacity));
}

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

/* Mejora de línea deshabilitada */
:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Efectos de vidrio esmerilado mejorado */
.backdrop-blur-lg {
    backdrop-filter: blur(16px) saturate(180%);
    background-color: rgba(17, 24, 39, 0.6);
}

/* Sombras personalizadas */
.shadow-glow {
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

/* Gradientes */
.gradient-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
}

/* Animación suave de entrada para elementos */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slideInUp 0.5s ease-out;
}

/* Responsive mejorado */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* Soporte para modo oscuro */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #e2e8f0;
    }
}

/* Línea de truncado de texto */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mejoras de rendimiento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estados de formulario mejorados */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--color-error) !important;
    background-color: rgba(239, 68, 68, 0.1);
}

/* Animación de pulse para notificaciones */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   ACCESIBILIDAD - A11Y
   ============================================ */

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

/* Mostrar sr-only al hacer focus */
.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
    padding: 0.5rem;
    background-color: #3b82f6;
    color: white;
    z-index: 9999;
}

/* Mejorar contraste y visibilidad al hacer focus */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #3b82f6 !important;
    outline-offset: 2px !important;
}

/* Contraste mejorado para modo dark */
@media (prefers-color-scheme: dark) {
    button:focus,
    a:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid #60a5fa !important;
    }
}

/* Mejorar contraste de texto */
@media (prefers-contrast: more) {
    body {
        font-weight: 500;
    }
    
    button {
        font-weight: 600;
        border: 2px solid currentColor;
    }
}

/* Respetar preferencias de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mejorar accesibilidad en formularios */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="checkbox"],
input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Textos alternativos visibles en hover */
img[alt] {
    position: relative;
}

/* Alto contraste para colores */
.text-high-contrast {
    color: #000000;
}

@media (prefers-color-scheme: dark) {
    .text-high-contrast {
        color: #ffffff;
    }
}

/* Espaciado adecuado entre elementos interactivos */
button,
a[role="button"],
input[type="button"],
input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
}

/* Mejorar visibilidad de estados deshabilitados */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

