/* Dashboard V2 - Diseño enfocado en adicción y engagement */

/* ============================================
   BARRA DE RACHA SUPERIOR
   ============================================ */
.streak-bar {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.streak-bar.streak-zero {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* ============================================
   CARD DE PREPARACIÓN PRINCIPAL
   ============================================ */
.preparation-card {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 2px solid #c7d2fe;
}

/* Barra de progreso de preparación */
.preparation-bar-container {
    position: relative;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: visible;
}

.preparation-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
    border-radius: 12px;
    transition: width 1s ease-out;
    position: relative;
}

.preparation-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Marcadores en la barra */
.preparation-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.preparation-markers .marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: white;
    border: 2px solid #c7d2fe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============================================
   MEDALLAS COMO CHECKPOINTS
   ============================================ */
.medal-checkpoint {
    text-align: center;
}

.medal-slots {
    display: flex;
    justify-content: center;
}

.medal-slot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e5e7eb;
    border: 2px dashed #d1d5db;
    transition: all 0.3s ease;
}

.medal-slot.filled {
    border: none;
    animation: medalPop 0.4s ease-out;
}

.medal-checkpoint[data-level="bronze"] .medal-slot.filled {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    box-shadow: 0 2px 6px rgba(205, 127, 50, 0.5);
}

.medal-checkpoint[data-level="silver"] .medal-slot.filled {
    background: linear-gradient(135deg, #C0C0C0, #757575);
    box-shadow: 0 2px 6px rgba(192, 192, 192, 0.5);
}

.medal-checkpoint[data-level="gold"] .medal-slot.filled {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.5);
}

.medal-checkpoint[data-level="diamond"] .medal-slot.filled {
    background: linear-gradient(135deg, #B9F2FF, #E0E7FF);
    box-shadow: 0 2px 6px rgba(185, 242, 255, 0.7);
}

@keyframes medalPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}


/* ============================================
   WIDGET MENTOR IA
   ============================================ */
.mentor-card {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid #ddd6fe;
}

.mentor-avatar {
    animation: mentorPulse 3s ease-in-out infinite;
}

@keyframes mentorPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.mentor-bubble {
    position: relative;
}

.mentor-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid white;
}

#mentor-message {
    transition: opacity 0.2s ease;
}

#mentor-refresh {
    transition: transform 0.3s ease;
}

#mentor-refresh:hover {
    transform: rotate(180deg);
}

/* ============================================
   CTA PRINCIPAL - Con efectos por nivel
   ============================================ */
.main-cta {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.main-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.5);
}

.main-cta:active {
    transform: translateY(0);
}

/* Modo Corto - Efecto Bronce */
.main-cta.mode-corto {
    background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%);
    box-shadow: 0 10px 30px rgba(205, 127, 50, 0.5);
}

.main-cta.mode-corto::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    animation: bronzeShine 3s ease-in-out infinite;
}

@keyframes bronzeShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Modo Completo - Efecto Plata */
.main-cta.mode-completo {
    background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
    box-shadow: 0 10px 30px rgba(156, 163, 175, 0.5);
}

.main-cta.mode-completo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: silverShine 2.5s ease-in-out infinite;
}

@keyframes silverShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Modo Resistencia - Efecto Oro */
.main-cta.mode-resistencia {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
    color: #78350f;
}

.main-cta.mode-resistencia::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: goldShine 2s ease-in-out infinite;
}

@keyframes goldShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Modo Inferno - Efecto Fuego */
.main-cta.mode-inferno {
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 50%, #f97316 100%);
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.6);
    animation: infernoGlowCta 2s ease-in-out infinite;
}

.main-cta.mode-inferno::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: infernoFlames 1.5s ease-in-out infinite;
}

.main-cta.mode-inferno::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, rgba(255, 100, 0, 0.4), transparent);
    animation: infernoFlicker 0.8s ease-in-out infinite alternate;
}

@keyframes infernoGlowCta {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(220, 38, 38, 0.6),
                    0 0 20px rgba(249, 115, 22, 0.3);
    }
    50% {
        box-shadow: 0 15px 50px rgba(220, 38, 38, 0.8),
                    0 0 40px rgba(249, 115, 22, 0.5);
    }
}

@keyframes infernoFlames {
    0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
    25% { transform: translate(2%, 2%) rotate(1deg); opacity: 0.5; }
    50% { transform: translate(-1%, 1%) rotate(-1deg); opacity: 0.4; }
    75% { transform: translate(1%, -1%) rotate(0.5deg); opacity: 0.5; }
}

@keyframes infernoFlicker {
    0% { opacity: 0.4; height: 25%; }
    100% { opacity: 0.6; height: 35%; }
}

/* ============================================
   STATS CARDS
   ============================================ */
.stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

/* ============================================
   MODE CARDS
   ============================================ */
.mode-card {
    background: white;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
}

.mode-card.mode-available {
    border-color: #c7d2fe;
}

.mode-card.mode-available:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.lock-overlay.lock-inferno {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.8), rgba(234, 88, 12, 0.8));
}

/* ============================================
   BOTÓN FLOTANTE PRÁCTICA
   ============================================ */
.practice-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 50;
}

.practice-float-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(139, 92, 246, 0.5);
}

.practice-float-text {
    font-weight: 600;
    font-size: 14px;
}

/* En mobile, solo mostrar el icono */
@media (max-width: 640px) {
    .practice-float-btn {
        padding: 14px;
        border-radius: 50%;
    }

    .practice-float-text {
        display: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .medal-checkpoint {
        flex: 1;
    }

    .medal-slot {
        width: 14px;
        height: 14px;
    }

    .preparation-markers .marker {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .mentor-card {
        padding: 12px;
    }

    .mentor-avatar .w-12 {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   ANIMACIONES EXTRA
   ============================================ */
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-pulse-soft {
    animation: pulse-soft 2s ease-in-out infinite;
}

/* Celebración cuando se desbloquea algo */
.celebration {
    animation: celebrate 0.6s ease-out;
}

@keyframes celebrate {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ============================================
   MODAL SELECTOR DE AVATAR - Estilo Netflix/HBO
   ============================================ */
.avatar-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.avatar-modal.hidden {
    display: none;
}

.avatar-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.avatar-modal-content {
    position: relative;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.avatar-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-modal-header h2 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.avatar-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.avatar-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Avatar actual */
.avatar-current-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-current-img {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    border: 4px solid #6366f1;
    object-fit: cover;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.avatar-current-section p {
    color: #94a3b8;
    margin-top: 12px;
}

/* Categorías */
.avatar-categories {
    padding: 16px 24px 24px;
}

.avatar-category {
    margin-bottom: 24px;
}

.avatar-category:last-child {
    margin-bottom: 0;
}

.avatar-category-title {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
}

/* Opción de avatar individual */
.avatar-option {
    background: transparent;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.avatar-option:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   MÉRITO - MASCOTA IA
   ============================================ */

.merito-container {
    position: relative;
}

.merito-avatar {
    transition: all 0.3s ease-out;
}

.merito-avatar img {
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.25));
    transition: all 0.3s ease-out;
}

/* Animación flotante suave (idle) */
.merito-float {
    animation: merito-float 3s ease-in-out infinite;
}

@keyframes merito-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Animación de pulso (atención) */
.merito-pulse {
    animation: merito-pulse 2s ease-in-out infinite;
}

@keyframes merito-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Animación de celebración (score alto) */
.merito-celebrate {
    animation: merito-celebrate 0.6s ease-in-out 3;
}

@keyframes merito-celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.15) rotate(-5deg); }
    75% { transform: scale(1.15) rotate(5deg); }
}

/* Animación de comfort (apoyo) */
.merito-comfort {
    animation: merito-comfort 2s ease-in-out infinite;
}

@keyframes merito-comfort {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Transición al cambiar de estado */
.merito-avatar.changing {
    opacity: 0;
    transform: scale(0.8);
}

/* Glow para VIP */
.merito-vip-glow {
    animation: merito-vip-glow 2s ease-in-out infinite;
}

@keyframes merito-vip-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8)); }
}

/* Glow para Inferno */
.merito-inferno-glow {
    animation: merito-inferno-glow 1.5s ease-in-out infinite;
}

@keyframes merito-inferno-glow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.6)); }
    50% { filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.9)); }
}

/* Respeto a preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .merito-float,
    .merito-pulse,
    .merito-celebrate,
    .merito-comfort,
    .merito-vip-glow,
    .merito-inferno-glow {
        animation: none;
    }

    .merito-avatar {
        transition: none;
    }
}

.avatar-option:focus {
    outline: none;
    border-color: #6366f1;
}

.avatar-option.selected {
    border-color: #6366f1;
    transform: scale(1.1);
}

.avatar-option.selected::after {
    content: '✓';
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #6366f1;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.avatar-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease;
}

@media (max-width: 480px) {
    .avatar-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }
}

.avatar-option:hover .avatar-icon {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Avatar clickeable en header */
#userAvatar {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#userAvatar:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.5);
}

#userAvatar::after {
    content: '✏️';
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#userAvatar:hover::after {
    opacity: 1;
}

/* Scrollbar personalizado para el modal */
.avatar-modal-content::-webkit-scrollbar {
    width: 8px;
}

.avatar-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.avatar-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.avatar-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
