@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   🔑 VARIABLES Y VARIABLES DE DISEÑO (DISEÑO PREMIUM)
   ========================================================================== */
:root {
    --bg-primary: #070814;
    --bg-secondary: #0d0e24;
    --glass-bg: rgba(16, 18, 38, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(99, 102, 241, 0.35);
    
    /* Colores Temáticos */
    --accent-cyan: #00f2fe;
    --accent-purple: #9d4edd;
    --accent-indigo: #6366f1;
    --accent-green: #10b981;
    --accent-red: #f43f5e;
    --accent-gold: #f59e0b;
    
    /* Tipografía y Textos */
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Sombras y Efectos */
    --shadow-neon: 0 8px 32px 0 rgba(0, 242, 254, 0.08);
    --shadow-neon-purple: 0 8px 32px 0 rgba(157, 78, 221, 0.08);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   🏁 RESET Y ESTILOS GENERALES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 10% 20%, rgba(157, 78, 221, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(0, 242, 254, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(99, 102, 241, 0.08) 0px, transparent 70%);
    background-attachment: fixed;
    font-family: var(--font-body);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1.5rem;
    overflow-x: hidden;
}

/* Scrollbar Estilizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-indigo);
}

/* ==========================================================================
   ✨ CLASES REUTILIZABLES (GLASSMORPHISM)
   ========================================================================== */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

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

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-card), 0 10px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

/* ==========================================================================
   🖥️ LAYOUT DEL DASHBOARD
   ========================================================================== */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Cabecera Viva ──────────────────────────────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.brand-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.brand-logo {
    width: 90px;
    height: 90px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.4);
    animation: floatGlow 3.5s ease-in-out infinite alternate;
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-logo img {
    width: 90%;
    height: 90%;
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

.brand-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 45%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 55%
    );
    transform: rotate(45deg);
    animation: shineSweep 6s ease-in-out infinite;
}

@keyframes floatGlow {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 12px rgba(0, 242, 254, 0.25), 0 0 4px rgba(157, 78, 221, 0.15);
    }
    100% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 0 22px rgba(0, 242, 254, 0.45), 0 0 12px rgba(157, 78, 221, 0.35);
    }
}

@keyframes shineSweep {
    0%, 100% {
        transform: translate(-100%, -100%) rotate(45deg);
    }
    30%, 70% {
        transform: translate(-100%, -100%) rotate(45deg);
    }
    50% {
        transform: translate(100%, 100%) rotate(45deg);
    }
}

.brand-section {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-header);
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    text-transform: uppercase;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 0.2rem;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
}

.header-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.upload-widget {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#upload-discipline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
}

#upload-discipline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

#btn-upload-zip {
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid rgba(0, 242, 254, 0.25);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

#btn-upload-zip:hover {
    background: rgba(0, 242, 254, 0.2);
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

#btn-config-hr {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

#btn-config-hr:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent-green);
    animation: pulseGlow 2s infinite;
}

/* ── Grid de KPIs ───────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.kpi-icon {
    font-size: 1.2rem;
    color: var(--accent-indigo);
    opacity: 0.8;
}

.kpi-card.cyan .kpi-icon { color: var(--accent-cyan); }
.kpi-card.purple .kpi-icon { color: var(--accent-purple); }
.kpi-card.green .kpi-icon { color: var(--accent-green); }
.kpi-card.gold .kpi-icon { color: var(--accent-gold); }

.kpi-value {
    font-family: var(--font-header);
    font-size: 2.2rem;
    font-weight: 700;
    margin-top: 0.5rem;
    background: linear-gradient(180deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.kpi-card.cyan .kpi-value { background: linear-gradient(180deg, #ffffff 0%, var(--accent-cyan) 200%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-card.purple .kpi-value { background: linear-gradient(180deg, #ffffff 0%, var(--accent-purple) 200%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-card.green .kpi-value { background: linear-gradient(180deg, #ffffff 0%, var(--accent-green) 200%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-card.gold .kpi-value { background: linear-gradient(180deg, #ffffff 0%, var(--accent-gold) 200%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.kpi-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.trend-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
}
.trend-badge.up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}
.trend-badge.down {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-red);
}

.discipline-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid transparent;
}
.discipline-badge.mtb {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}
.discipline-badge.gravel {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}
.discipline-badge.ruta {
    background: rgba(0, 242, 254, 0.12);
    color: var(--accent-cyan);
    border-color: rgba(0, 242, 254, 0.25);
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}
.discipline-badge.atletismo {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
    border-color: rgba(236, 72, 153, 0.25);
    text-shadow: 0 0 8px rgba(236, 72, 153, 0.3);
}

/* ── Panel Principal de Gráficos y Análisis de IA ───────────────────────── */
.main-dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 1.5rem;
}

.charts-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-container-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-large {
    grid-column: span 2;
}

.chart-title {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 3px solid var(--accent-cyan);
    padding-left: 0.5rem;
}

.chart-body {
    width: 100%;
    height: 350px;
}

/* ── Panel de IA Coach (Estilo Avanzado) ────────────────────────────────── */
.ai-coach-panel {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    height: 100%;
    min-height: 500px;
}

.ai-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.config-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Estilos Premium de Strava */
#btn-strava-connect {
    background: rgba(252, 97, 0, 0.12);
    border: 1px solid rgba(252, 97, 0, 0.25);
    color: #FC6100;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

#btn-strava-connect:hover {
    background: rgba(252, 97, 0, 0.2);
    border-color: rgba(252, 97, 0, 0.4);
    box-shadow: 0 0 10px rgba(252, 97, 0, 0.15);
    color: #fff;
}

#btn-strava-explore {
    background: rgba(252, 97, 0, 0.15);
    border: 1px solid rgba(252, 97, 0, 0.3);
    color: #FC6100;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

#btn-strava-explore:hover {
    background: rgba(252, 97, 0, 0.22);
    border-color: rgba(252, 97, 0, 0.5);
    box-shadow: 0 0 10px rgba(252, 97, 0, 0.2);
    color: #fff;
}

#btn-strava-sync {
    background: rgba(252, 97, 0, 0.08);
    border: 1px solid rgba(252, 97, 0, 0.2);
    color: #FC6100;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

#btn-strava-sync:hover {
    background: rgba(252, 97, 0, 0.18);
    border-color: rgba(252, 97, 0, 0.4);
    box-shadow: 0 0 8px rgba(252, 97, 0, 0.15);
    color: #fff;
}

#btn-strava-sync.syncing i {
    animation: fa-spin 1.5s linear infinite;
    color: #FC6100;
}

/* Configuración IA Colapsable */
.ai-config-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 1rem;
    display: none;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.ai-config-box.active {
    display: flex;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input {
    background: rgba(16, 18, 38, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    width: 100%;
    outline: none;
    transition: var(--transition-smooth);
}
.form-input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

/* Área de Visualización del Informe */
.ai-output-container {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.25rem;
    overflow-y: auto;
    height: 700px;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-placeholder-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}
.ai-placeholder-msg i {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Estilos del Markdown renderizado dentro de la IA */
.markdown-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.markdown-body h2 {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.markdown-body h2:first-child {
    margin-top: 0;
}

.markdown-body p {
    margin-bottom: 0.8rem;
    color: #d1d5db;
}

.markdown-body ul, .markdown-body ol {
    margin-left: 1.2rem;
    margin-bottom: 0.8rem;
    color: #d1d5db;
}

.markdown-body li {
    margin-bottom: 0.3rem;
}

.markdown-body code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

.markdown-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Área de Preguntas Científicas / Chat */
.ai-chat-input-area {
    display: flex;
    gap: 0.6rem;
    margin-top: auto;
}

.ai-chat-input {
    flex-grow: 1;
    background: rgba(16, 18, 38, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    outline: none;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}
.ai-chat-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.2);
}

/* Soporte para textarea en el chat */
textarea.ai-chat-input {
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    font-family: var(--font-body);
    line-height: 1.4;
}

.btn-generate {
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-purple) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0 1.25rem;
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-generate:active {
    transform: translateY(1px);
}

.btn-generate:disabled {
    background: #1f2937;
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Animación de Carga de la IA */
.ai-loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    margin: auto;
}
.ai-loading-indicator.active {
    display: flex;
}
.spinner-neon {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 242, 254, 0.1);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-bubble.user {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-bubble.coach {
    background: rgba(157, 78, 221, 0.1);
    border: 1px solid rgba(157, 78, 221, 0.25);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    color: #e5e7eb;
    position: relative;
    padding-right: 2.5rem;
}

.ai-output-container .markdown-body {
    position: relative;
    padding-right: 2.5rem;
}

/* Botón de altavoz TTS premium */
.tts-speak-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 242, 254, 0.2);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

.tts-speak-btn:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
    transform: scale(1.05);
}

.tts-speak-btn:active {
    transform: scale(0.95);
}

/* Estado de carga */
.tts-speak-btn.loading {
    color: var(--accent-purple);
    border-color: rgba(157, 78, 221, 0.4);
    background: rgba(157, 78, 221, 0.05);
}

.tts-speak-btn.loading i {
    animation: fa-spin 1s linear infinite;
}

/* Estado de reproducción */
.tts-speak-btn.playing {
    color: var(--accent-purple);
    border-color: var(--accent-purple);
    background: rgba(157, 78, 221, 0.15);
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.5);
    animation: tts-pulse-glow 1.5s infinite ease-in-out;
}

@keyframes tts-pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(157, 78, 221, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(157, 78, 221, 0.6);
        border-color: rgba(157, 78, 221, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(157, 78, 221, 0.3);
    }
}

/* --- Efecto Karaoke por Frases para TTS --- */
/* Cuando se está reproduciendo el audio, las frases se atenúan ligeramente */
.chat-bubble.coach.playing-karaoke .tts-segment,
.ai-output-container.playing-karaoke .tts-segment {
    opacity: 0.65;
    transition: opacity 0.3s ease, color 0.3s ease, text-shadow 0.3s ease, background 0.3s ease;
    border-radius: 4px;
    padding: 1px 4px;
    display: inline-block;
}

/* La frase activa brilla con estética neón cian del sistema y un sombreado de fondo premium */
.chat-bubble.coach.playing-karaoke .tts-segment.active,
.ai-output-container.playing-karaoke .tts-segment.active {
    opacity: 1;
    color: var(--accent-cyan) !important;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.7);
    font-weight: 500;
    background: rgba(0, 242, 254, 0.22) !important;
}

/* ── Panel de Marcas Personales (PRs) ─────────────────────────────────── */
.prs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.pr-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    /* Entrance Animation */
    animation: prSlideUpIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--delay, 0ms);
}

/* Temas de color de Neón individuales para PRs */
.pr-card.cyan {
    --theme-color: var(--accent-cyan);
    --bg-glow: rgba(0, 242, 254, 0.08);
    --border-glow: rgba(0, 242, 254, 0.25);
    --icon-bg: rgba(0, 242, 254, 0.1);
}
.pr-card.gold {
    --theme-color: var(--accent-gold);
    --bg-glow: rgba(245, 158, 11, 0.08);
    --border-glow: rgba(245, 158, 11, 0.25);
    --icon-bg: rgba(245, 158, 11, 0.1);
}
.pr-card.volt {
    --theme-color: #eab308;
    --bg-glow: rgba(234, 179, 8, 0.08);
    --border-glow: rgba(234, 179, 8, 0.25);
    --icon-bg: rgba(234, 179, 8, 0.1);
}
.pr-card.purple {
    --theme-color: #a855f7;
    --bg-glow: rgba(168, 85, 247, 0.08);
    --border-glow: rgba(168, 85, 247, 0.25);
    --icon-bg: rgba(168, 85, 247, 0.1);
}
.pr-card.orange {
    --theme-color: var(--accent-orange);
    --bg-glow: rgba(249, 115, 22, 0.08);
    --border-glow: rgba(249, 115, 22, 0.25);
    --icon-bg: rgba(249, 115, 22, 0.1);
}
.pr-card.red {
    --theme-color: #ef4444;
    --bg-glow: rgba(239, 68, 68, 0.08);
    --border-glow: rgba(239, 68, 68, 0.25);
    --icon-bg: rgba(239, 68, 68, 0.1);
}

.pr-card .pr-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--icon-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--theme-color);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pr-card:hover {
    background: var(--bg-glow);
    border-color: var(--border-glow);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2), 0 0 15px var(--bg-glow);
    transform: translateY(-3px);
}

.pr-card:hover .pr-icon-wrapper {
    transform: scale(1.12);
    box-shadow: 0 0 12px var(--icon-bg);
}

.pr-details {
    display: flex;
    flex-direction: column;
}

.pr-title {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.pr-value {
    font-family: var(--font-header);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.1rem;
    letter-spacing: -0.02em;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.pr-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.05rem;
    font-weight: 500;
}

/* Micro-interacciones de Iconos en Hover */

/* Latido Real (Frecuencia Cardíaca) */
@keyframes prHeartbeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15); }
    40% { transform: scale(1); }
    60% { transform: scale(1.15); }
}
.pr-card.red:hover .pr-icon-wrapper i {
    animation: prHeartbeat 0.9s infinite ease-in-out;
}

/* Balanceo de Pedaleo (Cadencia Pico) */
@keyframes prPedaling {
    0% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-8deg) translateY(-1px); }
    50% { transform: rotate(0deg) translateY(0); }
    75% { transform: rotate(8deg) translateY(1px); }
    100% { transform: rotate(0deg) translateY(0); }
}
.pr-card.purple:hover .pr-icon-wrapper i {
    animation: prPedaling 0.8s infinite linear;
}

/* Desplazamiento y Elevación de Ruta (Ruta más larga) */
@keyframes prRouteMove {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px) scaleX(1.05); }
}
.pr-card.cyan:hover .pr-icon-wrapper i {
    animation: prRouteMove 1s infinite ease-in-out;
}

/* Mayor Ascenso (Montaña que se eleva) */
@keyframes prAscending {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.pr-card.gold:hover .pr-icon-wrapper i {
    animation: prAscending 1.2s infinite ease-in-out;
}

/* Rayo Eléctrico Flasheante (Velocidad Máxima) */
@keyframes prLightningPulse {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 2px var(--theme-color)); }
    50% { opacity: 0.7; filter: drop-shadow(0 0 8px var(--theme-color)); }
}
.pr-card.volt:hover .pr-icon-wrapper i {
    animation: prLightningPulse 0.6s infinite ease-in-out;
}

/* OPCIONES DE ANIMACIÓN PARA FUERZA PENDIENTE (MÁXIMA INCLINACIÓN) */

/* ── OPCIÓN A: Pesa que se levanta (Fuerza Muscular) [GUARDADO PARA RETORNO]
@keyframes prDumbbellLift {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-4px) rotate(-12deg); }
    70% { transform: translateY(-4px) rotate(12deg); }
}
.pr-card.orange:hover .pr-icon-wrapper i {
    animation: prDumbbellLift 0.8s infinite ease-in-out;
}
── */

/* ── OPCIÓN B: Impulso de Flechas Holográficas de Elevación (Inclinación de Rampa Extrema) [ACTIVO] */
@keyframes prChevronThrust {
    0% { transform: translateY(0); opacity: 1; }
    40% { transform: translateY(-6px); opacity: 0.3; }
    41% { transform: translateY(6px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
.pr-card.orange:hover .pr-icon-wrapper i {
    animation: prChevronThrust 0.75s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── OPCIÓN C: Llama de Esfuerzo / Quema de Piernas (Máxima Pendiente de Rampa) [GUARDADO PARA RETORNO]
@keyframes prFireFlicker {
    0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px var(--theme-color)); }
    20% { transform: scale(1.12) rotate(-3deg) skewX(-2deg); filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.8)); }
    40% { transform: scale(1.05) rotate(2deg) skewX(1deg); filter: drop-shadow(0 0 5px rgba(249, 115, 22, 0.5)); }
    60% { transform: scale(1.15) rotate(-2deg) skewX(-2deg); filter: drop-shadow(0 0 12px rgba(249, 115, 22, 0.9)); }
    80% { transform: scale(1.08) rotate(3deg) skewX(2deg); filter: drop-shadow(0 0 7px rgba(249, 115, 22, 0.6)); }
}
.pr-card.orange:hover .pr-icon-wrapper i {
    animation: prFireFlicker 0.65s infinite ease-in-out;
}
── */

/* Entrada Escalonada General */
@keyframes prSlideUpIn {
    from {
        opacity: 0;
        transform: translateY(18px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ── Tabla de Historial (Activity Log) ────────────────────────────────── */
.table-section {
    width: 100%;
}

.cyber-table-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.2rem 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: var(--font-header);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.cyber-table-loader.active {
    opacity: 1;
}

.loader-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    animation: neonPulse 1.5s infinite ease-in-out;
}

@keyframes neonPulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
        background: var(--accent-cyan);
        box-shadow: 0 0 4px var(--accent-cyan);
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        background: var(--accent-purple);
        box-shadow: 0 0 10px var(--accent-purple);
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

th {
    background: rgba(25, 28, 50, 0.85);
    font-family: var(--font-header);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}
th:hover {
    color: var(--text-primary);
    background: rgba(25, 28, 50, 0.95);
}

th i {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    color: var(--text-muted);
}

td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #e5e7eb;
    font-weight: 400;
    transition: var(--transition-smooth);
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: var(--transition-smooth);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.metric-highlight {
    font-family: var(--font-header);
    font-weight: 600;
}

/* ==========================================================================
   🎬 ANIMACIONES Y KEYFRAMES
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 4px var(--accent-green);
    }
    50% {
        box-shadow: 0 0 14px var(--accent-green);
    }
    100% {
        box-shadow: 0 0 4px var(--accent-green);
    }
}

/* Efecto de cargado de tarjeta secuencial */
.dashboard-container > * {
    animation: fadeInUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) both;
}

.dashboard-container > *:nth-child(1) { animation-delay: 0.1s; }
.dashboard-container > *:nth-child(2) { animation-delay: 0.2s; }
.dashboard-container > *:nth-child(3) { animation-delay: 0.3s; }
.dashboard-container > *:nth-child(4) { animation-delay: 0.4s; }

/* ==========================================================================
   📱 COMPATIBILIDAD MÓVIL Y RESPONSIVIDAD
   ========================================================================== */
@media (max-width: 1200px) {
    .main-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .ai-coach-panel {
        min-height: 450px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.75rem;
    }
    header {
        flex-direction: column;
        gap: 1.25rem;
        align-items: center;
        padding: 1.25rem 1rem;
        text-align: center;
    }
    .brand-logo-wrapper {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    .brand-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .brand-title {
        font-size: 1.8rem;
        text-align: center;
    }
    .brand-subtitle {
        font-size: 0.75rem;
        text-align: center;
        letter-spacing: 1px;
    }
    .header-controls {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }
    .upload-widget {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    #upload-discipline {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
    #btn-upload-zip {
        flex: 2;
        min-width: 140px;
        justify-content: center;
    }
    #btn-config-hr {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
    }
    .live-status {
        width: 100%;
        justify-content: center;
    }
    .chart-container-grid {
        grid-template-columns: 1fr;
    }
    .chart-large {
        grid-column: span 1;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .ai-output-container {
        height: 450px;
    }
    .route-selector-wrapper {
        width: 100%;
        justify-content: space-between;
    }
    .form-input-selector {
        flex: 1;
        width: 100%;
    }
}

/* ==========================================================================
   🧬 ESTILOS DEL GRÁFICO DE DISPERSIÓN FISIOLÓGICO MULTIDIMENSIONAL
   ========================================================================== */
.chart-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.route-selector-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.route-selector-wrapper:hover {
    border-color: var(--glass-border-hover);
    background: rgba(255, 255, 255, 0.05);
}

.form-input-selector {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    padding-right: 1rem;
}

.form-input-selector option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.chart-footer-caption {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}


/* ==========================================================================
   🧬 REDISEÑO ESTÉTICO "CYBERPUNK / KRYPTON" & MICRO-ANIMACIONES
   ========================================================================== */

/* ── Latido Fisiológico Sincrónico ── */
:root {
    --heart-rate-duration: 0.8s; /* 75 bpm por defecto */
    --pulse-glow-color: rgba(0, 242, 254, 0.25);
}

.kpi-card.pulse-active {
    animation: heartbeatGlow var(--heart-rate-duration) infinite ease-in-out;
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

/* Animación de latido biológico (Doble contracción / Doble fase) */
@keyframes heartbeatGlow {
    0% {
        transform: scale(1);
        box-shadow: var(--shadow-card);
        border-color: var(--glass-border);
    }
    14% {
        transform: scale(1.018);
        box-shadow: 0 0 15px var(--pulse-glow-color), var(--shadow-card);
        border-color: var(--pulse-glow-color);
    }
    28% {
        transform: scale(1.005);
        box-shadow: 0 0 8px var(--pulse-glow-color), var(--shadow-card);
    }
    42% {
        transform: scale(1.015);
        box-shadow: 0 0 22px var(--pulse-glow-color), var(--shadow-card);
        border-color: var(--pulse-glow-color);
    }
    70% {
        transform: scale(1);
        box-shadow: var(--shadow-card);
        border-color: var(--glass-border);
    }
    100% {
        transform: scale(1);
        box-shadow: var(--shadow-card);
        border-color: var(--glass-border);
    }
}

/* Icono del Corazón en Latido */
.heart-beat-icon {
    display: inline-block;
    animation: pulseHeart var(--heart-rate-duration) infinite ease-in-out;
    color: var(--accent-red);
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.25); }
    28% { transform: scale(1.05); }
    42% { transform: scale(1.2); }
    70% { transform: scale(1); }
}

/* ── Cristal Líquido Holográfico (Mouse Move Follow Aura) ── */
.glass-card {
    position: relative;
    overflow: hidden;
}

/* Halo luminoso interactivo con radial-gradient */
.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        350px circle at var(--mouse-x, 0px) var(--mouse-y, 0px),
        rgba(99, 102, 241, 0.08),
        transparent 50%
    );
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card:hover::after {
    opacity: 1;
}

/* Asegurar que el contenido esté sobre el ::after de fondo */
.glass-card > * {
    position: relative;
    z-index: 2;
}

/* ── Consola de Filtros Deportivos Cyberpunk (Cyber-Console) ── */
.cyber-console {
    background: rgba(13, 14, 36, 0.7);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.05), inset 0 0 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.cyber-console:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.12), inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.cyber-console-title {
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-indigo);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.cyber-filters {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-grow: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.cyber-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 220px;
}

.cyber-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    justify-content: space-between;
}

.cyber-filter-value {
    color: var(--accent-cyan);
    font-family: var(--font-header);
    font-weight: 800;
    text-shadow: 0 0 6px rgba(0, 242, 254, 0.4);
}

/* Estilización Avanzada de los Sliders Neón */
.cyber-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition-smooth);
}

.cyber-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
}

/* Chrome / Safari / Edge Thumb */
.cyber-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    border: 2px solid #070814;
    box-shadow: 0 0 10px var(--accent-cyan);
    margin-top: -5px;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.cyber-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 15px var(--accent-cyan), 0 0 5px #ffffff;
    background: #ffffff;
}

/* Firefox Thumb */
.cyber-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    border: 2px solid #070814;
    box-shadow: 0 0 10px var(--accent-cyan);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.cyber-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 0 15px var(--accent-cyan), 0 0 5px #ffffff;
    background: #ffffff;
}

/* ==========================================================================
   🧬 MAQUETACIÓN TWIN GRID (MAPA GEOESPACIAL + TELEMETRÍA SINCRÓNICA)
   ========================================================================== */

.telemetry-twin-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    width: 100%;
}

.map-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.map-body {
    width: 100%;
    height: 420px;
    min-height: 420px;
    background: #070814;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 10;
}

/* Personalización Estética de Leaflet (Cyberpunk Dark Mode) */
.leaflet-container {
    background: #070814 !important;
    font-family: var(--font-body) !important;
}

/* Controles de Zoom neón */
.leaflet-bar {
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    transition: var(--transition-smooth) !important;
}

.leaflet-bar a:hover {
    background-color: var(--accent-indigo) !important;
    color: #ffffff !important;
}

/* Popups Cyberpunk */
.leaflet-popup-content-wrapper {
    background: rgba(13, 14, 36, 0.95) !important;
    border: 1px solid var(--glass-border-hover) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25) !important;
    backdrop-filter: blur(8px);
}

.leaflet-popup-tip {
    background: rgba(13, 14, 36, 0.95) !important;
    border-left: 1px solid var(--glass-border-hover) !important;
    border-bottom: 1px solid var(--glass-border-hover) !important;
}

.leaflet-popup-content {
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
}

/* Responsividad de la cuadrícula dual */
@media (max-width: 1200px) {
    .telemetry-twin-grid {
        grid-template-columns: 1fr;
    }
}

/* Marcador de reproducción neón en el mapa */
.playback-marker-neon {
    filter: drop-shadow(0 0 6px #00f2fe) drop-shadow(0 0 2px #ffffff);
}

/* ==========================================================================
   🧬 PIE DE PÁGINA (DASHBOARD FOOTER)
   ========================================================================== */
.dashboard-footer {
    margin-top: 3rem;
    padding-bottom: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.footer-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(0, 242, 254, 0) 0%, rgba(0, 242, 254, 0.3) 50%, rgba(0, 242, 254, 0) 100%);
    margin-bottom: 1.5rem;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0 1rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-brand {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.footer-tagline {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.footer-center {
    font-size: 0.7rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(13, 14, 36, 0.5);
    border: 1px solid var(--glass-border);
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.footer-right {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    .footer-left {
        align-items: center;
    }
}

/* ── Modal de Configuración Fisiológica Premium (Glassmorphism) ─────────── */
.cyber-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 11, 30, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.25s ease-out;
}

.cyber-modal-card {
    width: 100%;
    max-width: 480px;
    background: rgba(20, 21, 51, 0.45);
    border: 1px solid rgba(0, 242, 254, 0.15);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 242, 254, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cyber-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.8rem;
}

.cyber-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cyber-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0;
    margin: 0;
}

.cyber-modal-close:hover {
    color: var(--accent-red);
}

.cyber-modal-body {
    display: flex;
    flex-direction: column;
}

.hr-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.hr-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hr-input-group label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hr-input-group input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    text-align: center;
    font-family: monospace;
    transition: all 0.2s ease;
}

.hr-input-group input:focus {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.03);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.hr-input-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.1rem;
}

.cyber-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.8rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ==========================================================================
   🌌 CYBERPUNK FLOATING CONTEXT MENU
   ========================================================================== */
.cyber-context-menu {
    position: absolute;
    z-index: 10000;
    background: rgba(10, 15, 30, 0.94);
    border: 1px solid rgba(0, 242, 254, 0.35);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.25), inset 0 0 8px rgba(0, 242, 254, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    padding: 6px 0;
    width: 220px;
    font-family: 'Outfit', 'Inter', sans-serif;
    color: #fff;
    font-size: 0.85rem;
    animation: fadeIn 0.12s ease-out;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 10px 14px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.2s ease;
    font-weight: 500;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--accent-cyan);
    font-size: 0.95rem;
}

.context-menu-item:hover {
    background: rgba(0, 242, 254, 0.08);
    color: #fff;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.6);
}

.context-menu-item.accent-purple i {
    color: var(--accent-purple);
}

.context-menu-item.accent-purple:hover {
    background: rgba(168, 85, 247, 0.08);
    color: #fff;
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

/* Efectos Premium para Configuración y Errores de API Key */
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.input-highlight-error {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
    animation: shakeError 0.4s ease-in-out;
}

/* ── Modo Widescreen Expandido para el Coach de IA ────────────────────── */

/* Cuando el Coach está expandido, el grid padre cambia a 1 sola columna */
.main-dashboard-grid.coach-expanded {
    grid-template-columns: 1fr !important;
}

/* El Coach se reordena primero y ocupa todo el ancho */
.main-dashboard-grid.coach-expanded .ai-coach-panel {
    order: -1;
    min-height: 75vh;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.25);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* El contenedor de output del chat se agranda significativamente */
.main-dashboard-grid.coach-expanded .ai-output-container {
    height: calc(75vh - 160px) !important;
    max-height: calc(75vh - 160px) !important;
    background: rgba(0, 0, 0, 0.35) !important;
}

/* Los gráficos se reorganizan debajo del Coach expandido y siguen visibles */
.main-dashboard-grid.coach-expanded .charts-section {
    order: 1;
}

/* ── Estilos Premium para Tablas Markdown de IA ───────────────────────── */
.markdown-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.82rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 11, 28, 0.4);
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

.markdown-body th {
    background: rgba(157, 78, 221, 0.2) !important;
    color: var(--accent-cyan) !important;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid rgba(0, 242, 254, 0.3) !important;
    text-shadow: 0 0 6px rgba(0, 242, 254, 0.4);
    text-align: left;
    white-space: nowrap;
}

.markdown-body td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.markdown-body tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.markdown-body tr:hover {
    background: rgba(157, 78, 221, 0.05);
}

/* ==========================================================================
   📋 PLANES DE ENTRENAMIENTO
   ========================================================================== */

/* Scrollbar del modal de planes */
#planes-modal .cyber-modal-card::-webkit-scrollbar {
    width: 4px;
}
#planes-modal .cyber-modal-card::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 10px;
}

/* Tarjeta de Plan Premium */
.cyber-plan-card {
    background: rgba(13, 14, 36, 0.45) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 14px !important;
    padding: 1rem 1.2rem !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.cyber-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-indigo);
    opacity: 0.6;
    transition: all 0.3s ease;
}
.cyber-plan-card:hover {
    transform: translateY(-2px) !important;
    background: rgba(16, 18, 38, 0.75) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15) !important;
}
.cyber-plan-card:hover::before {
    background: var(--accent-green);
    height: 100%;
    opacity: 1;
}

/* Tarjeta de Sesión Premium */
.cyber-session-card {
    background: rgba(255, 255, 255, 0.015) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-radius: 10px !important;
    padding: 0.7rem 0.9rem !important;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.cyber-session-card:hover {
    background: rgba(255, 255, 255, 0.035) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(4px) !important;
}

/* Bordes HSL según tipo de entrenamiento */
.cyber-session-card.tipo-descanso { border-left: 3.5px solid hsl(215, 15%, 45%) !important; }
.cyber-session-card.tipo-descanso:hover { box-shadow: 0 0 10px rgba(107, 114, 128, 0.1) !important; }

.cyber-session-card.tipo-recuperacion { border-left: 3.5px solid hsl(150, 80%, 45%) !important; }
.cyber-session-card.tipo-recuperacion:hover { box-shadow: 0 0 10px rgba(16, 185, 129, 0.15) !important; }

.cyber-session-card.tipo-resistencia { border-left: 3.5px solid hsl(180, 100%, 45%) !important; }
.cyber-session-card.tipo-resistencia:hover { box-shadow: 0 0 10px rgba(0, 242, 254, 0.15) !important; }

.cyber-session-card.tipo-tempo { border-left: 3.5px solid hsl(38, 100%, 50%) !important; }
.cyber-session-card.tipo-tempo:hover { box-shadow: 0 0 10px rgba(245, 158, 11, 0.15) !important; }

.cyber-session-card.tipo-umbral { border-left: 3.5px solid hsl(8, 100%, 55%) !important; }
.cyber-session-card.tipo-umbral:hover { box-shadow: 0 0 10px rgba(244, 63, 94, 0.15) !important; }

.cyber-session-card.tipo-vo2max { border-left: 3.5px solid hsl(275, 100%, 60%) !important; }
.cyber-session-card.tipo-vo2max:hover { box-shadow: 0 0 10px rgba(157, 78, 221, 0.15) !important; }

.cyber-session-card.tipo-fuerza { border-left: 3.5px solid hsl(235, 100%, 65%) !important; }
.cyber-session-card.tipo-fuerza:hover { box-shadow: 0 0 10px rgba(99, 102, 241, 0.15) !important; }

.cyber-session-card.tipo-tecnica { border-left: 3.5px solid hsl(190, 100%, 50%) !important; }
.cyber-session-card.tipo-tecnica:hover { box-shadow: 0 0 10px rgba(6, 182, 212, 0.15) !important; }

/* Drawer Desplegable de Sesión */
.session-drawer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.session-drawer.expanded {
    max-height: 400px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-bottom: 0.5rem;
}

/* Acordeón de Semana */
.week-accordion {
    margin-bottom: 0.8rem;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    overflow: hidden;
}
.week-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.015);
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}
.week-accordion-header:hover {
    background: rgba(255, 255, 255, 0.03);
}
.week-accordion-body {
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

/* Píldoras de Métricas */
.intensity-pill {
    font-size: 0.58rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.intensity-pill.z1 { background: rgba(16, 185, 129, 0.15) !important; color: hsl(150, 80%, 45%) !important; border-color: rgba(16, 185, 129, 0.3) !important; }
.intensity-pill.z2 { background: rgba(0, 242, 254, 0.15) !important; color: hsl(180, 100%, 45%) !important; border-color: rgba(0, 242, 254, 0.3) !important; }
.intensity-pill.z3 { background: rgba(245, 158, 11, 0.15) !important; color: hsl(38, 100%, 50%) !important; border-color: rgba(245, 158, 11, 0.3) !important; }
.intensity-pill.z4 { background: rgba(244, 63, 94, 0.15) !important; color: hsl(8, 100%, 55%) !important; border-color: rgba(244, 63, 94, 0.3) !important; }
.intensity-pill.z5 { background: rgba(157, 78, 221, 0.15) !important; color: hsl(275, 100%, 60%) !important; border-color: rgba(157, 78, 221, 0.3) !important; }
.intensity-pill.descanso { background: rgba(107, 114, 128, 0.15) !important; color: hsl(215, 15%, 70%) !important; border-color: rgba(107, 114, 128, 0.3) !important; }

/* SVG Progress Ring HUD */
.cyber-radial-progress {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cyber-radial-progress svg {
    transform: rotate(-90deg);
    width: 44px;
    height: 44px;
}
.cyber-radial-progress circle {
    fill: none;
    stroke-width: 3.5;
}
.cyber-radial-progress .bg-ring {
    stroke: rgba(255, 255, 255, 0.05);
}
.cyber-radial-progress .progress-ring {
    stroke: var(--accent-green);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    filter: drop-shadow(0 0 3px rgba(16, 185, 129, 0.6));
}
.cyber-radial-progress .percentage-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-header);
}

/* Badge GPX */
.gpx-match-badge {
    font-size: 0.58rem;
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.25);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}
.gpx-match-badge:hover {
    background: rgba(0, 242, 254, 0.18);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* Responsive: modal más pequeño en mobile */
@media (max-width: 640px) {
    #planes-modal .cyber-modal-card {
        max-width: 95vw;
        max-height: 85vh;
    }
}


/* ==========================================================================
   🔑 ESTILOS MULTIUSUARIO PREMIUM (LOGIN & PERFIL)
   ========================================================================== */

/* Wrapper del Login en Pantalla Completa */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 15% 15%, rgba(157, 78, 221, 0.25) 0px, transparent 45%),
        radial-gradient(at 85% 85%, rgba(0, 242, 254, 0.2) 0px, transparent 45%),
        radial-gradient(at 50% 50%, rgba(99, 102, 241, 0.12) 0px, transparent 60%);
    overflow: hidden;
    animation: fadeIn 0.4s ease-out;
}

/* Resplandor neón en el fondo del login */
.login-glow {
    position: absolute;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, rgba(157, 78, 221, 0.05) 50%, transparent 100%);
    filter: blur(40px);
    animation: pulseGlow 8s ease-in-out infinite alternate;
}

/* Tarjeta del Login */
.login-card {
    width: 90%;
    max-width: 780px;
    padding: 3rem 2.5rem;
    text-align: center;
    border-radius: 24px;
    background: rgba(16, 18, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 242, 254, 0.05);
    transform: translateY(0);
    animation: slideUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.login-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 50px rgba(99, 102, 241, 0.15);
    transform: translateY(-4px);
}

/* Encabezado del Login */
.login-header {
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(0, 242, 254, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.25);
    margin-bottom: 1.5rem;
    animation: floatGlow 3.5s ease-in-out infinite alternate;
    overflow: hidden;
    flex-shrink: 0;
}

.login-logo img {
    width: 90%;
    height: 90%;
    object-fit: cover;
    border-radius: 50%;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
}

.login-card h2 {
    font-family: var(--font-header);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.login-card .subtitle {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    opacity: 0.9;
}

/* Cuerpo del Login */
.login-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.login-desc {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Botón de Google Login */
.btn-google-login {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-google-login:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.btn-google-login .icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-right: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-google-login .btn-text {
    flex-grow: 1;
    text-align: left;
    font-family: var(--font-body);
}

/* Footer del Login */
.login-footer {
    margin-top: 2.5rem;
}

.cyber-badge-glow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.04);
    background: rgba(0,0,0,0.2);
    display: inline-block;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.3);
}

/* Badge de Perfil en la Cabecera */
.profile-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.8rem 0.4rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-left: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.profile-badge:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.profile-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.65rem;
    color: var(--accent-cyan);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem;
    margin-left: 0.2rem;
    transition: var(--transition-smooth);
}

.logout-btn:hover {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
    transform: scale(1.1);
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.15);
        opacity: 0.95;
    }
}

/* --- SaaS Profile & Admin Styles --- */
#avatar-container-clickable:hover img {
    filter: brightness(0.8);
    border-color: var(--accent-purple) !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4) !important;
}

#avatar-container-clickable:hover #btn-change-avatar {
    background: var(--accent-purple) !important;
    transform: scale(1.1);
}

#btn-change-avatar {
    transition: all 0.2s ease-in-out;
}

#profile-admin-section table th,
#profile-admin-section table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.6rem;
    transition: background 0.15s ease;
    vertical-align: middle;
}

#profile-admin-section table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.admin-tier-select {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(0, 242, 254, 0.2) !important;
    color: var(--text-primary) !important;
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.admin-tier-select:focus {
    border-color: var(--accent-cyan) !important;
    outline: none;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

.admin-limit-input::-webkit-outer-spin-button,
.admin-limit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.admin-limit-input {
    width: 42px;
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(0, 242, 254, 0.2) !important;
    color: var(--text-primary) !important;
    border-radius: 4px;
    padding: 0.15rem 0.3rem;
    font-size: 0.7rem;
    font-family: monospace;
    text-align: center;
    transition: all 0.2s ease;
}

.admin-limit-input:focus {
    border-color: var(--accent-cyan) !important;
    outline: none;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}


.admin-delete-btn {
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #f43f5e !important;
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 22px;
    height: 20px;
}

.admin-delete-btn:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    border-color: rgba(239, 68, 68, 0.7) !important;
    color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
    transform: scale(1.08);
}

.admin-delete-btn:active {
    transform: scale(0.92);
}


/* Custom scrollbar for admin table list */
#profile-admin-section div::-webkit-scrollbar {
    width: 6px;
}

#profile-admin-section div::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#profile-admin-section div::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#profile-admin-section div::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 242, 254, 0.25);
}

#profile-name-input:focus {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.4) !important;
    background: rgba(15, 23, 42, 0.85) !important;
}

/* Estilos Premium e interactivos para enlaces GPX mencionados en el chat */
.chat-bubble a[href$=".gpx"] {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-cyan) !important;
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.25);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 0.1rem;
    cursor: pointer;
}

.chat-bubble a[href$=".gpx"]::before {
    content: "\f5a0"; /* Icono de mapa FontAwesome */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
}

.chat-bubble a[href$=".gpx"]:hover {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.chat-bubble a[href$=".gpx"]:active {
    transform: translateY(1px);
    box-shadow: 0 0 5px rgba(0, 242, 254, 0.2);
}
