/* Configuración de tema */
:root {
    --bg-primary: #1a0b2e;
    --bg-secondary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #e9dcff;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --border-color: #7c3aed;
    --glow-color: rgba(168, 85, 247, 0.5);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-purple: #7c3aed;
    --accent-pink: #db2777;
    --border-color: #a855f7;
    --glow-color: rgba(124, 58, 237, 0.3);
}

/* Transiciones suaves para el cambio de tema */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Fondo de estrellas */
.stars {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #000000 50%, #1e1b4b 100%);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .stars {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #cbd5e1 100%);
}

.stars::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: sparkle 20s linear infinite;
    opacity: 0.8;
}

[data-theme="light"] .stars::before {
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #7c3aed, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(124, 58, 237, 0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, #a855f7, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(168, 85, 247, 0.4), transparent),
        radial-gradient(2px 2px at 160px 30px, #7c3aed, transparent);
    opacity: 0.3;
}

@keyframes sparkle {
    from { transform: translateX(0); }
    to { transform: translateX(-200px); }
}

/* Efectos de brillo mejorados */
.glow {
    box-shadow: 
        0 0 20px var(--glow-color),
        0 0 40px var(--glow-color),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glow:hover {
    box-shadow: 
        0 0 30px var(--glow-color),
        0 0 60px var(--glow-color),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Animaciones de tarjetas mejoradas */
.card-hover {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 30px var(--glow-color);
}

/* Botones mejorados */
.btn-mystical {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    border: 2px solid transparent;
    background-clip: padding-box;
}

.btn-mystical::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-mystical:hover::before {
    left: 100%;
}

.btn-mystical:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(168, 85, 247, 0.4);
}

/* Toggle de tema */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.theme-toggle:hover {
    background: var(--accent-purple);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 5px 15px var(--glow-color);
}

.theme-toggle i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(180deg);
}

/* Animaciones de entrada */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

.scale-in {
    animation: scaleIn 0.5s ease-out;
}

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

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

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

/* Efectos de texto */
.text-glow {
    text-shadow: 
        0 0 10px var(--glow-color),
        0 0 20px var(--glow-color),
        0 0 30px var(--glow-color);
}

.text-shimmer {
    background: linear-gradient(45deg, #fff, #a855f7, #ec4899, #fff);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Partículas flotantes */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: var(--accent-purple);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(odd) {
    background: var(--accent-pink);
    animation-delay: -2s;
}

.particle:nth-child(3n) {
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10%, 90% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-100px) rotate(180deg);
        opacity: 1;
    }
}

/* Efectos de carga */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(168, 85, 247, 0.3);
    border-top: 4px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Tooltips mejorados */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-secondary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .theme-toggle {
        top: 15px;
        right: 15px;
        padding: 8px 12px;
        font-size: 12px;
        z-index: 1002;
    }
    
    .card-hover:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .glow {
        box-shadow: 0 0 15px var(--glow-color);
    }
    
    .glow:hover {
        box-shadow: 0 0 20px var(--glow-color);
    }
    
    /* Optimizaciones para touch */
    .btn-mystical, .card-hover {
        touch-action: manipulation;
    }
    
    /* Mejorar el área de toque */
    button, .hamburger, .theme-toggle {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Animación de shake para errores */
.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Efectos de focus mejorados */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
    transition: all 0.3s ease;
}

/* Navegación - Configuración base */
.desktop-nav {
    display: flex;
}

.mobile-nav {
    display: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    outline: none;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: 2px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Navegación responsive */
@media (max-width: 768px) {
    .desktop-nav {
        display: none !important;
    }
    
    .hamburger {
        display: flex !important;
    }
    
    .mobile-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin: 10px;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
    }
    
    .mobile-nav.active {
        display: block;
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-nav a {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid rgba(124, 58, 237, 0.2);
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .mobile-nav a:last-child {
        border-bottom: none;
    }
    
    .mobile-nav a:hover {
        padding-left: 10px;
        color: var(--accent-purple);
    }
}

@media (min-width: 769px) {
    .desktop-nav {
        display: flex !important;
    }
    
    .hamburger {
        display: none !important;
    }
    
    .mobile-nav {
        display: none !important;
    }
}

/* Mejoras 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;
}

/* Animaciones de carga de página */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Efectos de scroll */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Mejoras para el contraste en modo claro */
[data-theme="light"] .text-purple-200 {
    color: #6b21a8 !important;
}

[data-theme="light"] .text-purple-300 {
    color: #581c87 !important;
}

[data-theme="light"] .text-white {
    color: #1e293b !important;
}

[data-theme="light"] .bg-black {
    background-color: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .border-purple-500 {
    border-color: #a855f7 !important;
}