/* ==========================================================================
   MARHOANI - ESTILOS PERSONALIZADOS INTEGRADOS
   Sistema de diseño unificado con Tailwind CSS + DaisyUI
   ========================================================================== */

/* Variables CSS personalizadas que extienden el tema de DaisyUI */
:root {
    /* Paleta principal */
    --marhoani-primary: 30 58 138; /* #1E3A8A - Azul */
    --marhoani-secondary: 249 115 22; /* #F97316 - Naranja */
    --marhoani-accent: 16 185 129; /* #10B981 - Verde */
    --marhoani-gray: 229 231 235; /* #E5E7EB - Gris claro */
    
    /* Paleta secundaria */
    --marhoani-blue-light: 141 200 232; /* #8DC8E8 - Azul claro */
    --marhoani-orange-light: 255 163 139; /* #FFA38B - Naranja claro/salmón */
    --marhoani-green-light: 160 209 202; /* #A0D1CA - Verde agua */
    
    /* Colores de sistema */
    --marhoani-light: 255 255 255; /* #FFFFFF - Blanco */
    --marhoani-dark: 30 58 138; /* #1E3A8A - Azul oscuro */
    
    /* Variables para animaciones */
    --animation-duration-fast: 0.3s;
    --animation-duration-normal: 0.6s;
    --animation-duration-slow: 1s;
    --animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Variables para sombras */
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-medium: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    --shadow-heavy: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
    
    /* Variables para blur */
    --blur-light: 4px;
    --blur-medium: 8px;
    --blur-heavy: 16px;
}

/* ==========================================================================
   RESET Y BASE - Compatible con Tailwind
   ========================================================================== */

/* Reset específico para compatibilidad con DaisyUI */
.marhoani-reset {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* Base para fuentes - Complementa la configuración de Tailwind */
.font-dmsans {
    font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   FONDOS ANIMADOS - Integrados con Tailwind
   ========================================================================== */

/* Fondo principal con gradiente animado */
.bg-gradient-animated {
    background: linear-gradient(
        135deg,
        rgb(var(--marhoani-orange-light)) 0%,
        rgb(var(--marhoani-secondary)) 20%,
        rgb(var(--marhoani-blue-light)) 40%,
        rgb(var(--marhoani-green-light)) 60%,
        rgb(var(--marhoani-accent)) 80%,
        rgb(var(--marhoani-orange-light)) 100%
    );
    background-size: 400% 400%;
    animation: gradient-flow 15s ease infinite;
    min-height: 100vh;
    position: relative;
}

/* Animación de gradiente optimizada */
@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================================================
   SISTEMA DE CAPAS Z-INDEX
   ========================================================================== */

.z-content { z-index: 10; }
.z-overlay { z-index: 20; }
.z-modal { z-index: 30; }
.z-tooltip { z-index: 40; }
.z-dropdown { z-index: 50; }

/* ==========================================================================
   EFECTOS DE CRISTAL (GLASS) - Integrados con DaisyUI
   ========================================================================== */

/* Efecto glass principal */
.glass-bg {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--blur-medium));
    -webkit-backdrop-filter: blur(var(--blur-medium));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

/* Variaciones del efecto glass */
.glass-light {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(var(--blur-light));
    -webkit-backdrop-filter: blur(var(--blur-light));
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.glass-heavy {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(var(--blur-heavy));
    -webkit-backdrop-filter: blur(var(--blur-heavy));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-heavy);
}

/* Glass específico para el contador */
.countdown-glass {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 0.75rem 0.5rem;
    min-width: 60px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all var(--animation-duration-fast) var(--animation-easing);
    width: 100%;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.countdown-glass:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   EFECTOS DE TEXTO Y TIPOGRAFÍA
   ========================================================================== */

/* Efecto glow para títulos */
.text-glow {
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.3),
        0 0 20px rgba(255, 255, 255, 0.2),
        0 0 30px rgba(255, 255, 255, 0.1);
}

.text-glow-accent {
    text-shadow: 
        0 0 10px rgba(var(--marhoani-accent), 0.5),
        0 0 20px rgba(var(--marhoani-accent), 0.3),
        0 0 30px rgba(var(--marhoani-accent), 0.2);
}

/* Números con espaciado tabular */
.font-tabular {
    font-variant-numeric: tabular-nums;
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
}

/* ==========================================================================
   SISTEMA DE CONTADOR AVANZADO
   ========================================================================== */

/* Reset y base del contador - Optimizado para rendimiento */
.countdown-number {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: baseline;
    font-variant-numeric: tabular-nums;
    -webkit-font-feature-settings: "tnum"; 
    font-feature-settings: "tnum";
    letter-spacing: -0.02em;
    font-weight: 700;
    
    /* Optimizaciones de rendimiento */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    
    /* Sombra para mejor legibilidad */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Prevenir selección */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Contenedores de números */
.countdown-number .number-container,
.countdown-number .next-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1.5;
    font-weight: inherit;
    transition: transform var(--animation-duration-normal) var(--animation-easing), 
                opacity var(--animation-duration-normal) ease;
    transform: translateY(0) translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.countdown-number .next-number {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateY(100%) translateZ(0);
    opacity: 0;
    z-index: 1;
}

.countdown-number .number-container {
    position: relative;
    z-index: 2;
}

/* Estados de animación */
.countdown-number.updating .number-container {
    transform: translateY(-100%) translateZ(0);
    opacity: 0;
}

.countdown-number.updating .next-number {
    transform: translateY(0) translateZ(0);
    opacity: 1;
}

/* Clases responsivas para diferentes tamaños de número */
.countdown-number.one-digit {
    min-width: 2.5ch;
    padding: 0.1em 0.4em;
    height: 1.6em;
}

.countdown-number.two-digits {
    min-width: 3.5ch;
    padding: 0.1em 0.3em;
    height: 1.6em;
}

.countdown-number.three-digits {
    min-width: 4.5ch;
    padding: 0.1em 0.25em;
    height: 1.6em;
}

.countdown-number.four-digits {
    min-width: 5.5ch;
    padding: 0.1em 0.2em;
    height: 1.6em;
    font-size: 0.9em;
}

/* Efecto de pulso sutil */
.countdown-number.pulse-effect {
    animation: subtlePulse 0.4s ease-in-out;
}

@keyframes subtlePulse {
    0%, 100% { transform: scale(1) translateZ(0); }
    50% { transform: scale(1.03) translateZ(0); }
}

/* ==========================================================================
   ANIMACIONES DE ENTRADA
   ========================================================================== */

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

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

/* Animación de flotación */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) translateZ(0); }
    50% { transform: translateY(-10px) translateZ(0); }
}

/* Animación de escala para el contador */
.countdown-box {
    animation: fadeInScale 0.8s ease-out;
    will-change: transform, opacity;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateZ(0);
    }
    to {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

/* ==========================================================================
   EFECTOS DE HOVER Y INTERACCIÓN
   ========================================================================== */

/* Hover para tarjetas */
.card-hover {
    transition: all var(--animation-duration-fast) var(--animation-easing);
}

.card-hover:hover {
    transform: translateY(-4px) translateZ(0);
    box-shadow: var(--shadow-heavy);
}

/* Estados de botones personalizados */
.btn-marhoani {
    background: linear-gradient(to right, rgb(var(--marhoani-primary)), rgb(var(--marhoani-secondary)));
    color: white;
    font-weight: 600;
    border: none;
    outline: none;
    transition: all 0.3s var(--animation-easing);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-marhoani:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(1.05) translateZ(0);
}

.btn-marhoani:active {
    transform: scale(0.95) translateZ(0);
}

/* ==========================================================================
   RESPONSIVE DESIGN - Integrado con breakpoints de Tailwind
   ========================================================================== */

/* Mobile First - sm: 640px */
@media (max-width: 639px) {
    .countdown-glass {
        padding: 0.75rem 0.5rem;
        min-width: 60px;
        min-height: 85px;
        border-radius: 0.75rem;
    }
    
    .countdown-number {
        font-size: 1em; /* Mantener tamaño base */
    }
    
    .countdown-number.one-digit {
        min-width: 2ch;
        padding: 0 0.3em;
        height: 1.4em;
    }
    
    .countdown-number.two-digits {
        min-width: 3ch;
        padding: 0 0.25em;
        height: 1.4em;
    }
    
    .countdown-number.three-digits {
        min-width: 3.8ch;
        padding: 0 0.2em;
        height: 1.4em;
    }
    
    .countdown-number.four-digits {
        min-width: 4.8ch;
        padding: 0 0.15em;
        height: 1.4em;
        font-size: 0.9em; /* Ligeramente más pequeño solo para números muy grandes */
    }
    
    .glass-bg {
        backdrop-filter: blur(var(--blur-light));
        -webkit-backdrop-filter: blur(var(--blur-light));
    }
    
    /* Grid específico para móviles */
    #countdown {
        gap: 0.5rem !important;
    }
}

/* Tablets - md: 768px */
@media (min-width: 640px) and (max-width: 767px) {
    .countdown-glass {
        padding: 1rem 0.75rem;
        min-width: 80px;
        min-height: 100px;
    }
    
    .countdown-number {
        font-size: 1em; /* Mantener consistencia */
    }
}

/* Desktop - lg: 1024px y superior */
@media (min-width: 1024px) {
    .countdown-glass {
        padding: 1.25rem 1rem;
        min-width: 100px;
        min-height: 120px;
    }
    
    .countdown-number {
        font-size: 1em; /* Mantener consistencia */
    }
    
    .card-hover:hover {
        transform: translateY(-6px) translateZ(0);
    }
}

/* Pantallas de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .countdown-number {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .text-glow {
        text-shadow: 
            0 0 5px rgba(255, 255, 255, 0.4),
            0 0 10px rgba(255, 255, 255, 0.3),
            0 0 15px rgba(255, 255, 255, 0.2);
    }
}

/* ==========================================================================
   FALLBACKS Y COMPATIBILIDAD
   ========================================================================== */

/* Fallback para navegadores sin soporte de backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
    .glass-bg {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .countdown-glass {
        background: rgba(255, 255, 255, 0.18);
        border: 1px solid rgba(255, 255, 255, 0.25);
    }
}

/* Modo de contraste alto */
@media (prefers-contrast: high) {
    .glass-bg {
        background: rgba(255, 255, 255, 0.25);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    .text-glow {
        text-shadow: 
            0 0 2px rgba(255, 255, 255, 0.8),
            0 0 4px rgba(255, 255, 255, 0.6);
    }
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .animate-float,
    .countdown-box,
    .countdown-number,
    .countdown-number .number-container,
    .countdown-number .next-number {
        animation: none !important;
        transition: none !important;
    }
    
    .bg-gradient-animated {
        animation: none;
        background: rgb(var(--marhoani-primary));
    }
}

/* ==========================================================================
   ESTADOS DE JAVASCRIPT
   ========================================================================== */

/* Fallbacks para cuando JavaScript está deshabilitado */
.countdown-fallback { 
    display: none; 
}

.no-js .countdown-fallback { 
    display: block; 
}

.no-js #countdown { 
    display: none; 
}

/* Estados de carga */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   UTILIDADES PERSONALIZADAS
   ========================================================================== */

/* Clases de utilidad que complementan Tailwind */
.text-shadow-sm {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.text-shadow-md {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.text-shadow-lg {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.gradient-text {
    background: linear-gradient(135deg, rgb(var(--marhoani-accent)), rgb(var(--marhoani-secondary)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Espaciado personalizado */
.space-y-dynamic > * + * {
    margin-top: clamp(0.5rem, 2vw, 2rem);
}

.space-x-dynamic > * + * {
    margin-left: clamp(0.5rem, 2vw, 2rem);
}

/* ==========================================================================
   DEBUG Y DESARROLLO
   ========================================================================== */

/* Solo para desarrollo - remover en producción */
.debug-border {
    border: 1px solid red !important;
}

.debug-bg {
    background: rgba(255, 0, 0, 0.1) !important;
}

/* ==========================================================================
   FIN DE ESTILOS
   ========================================================================== */
