@import url('screener.css');
@import url('rutinas.css');

/* --- SISTEMA DE DISEÑO --- */
:root {
    /* Backgrounds */
    --bg-void: #05040a;
    --bg-dark: #08060f;
    --bg-surface: #0f0c1a;
    --bg-elevated: #161228;

    /* Brand Colors */
    --cyan: #00f5d4;
    --cyan-dim: rgba(0, 245, 212, 0.10);
    --cyan-glow: rgba(0, 245, 212, 0.22);
    --violet: #7c4dff;
    --violet-dim: rgba(124, 77, 255, 0.12);
    --violet-glow: rgba(124, 77, 255, 0.25);
    --rose: #ff3d7f;

    /* Aliases (backward compat) */
    --primary: #7c4dff;
    --primary-hover: #9e75ff;
    --primary-glow: rgba(124, 77, 255, 0.25);
    --accent-cyan: #00f5d4;
    --accent-pink: #ff3d7f;
    --bg-deep: #0f0c1a;
    --card-bg: rgba(15, 12, 26, 0.75);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(124, 77, 255, 0.35);

    /* Text */
    --text-main: #f0eeff;
    --text-muted: #8b87a8;
    --text-highlight: #b388ff;
    --text-disabled: #4a4760;

    /* Semantic */
    --lvl-easy: #00e676;
    --lvl-medium: #ffb300;
    --lvl-hard: #ff1744;

    /* Border */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-default: rgba(255, 255, 255, 0.09);

    /* Radius */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-pill: 100px;

    /* Transitions */
    --t-fast: 0.15s ease;
    --t-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --t-spring: 0.45s cubic-bezier(0.22, 1, 0.36, 1);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
    --shadow-cyan: 0 0 24px rgba(0, 245, 212, 0.18);
    --shadow-violet: 0 0 24px rgba(124, 77, 255, 0.22);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 900px 700px at 85% 5%, rgba(124, 77, 255, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 700px 600px at 10% 90%, rgba(0, 245, 212, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 500px 400px at 50% 45%, rgba(255, 61, 127, 0.025) 0%, transparent 70%);
    pointer-events: none;
}

/* --- DECORACIONES DE FONDO (AMBIENT GLOW) --- */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.circle-1 {
    top: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--primary);
}

.circle-2 {
    bottom: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--accent-cyan);
}

/* --- HEADER --- */
.app-header {
    background: rgba(8, 7, 12, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-group {
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo .highlight {
    background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-right: 2px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vault-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.vault-status.disconnected {
    background: rgba(255, 23, 68, 0.1);
    color: var(--lvl-hard);
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.vault-status.connected {
    background: rgba(0, 230, 118, 0.1);
    color: var(--lvl-easy);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

/* --- CONTENEDOR PRINCIPAL --- */
.app-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    flex-grow: 1;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* --- TARJETAS PREMIUM (GLASSMORPHISM 2.0) --- */
.card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all var(--t-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.22), rgba(124, 77, 255, 0.15) 50%, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-base);
}

.card:hover::before { opacity: 1; }
.card:hover { box-shadow: var(--shadow-lg), var(--shadow-violet); }

/* --- FORMULARIO DE EJERCICIOS --- */
.form-section h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-highlight);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(124, 77, 255, 0.05);
    box-shadow: 0 0 12px var(--primary-glow);
}

input[type="date"] {
    color-scheme: dark !important;
    color: var(--text-main, #f0eeff) !important;
    cursor: pointer;
    min-height: 44px;
    font-size: 1rem !important;
    line-height: normal;
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    min-height: 1.4em;
    display: block;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.4);
    opacity: 0.85;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.15);
}

select option {
    background-color: var(--bg-deep);
    color: var(--text-main);
}

textarea {
    resize: vertical;
}

/* Botones */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: none;
    border-radius: 8px;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #512da8);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* --- SECCIÓN BIBLIOTECA --- */
.library-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.library-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.search-box {
    position: relative;
    width: 320px;
}

.search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding-left: 2.8rem;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    margin-left: 0.2rem;
}

.filter-selectors {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.8rem;
    position: relative;
    z-index: 100;
    overflow: visible;
}

.filter-bar {
    position: relative;
    z-index: 100;
    overflow: visible !important;
}

.custom-filter-dropdown {
    position: relative;
    width: 100%;
    z-index: 1;
}

.custom-filter-menu {
    z-index: 999999 !important;
}

/* --- BOTÓN TODOS LOS EJERCICIOS (REINICIO DE FILTROS) --- */
.btn-all-exercises {
    width: 100%;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.22) 0%, rgba(124, 77, 255, 0.28) 100%);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    margin-bottom: 0.3rem;
}

.btn-all-exercises:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4) 0%, rgba(124, 77, 255, 0.45) 100%);
    border-color: #00f5d4;
    color: #00f5d4;
    box-shadow: 0 0 14px rgba(0, 245, 212, 0.35);
    transform: translateY(-1px);
}

.btn-all-exercises:active {
    transform: translateY(0);
    box-shadow: 0 0 6px rgba(0, 245, 212, 0.2);
}

.btn-all-exercises svg {
    color: #a855f7;
    transition: color 0.2s ease;
}

.btn-all-exercises:hover svg {
    color: #00f5d4;
}

.dropzone-ramp-activate {
    min-height: 140px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
    transition: all 0.25s ease-in-out;
}

.dropzone-ramp-activate.drag-active {
    border-color: #00f5d4 !important;
    background: rgba(0, 245, 212, 0.08) !important;
    box-shadow: 0 0 16px rgba(0, 245, 212, 0.3), inset 0 0 15px rgba(0, 245, 212, 0.1) !important;
}

/* Filtros */
.filters-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.4rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Grid de Tarjetas */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* --- TARJETA DE EJERCICIO (DESIGN SYSTEM 2.0) --- */
.exercise-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 240px;
    box-shadow: var(--shadow-sm);
    transition: all var(--t-spring);
    position: relative;
    overflow: hidden;
    animation: enterUp var(--t-spring) both;
}

.exercise-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(0,245,212,0.25), rgba(124,77,255,0.2) 50%, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-base);
}

.exercise-card:hover::before { opacity: 1; }

.exercise-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(124, 77, 255, 0.12);
    border-color: rgba(124, 77, 255, 0.2);
}

.card-top {
    margin-bottom: 1rem;
}

.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.badge-muscle {
    background: rgba(0, 245, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 245, 212, 0.3);
}

.badge-material {
    background: rgba(179, 136, 255, 0.12);
    color: var(--text-highlight);
    border: 1px solid rgba(179, 136, 255, 0.25);
}

.badge-level {
    font-weight: 800;
}

.badge-level[data-level="Principiante"] {
    background: rgba(0, 230, 118, 0.12);
    color: var(--lvl-easy);
    border: 1px solid rgba(0, 230, 118, 0.25);
}
.badge-level[data-level="Intermedio"] {
    background: rgba(255, 145, 0, 0.12);
    color: var(--lvl-medium);
    border: 1px solid rgba(255, 145, 0, 0.25);
}
.badge-level[data-level="Avanzado"] {
    background: rgba(255, 23, 68, 0.12);
    color: var(--lvl-hard);
    border: 1px solid rgba(255, 23, 68, 0.25);
}

.exercise-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.exercise-notes {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
}

.btn-video {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-video:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--accent-cyan);
}

.filename-badge {
    font-family: monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.filename-badge svg {
    opacity: 0.5;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 100;
}

.toast {
    background: rgba(15, 13, 25, 0.9);
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 280px;
    animation: slideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success {
    border-left-color: var(--lvl-easy);
}

.toast.error {
    border-left-color: var(--lvl-hard);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- ESTILOS DE IMAGEN DE EJERCICIO --- */
.card-image-container {
    width: 100%;
    aspect-ratio: 16 / 20;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 8px;
    padding: 8px;
}

.card-image-container img {
    flex: 1;
    min-width: 0;
    height: 100%;
    object-fit: contain;
    opacity: 0.8;
    filter: brightness(0.85) contrast(1.1) grayscale(15%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.exercise-card:hover .card-image-container img {
    transform: scale(1.06);
    opacity: 1;
    filter: brightness(0.95) contrast(1.1) grayscale(0%);
}

/* --- ESTILOS DE PESTAÑAS (TABS) --- */
.tabs-container {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
    border-radius: 4px;
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-import {
    background: rgba(0, 245, 212, 0.1);
    border: 1px solid rgba(0, 245, 212, 0.2);
    color: var(--accent-cyan);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-import:hover {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.4);
    transform: translateY(-1px);
}

.synced-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.25);
    color: var(--lvl-easy);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.05);
}

.btn-edit {
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.25);
    color: #ffb300;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: #ffb300;
    color: #000;
    box-shadow: 0 0 12px rgba(255, 179, 0, 0.45);
    transform: translateY(-1px);
}

/* --- MODO MINIATURAS (GRID) --- */
.exercises-grid.thumbnails-mode {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}

.exercises-grid.detail-mode {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.exercise-thumbnail {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 300px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.exercise-thumbnail:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.thumbnail-image-container {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 6px;
    padding: 6px;
}

.thumbnail-image-container img {
    flex: 1;
    min-width: 0;
    height: 100%;
    object-fit: contain;
    opacity: 0.85;
    transition: all 0.3s ease;
}

.exercise-thumbnail:hover .thumbnail-image-container img {
    opacity: 1;
    transform: scale(1.04);
}

.thumbnail-info {
    padding: 0.5rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    background: rgba(25, 18, 36, 0.4);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    text-align: center;
}

.thumbnail-info h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-img {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-cyan);
    background: rgba(0, 245, 212, 0.06);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    border-radius: 8px;
}

/* --- BOTÓN VOLVER (VISTA DETALLE) --- */
.btn-back {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    transform: translateX(-3px);
}

/* --- DASHBOARD UNIFICADO: SIDEBAR Y CONTENIDO --- */
body {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh;
    overflow: hidden !important;
}

.app-sidebar {
    width: 100%;
    height: auto;
    background: rgba(9, 6, 16, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    border-right: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.6rem 1.8rem;
    flex-shrink: 0;
    z-index: 10;
    gap: 0.4rem;
}

.nav-row-1 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.nav-row-1 .sidebar-logo {
    flex: 0 0 auto;
}

.nav-row-1 .sidebar-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 0.8rem;
    margin: 0 1rem;
}

.nav-row-1 .nav-item {
    flex: 1 1 140px;
    max-width: 220px;
    justify-content: center;
}

.nav-row-1 .sidebar-vault-panel {
    flex: 0 0 auto;
}

.nav-row-2 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
    padding-top: 0.2rem;
    flex-wrap: wrap;
}

.nav-row-2 .sidebar-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
}

.nav-row-2 .nav-item {
    flex: 1 1 180px;
    max-width: 320px;
    justify-content: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0;
}

.sidebar-logo .logo {
    font-size: 1.4rem;
    font-weight: 800;
}

.sidebar-logo .subtitle {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-top: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    flex-grow: 0;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    width: auto;
    outline: none;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    background: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Vault Connection Panel */
.sidebar-vault-panel {
    border-top: none;
    padding-top: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
}

.btn-connect-sidebar {
    background: rgba(124, 77, 255, 0.1);
    border: 1px solid rgba(124, 77, 255, 0.25);
    color: var(--text-highlight);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    width: auto;
    white-space: nowrap;
}

.btn-connect-sidebar:hover {
    background: rgba(124, 77, 255, 0.15);
    border-color: rgba(124, 77, 255, 0.4);
}

.vault-status-indicator {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
}

.vault-status-indicator.disconnected {
    color: #ff1744;
}

.vault-status-indicator.connected {
    color: #00e676;
}

/* Estilos Unificados para Barras de Herramientas y Botones en Tonos Grises (Slate Glass Panel) */
#active-center-header-bar,
#main-navigation-header-bar {
    background: rgba(20, 24, 35, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(12px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

.row3-btn-gray,
.btn-connect-sidebar {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #cbd5e1 !important;
    font-weight: 700 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    outline: none !important;
}

.row3-btn-gray:hover,
.btn-connect-sidebar:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.row3-btn-gray.btn-close-gray:hover {
    background: rgba(255, 23, 68, 0.2) !important;
    border-color: rgba(255, 23, 68, 0.5) !important;
    color: #ff5252 !important;
}

/* Identidades Visuales por Color para las 4 Herramientas Principales + NutriTerrones (Altura Uniforme 32px) */
.btn-tool-library {
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(0, 245, 212, 0.45) !important;
    background: rgba(0, 245, 212, 0.08) !important;
    color: #00f5d4 !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-tool-library:hover {
    background: rgba(0, 245, 212, 0.18) !important;
    border-color: #00f5d4 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.35) !important;
    transform: translateY(-1px) !important;
}
.btn-tool-library.active {
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.35), rgba(0, 245, 212, 0.18)) !important;
    border-color: #00f5d4 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(0, 245, 212, 0.5) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.btn-tool-health {
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(0, 230, 118, 0.45) !important;
    background: rgba(0, 230, 118, 0.08) !important;
    color: #00e676 !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-tool-health:hover {
    background: rgba(0, 230, 118, 0.18) !important;
    border-color: #00e676 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.35) !important;
    transform: translateY(-1px) !important;
}
.btn-tool-health.active {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.35), rgba(0, 230, 118, 0.18)) !important;
    border-color: #00e676 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(0, 230, 118, 0.5) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.btn-tool-ramp {
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(192, 132, 252, 0.45) !important;
    background: rgba(192, 132, 252, 0.08) !important;
    color: #c084fc !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-tool-ramp:hover {
    background: rgba(192, 132, 252, 0.18) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.35) !important;
    transform: translateY(-1px) !important;
}
.btn-tool-ramp.active {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.35), rgba(167, 139, 250, 0.2)) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(192, 132, 252, 0.5) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.btn-tool-season {
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(255, 215, 0, 0.45) !important;
    background: rgba(255, 215, 0, 0.08) !important;
    color: #ffd700 !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-tool-season:hover {
    background: rgba(255, 215, 0, 0.18) !important;
    border-color: #ffd700 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.35) !important;
    transform: translateY(-1px) !important;
}
.btn-tool-season.active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 215, 0, 0.18)) !important;
    border-color: #ffd700 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.5) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.btn-tool-nutri {
    height: 32px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(56, 189, 248, 0.45) !important;
    background: rgba(56, 189, 248, 0.08) !important;
    color: #38bdf8 !important;
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 0 0.75rem !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-tool-nutri:hover {
    background: rgba(56, 189, 248, 0.18) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
    transform: translateY(-1px) !important;
}
.btn-tool-nutri.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(56, 189, 248, 0.18)) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

/* MAIN CONTENT */
.main-content {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
    position: relative;
}

.tab-panel {
    display: none;
    height: 100%;
    width: 100%;
    overflow-y: auto;
}

.tab-panel.active {
    display: block;
}

#tab-temporadas {
    padding-bottom: 6.5rem !important;
}

#tab-portal-socio {
    padding-bottom: 12rem !important;
}

/* --- TAB 1: BIBLIOTECA PANELS --- */
.panel-inner-library {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100%;
    overflow: hidden;
}

.library-form-side {
    height: 100%;
    overflow-y: auto;
    padding: 2.2rem 1.8rem;
    border-right: 1px solid var(--card-border);
    background: rgba(22, 16, 32, 0.15);
    border-radius: 0;
    border-top: none;
    border-bottom: none;
}

.library-grid-side {
    height: 100%;
    overflow-y: auto;
    padding: 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn-submit-library {
    background: linear-gradient(135deg, var(--primary) 0%, #6236d6 100%);
    border: none;
    color: var(--text-main);
    padding: 0.8rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 1rem;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-submit-library:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 77, 255, 0.45);
}

/* --- TAB 2: SALUD PANELS --- */
.panel-inner-salud {
    height: 100%;
    overflow-y: auto;
    padding: 2.2rem 1.5rem 4rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    box-sizing: border-box;
}

.salud-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.5rem;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- TAB 3: RUTINAS PANELS --- */
.panel-inner-rutinas {
    display: grid;
    grid-template-columns: 440px 1fr 414px;
    height: 100%;
    overflow: hidden;
    transition: grid-template-columns 0.25s ease;
}

.panel-inner-rutinas.config-hidden {
    grid-template-columns: 0px 1fr 1fr;
}
.panel-inner-rutinas.config-hidden .rutinas-config-side {
    display: none !important;
}

.panel-inner-rutinas.catalog-hidden {
    grid-template-columns: 1fr 1fr 0px;
}
.panel-inner-rutinas.catalog-hidden .rutinas-catalog-side {
    display: none !important;
}

.panel-inner-rutinas.config-hidden.catalog-hidden {
    grid-template-columns: 0px 1fr 0px;
}

.rutinas-config-side {
    grid-column: 1;
    border-right: 1px solid var(--card-border);
    background: rgba(22, 16, 32, 0.15);
    padding: 1.8rem 1.5rem 6.5rem 1.5rem !important;
    height: 100%;
    overflow-y: auto;
}

.rutinas-constructor-side {
    grid-column: 2;
    padding: 1.8rem 2rem 6.5rem 2rem !important;
    height: 100%;
    overflow-y: auto;
}

.rutinas-catalog-side {
    grid-column: 3;
    border-left: 1px solid var(--card-border);
    background: rgba(22, 16, 32, 0.15);
    padding: 1.8rem 1.5rem 6.5rem 1.5rem !important;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.rutinas-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.5rem;
}

/* --- PLANIFICADOR AERÓBICO PROGRESIVO Y MODO AERÓBICO --- */
.planner-layout.aerobic-mode-active .panel-right,
.panel-inner-rutinas.aerobic-mode-active .rutinas-catalog-side {
    display: none !important;
}

.planner-layout.aerobic-mode-active .panel-center,
.panel-inner-rutinas.aerobic-mode-active .rutinas-constructor-side {
    flex: 2.3 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Estilos de botones de tipo de mesociclo */
.type-btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.type-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.04) !important;
    color: #fff !important;
}

/* Tabla Aeróbica */
.aerobic-table {
    border-radius: 8px;
    overflow: hidden;
}

.aerobic-table th {
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
}

.aerobic-table td, .aerobic-table th {
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.aerobic-table tbody tr {
    transition: background 0.15s ease;
}

.aerobic-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Ajustes de transiciones de los sliders */
#aerobic-config-container input[type="range"] {
    height: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.15s ease;
}

#aerobic-config-container input[type="range"]::-webkit-slider-thumb {
    transition: transform 0.1s ease;
}

#aerobic-config-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}


/* --- TAB 4: TEMPORADA DE CLIENTES --- */
#tab-temporadas {
    overflow-y: auto;
}

.season-client-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.season-client-row:hover {
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.03);
}

.season-client-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding-right: 1rem;
}

.season-client-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.season-client-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.season-client-meta strong {
    color: #fff;
}

.season-timeline-container {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.season-box {
    min-width: 95px;
    height: 75px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
}

.season-box.drag-over {
    border-color: var(--primary);
    background: rgba(147, 51, 234, 0.1);
    transform: scale(1.03);
}

.season-box.filled {
    border-style: solid;
    border-color: rgba(147, 51, 234, 0.3);
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.12), rgba(9, 6, 16, 0.6));
}

.season-box-num {
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    top: 4px;
    left: 6px;
}

.season-box-content {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
    margin-top: 10px;
}

.season-box-delete {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    display: none;
    transition: color 0.2s ease;
}

.season-box:hover .season-box-delete {
    display: block;
}

.season-box-delete:hover {
    color: #ff0055;
}

.btn-add-season-slot {
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 18px;
}

.btn-add-season-slot:hover {
    border-color: var(--primary);
    background: rgba(147, 51, 234, 0.1);
    color: #fff;
    transform: scale(1.05);
}

/* Season Meso QR & Web Link Elements */
.season-meso-qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 5px;
    width: 100%;
}

.season-meso-qr-box {
    width: 64px;
    height: 64px;
    background: #ffffff;
    padding: 3px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.season-meso-qr-box canvas,
.season-meso-qr-box img,
#meso-qr-code-large-target canvas,
#meso-qr-code-large-target img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.season-meso-qr-box:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(0, 245, 212, 0.4);
}

.season-meso-qr-actions {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.btn-meso-web-link {
    font-size: 0.58rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(0, 245, 212, 0.12);
    border: 1px solid rgba(0, 245, 212, 0.35);
    color: #00f5d4;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-meso-web-link:hover {
    background: rgba(0, 245, 212, 0.25);
    border-color: #00f5d4;
    transform: translateY(-1px);
}

.btn-meso-qr-modal {
    font-size: 0.58rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(124, 77, 255, 0.16);
    border: 1px solid rgba(124, 77, 255, 0.4);
    color: #c4b5fd;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-meso-qr-modal:hover {
    background: rgba(124, 77, 255, 0.3);
    border-color: #a78bfa;
    transform: translateY(-1px);
}

.btn-meso-pdf-mobile {
    font-size: 0.58rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-meso-pdf-mobile:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* --- CALENTAMIENTO RAMP / VUELTA A LA CALMA COLAPSABLE --- */
.ramp-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ramp-block {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ramp-block-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.ramp-block-title:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

.ramp-toggle-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 2px 7px;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: none;
}

.ramp-toggle-badge.active {
    color: #00f5d4;
    background: rgba(0, 245, 212, 0.15);
    border-color: rgba(0, 245, 212, 0.4);
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.2);
}

.ramp-block textarea {
    display: none;
    font-size: 0.8rem;
    line-height: 1.4;
    resize: vertical;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    padding: 0.6rem;
    margin-top: 0.3rem;
    animation: fadeInRampText 0.2s ease-out;
}

@keyframes fadeInRampText {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cuadrícula adaptativa para el Pool de Mesociclos y Carpetas */
.season-mesociclos-pool-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)) !important;
    gap: 0.9rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.5rem 0 !important;
    align-items: stretch !important;
}

.draggable-mesociclo-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 1.8rem 0.7rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    position: relative;
}

.draggable-mesociclo-card:hover {
    border-color: var(--primary);
    background: rgba(147, 51, 234, 0.1);
    transform: translateY(-2px);
}

.draggable-mesociclo-card:active {
    cursor: grabbing;
}

.draggable-mesociclo-card.drag-over-meso {
    border-color: #00e676 !important;
    background: rgba(0, 230, 118, 0.15) !important;
    transform: scale(1.03);
    box-shadow: 0 0 16px rgba(0, 230, 118, 0.4) !important;
}

/* Tarjeta de Carpeta de Mesociclos */
.mesociclo-folder-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.9rem;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.15) 0%, rgba(98, 0, 234, 0.08) 100%);
    border: 1.5px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(124, 77, 255, 0.2);
    position: relative;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.mesociclo-folder-card:hover {
    border-color: #a855f7;
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.25) 0%, rgba(98, 0, 234, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.3);
}

.mesociclo-folder-card.drag-over-folder {
    border-color: #00e676 !important;
    background: rgba(0, 230, 118, 0.2) !important;
    transform: scale(1.03);
    box-shadow: 0 0 16px rgba(0, 230, 118, 0.4) !important;
}

/* Tarjeta de Carpeta Maestra de Entrenador (Fila Superior Cian / Azul Pizarra Mate) */
.master-trainer-folder-card {
    padding: 0.8rem 0.95rem !important;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(30, 41, 59, 0.35) 100%) !important;
    border: 1px solid rgba(56, 189, 248, 0.28) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

.master-trainer-folder-card:hover {
    border-color: rgba(56, 189, 248, 0.5) !important;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.14) 0%, rgba(30, 41, 59, 0.45) 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.12) !important;
}

/* Bandeja desplegable de carpeta ocupando toda la fila de la cuadrícula */
.folder-inline-tray {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    box-shadow: 0 3px 12px rgba(168, 85, 247, 0.12);
    width: 100%;
    box-sizing: border-box;
}

/* Cruz de eliminación en la esquina superior derecha (Estilo unificado) */
.card-delete-cross {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 23, 68, 0.15);
    color: #ff1744;
    border: 1px solid rgba(255, 23, 68, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 10;
}

.card-delete-cross:hover {
    background: #ff1744;
    color: #ffffff;
    border-color: #ff1744;
    transform: scale(1.15);
}

.season-client-card {
    position: relative;
}

.season-box.alert-orange {
    border-color: #ff9100 !important;
    border-style: solid !important;
    box-shadow: 0 0 12px rgba(255, 145, 0, 0.4) !important;
}

.season-box.alert-red {
    border-color: #ff1744 !important;
    border-style: solid !important;
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.5) !important;
}

/* --- ESTILOS ENTRENADOR PRINCIPAL (HEAD COACH) Y ANALÍTICAS --- */
.head-coach-dashboard {
    background: rgba(124, 77, 255, 0.03);
    border: 1px solid rgba(124, 77, 255, 0.2);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 35px rgba(0,0,0,0.3);
}

.head-coach-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(124, 77, 255, 0.2);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.head-coach-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.head-coach-title span {
    background: linear-gradient(135deg, #7c4dff, #00f5d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.head-coach-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.8rem;
}

.head-coach-kpi-card {
    background: rgba(9, 6, 16, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: all 0.2s ease;
}

.head-coach-kpi-card:hover {
    border-color: rgba(124, 77, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.15);
}

.head-coach-kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.head-coach-kpi-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
}

.head-coach-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.head-coach-chart-card {
    background: rgba(9, 6, 16, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.head-coach-chart-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #00f5d4;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* OVERLAY ATAJO SECRETO 20s */
#head-coach-shortcut-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 7, 12, 0.92);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.shortcut-progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcut-progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.shortcut-progress-circle circle.bg {
    stroke: rgba(255,255,255,0.1);
    stroke-width: 8;
    fill: none;
}

.shortcut-progress-circle circle.meter {
    stroke: #7c4dff;
    stroke-width: 8;
    stroke-linecap: round;
    fill: none;
    transition: stroke-dashoffset 0.5s linear;
}

.shortcut-countdown-text {
    position: absolute;
    font-size: 2.2rem;
    font-weight: 800;
    color: #00f5d4;
}

/* MODALES DE CONTRASEÑA */
.head-coach-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 99995;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.head-coach-modal-content {
    background: #0d0918;
    border: 1.5.px solid #7c4dff;
    border-radius: 14px;
    padding: 1.8rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 15px 40px rgba(124, 77, 255, 0.25);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: modalPopIn 0.25s ease-out;
}

/* ==========================================================================
   ESTILOS PARA LA VISTA MÓVIL RAMP AISLADA (EDITORIAL SWISS MINIMALIST)
   ========================================================================== */

/* Contenedor Marco de Teléfono Inteligente */
.mobile-phone-frame {
    width: 100%;
    max-width: 410px;
    height: 85vh;
    max-height: 780px;
    background: #0c0c0f;
    border: 3px solid #1c1c22;
    border-radius: 40px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 40px rgba(16, 185, 129, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    color: #f4f4f5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Outfit', sans-serif;
    box-sizing: border-box;
}

@media (max-width: 500px) {
    #mobile-isolated-session-modal {
        padding: 0 !important;
    }
    .mobile-phone-frame {
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }
}

/* Notch y Muesca Superior del Teléfono */
.mobile-phone-top-bar {
    width: 100%;
    height: 24px;
    background: #0c0c0f;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

.mobile-phone-notch {
    width: 110px;
    height: 14px;
    background: #141418;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: none;
}

/* Viewport Interno de la Pantalla del Teléfono */
.mobile-phone-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #0c0c0f;
    color: #f4f4f5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Outfit', sans-serif;
}

/* Cabecera Interna de la App del Teléfono */
.mobile-phone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.95rem;
    background: #141418;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.mobile-nav-btn {
    background: #1f1f26;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #10b981;
    padding: 0.28rem 0.65rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    font-family: inherit;
}

.mobile-nav-btn:hover {
    background: #272732;
    color: #34d399;
}

.mobile-phone-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    flex: 1;
    padding: 0 6px;
}

.mobile-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #a1a1aa;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* Cuerpo de Pantalla */
.mobile-phone-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.mobile-screen-view {
    display: none;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
}

.mobile-screen-view.active {
    display: flex;
    animation: mobileScreenFade 0.2s ease-out;
}

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

/* Barra de Inicio (Home Bar Bottom) */
.mobile-phone-home-bar {
    height: 16px;
    background: #0c0c0f;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.mobile-phone-home-bar::after {
    content: '';
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
}

/* Tarjeta de Sesión en la Lista (Pantalla 1) */
.mobile-session-card {
    background: #141418;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    cursor: pointer;
    transition: all 0.22s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.mobile-session-card:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.15);
}

/* Sesión completada (Aspecto Blanco y Negro / Escala de Grises) */
.mobile-session-card.completed-grayscale {
    filter: grayscale(1) opacity(0.55);
    border-color: rgba(255, 255, 255, 0.08) !important;
    background: #141418 !important;
    box-shadow: none !important;
}

.mobile-session-card.completed-grayscale:hover {
    filter: grayscale(0.4) opacity(0.85);
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.mobile-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.mobile-session-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin: 2px 0;
}

.mobile-session-explanation {
    font-size: 0.74rem;
    color: #71717a;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
}

.mobile-session-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: #71717a;
    font-weight: 600;
    margin-top: 4px;
}

/* Tarjeta de Ejercicio Aislado (Pantalla 2) */
.mobile-exercise-card {
    background: #141418;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.mobile-exercise-thumb-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    background: #1b1b22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.mobile-exercise-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.mobile-thumb-press-hint {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(12, 12, 15, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    font-size: 0.63rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

/* Rejilla de Métricas del Ejercicio (Series, Reps, Peso, Descanso) */
.mobile-exercise-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.mobile-metric-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 0.4rem 0.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.mobile-metric-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #71717a;
    text-transform: uppercase;
}

.mobile-metric-val {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    margin-top: 2px;
}

.mobile-metric-val.rest-highlight {
    color: #10b981;
}

/* Bloque Aeróbico (Inicial / Final) */
.mobile-aerobic-box {
    background: #141418;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    color: #e4e4e7;
}

.mobile-aerobic-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #e4e4e7;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

/* Overlay de Cuenta Regresiva de Descanso */
.mobile-timer-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 12, 15, 0.95);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    box-sizing: border-box;
    animation: fadeInRampText 0.2s ease-out;
}

.mobile-timer-card {
    background: #141418;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 1.2rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    position: relative;
}

.timer-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.timer-exercise-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    margin-top: 0.4rem;
    padding: 0 1rem;
    line-height: 1.25;
}

.timer-subtitle {
    font-size: 0.72rem;
    color: #10b981;
    font-weight: 700;
    text-transform: uppercase;
}

.timer-ring-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-bg-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 8;
}

.timer-progress-circle {
    fill: none;
    stroke: #10b981;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s linear;
}

.timer-countdown-display {
    position: absolute;
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    font-family: monospace;
    letter-spacing: 1px;
}

.timer-controls-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    justify-content: center;
}

.btn-timer-adj {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
}

.btn-timer-main {
    background: #10b981;
    border: none;
    color: #041f14;
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

/* Scrollbar personalizado para el carrusel de mesociclos en el Área de Socio */
.socio-mesociclos-scroll-slider::-webkit-scrollbar {
    height: 9px;
}

.socio-mesociclos-scroll-slider::-webkit-scrollbar-track {
    background: rgba(18, 12, 34, 0.7);
    border-radius: 10px;
    border: 1px solid rgba(124, 77, 255, 0.2);
}

.socio-mesociclos-scroll-slider::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #7c4dff, #00f5d4);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}

.socio-mesociclos-scroll-slider::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #00f5d4, #7c4dff);
}

/* ==========================================================================
   ESTILOS PARA EL MÓDULO DE COMUNICACIÓN Y CONSULTAS CLIENTE - ENTRENADOR
   ========================================================================== */

/* Barra de Consultas en la Cabecera */
.user-queries-header-bar {
    background: linear-gradient(135deg, rgba(18, 12, 34, 0.95), rgba(9, 6, 16, 0.98));
    border: 1.5px solid rgba(0, 245, 212, 0.4);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    animation: fadeInRampText 0.3s ease-out;
}

.queries-cards-scroll-container {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding: 0.3rem 0.2rem 0.8rem 0.2rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #00f5d4 rgba(124, 77, 255, 0.25);
}

.query-header-card {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 290px;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(124, 77, 255, 0.4);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.65rem;
    transition: all 0.22s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.query-header-card.pending {
    border-color: #ff9100;
    background: linear-gradient(135deg, rgba(255, 145, 0, 0.12), rgba(255, 23, 68, 0.08));
    box-shadow: 0 4px 18px rgba(255, 145, 0, 0.25);
}

.query-header-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 245, 212, 0.25);
}

/* Carpeta de Comunicación en Ficha de Socio */
.btn-client-comm-folder {
    width: 100%;
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid rgba(0, 245, 212, 0.3);
    color: #e2e8f0;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    margin-top: 0.5rem;
}

.btn-client-comm-folder:hover {
    background: rgba(0, 245, 212, 0.16);
    border-color: #00f5d4;
    color: #fff;
    transform: translateY(-1px);
}

.btn-client-comm-folder.has-pending {
    background: linear-gradient(135deg, rgba(255, 145, 0, 0.25), rgba(255, 23, 68, 0.2)) !important;
    border: 1.5px solid #ff9100 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(255, 145, 0, 0.45) !important;
    animation: pulseCommGlow 2s infinite alternate;
}

@keyframes pulseCommGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 145, 0, 0.4);
        border-color: #ff9100;
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 23, 68, 0.7);
        border-color: #ff1744;
    }
}

/* Burbujas de Chat para Comunicaciones */
.comm-message-bubble {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.84rem;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.comm-message-bubble.client {
    background: rgba(124, 77, 255, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #f3e8ff;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.comm-message-bubble.trainer {
    background: rgba(0, 245, 212, 0.15);
    border: 1px solid rgba(0, 245, 212, 0.35);
    color: #e0f2fe;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.comm-message-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* ==================== SUPERADMIN SAAS MOBILE RESPONSIVE ==================== */
@media (max-width: 768px) {
    /* Reduce tab panel outer padding on mobile */
    #tab-saas-superadmin {
        padding: 0.75rem 0.4rem !important;
    }

    #saas-auth-gate > div {
        padding: 1.4rem 1rem !important;
    }

    /* Subtab buttons bar layout on mobile */
    .saas-header-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.8rem !important;
    }

    .saas-subtab-bar {
        display: flex !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 4px !important;
        width: 100% !important;
        gap: 0.35rem !important;
        flex-wrap: nowrap !important;
    }

    .saas-subtab-bar button {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-size: 0.74rem !important;
        padding: 0.45rem 0.65rem !important;
    }

    /* KPI Grid on Mobile */
    .saas-kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        margin-bottom: 1.2rem !important;
    }

    .saas-kpi-card {
        padding: 0.7rem 0.6rem !important;
    }

    .saas-kpi-val {
        font-size: 1.25rem !important;
    }

    /* Control Bar & Search Inputs on Mobile */
    .saas-control-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0.8rem 0.7rem !important;
        gap: 0.8rem !important;
    }

    .saas-control-inputs {
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        gap: 0.5rem !important;
    }

    .saas-control-inputs input,
    .saas-control-inputs select {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .saas-control-btns {
        width: 100% !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .saas-control-btns button {
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    /* Table Container - Allow Full Horizontal Scroll on Mobile */
    .saas-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        border-radius: 12px !important;
        border: 1px solid rgba(124, 77, 255, 0.25) !important;
        box-sizing: border-box !important;
    }

    .saas-table-container table {
        min-width: 720px !important;
    }

    .saas-mobile-scroll-hint {
        display: flex !important;
    }

    /* Modal dialogs responsiveness on mobile */
    .saas-modal-dialog {
        width: 96% !important;
        max-height: 92vh !important;
        padding: 1.1rem 0.75rem !important;
    }

    .saas-modal-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 0.6rem !important;
    }

    .saas-grid-2col {
        grid-template-columns: 1fr !important;
    }
}




/* ═══════════════════════════════════════
   DESIGN SYSTEM 2.0 ADDITIONS
═══════════════════════════════════════ */

/* Entrance animation */
@keyframes enterUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: none; }
}

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

/* Staggered card entrance in exercise grid */
.exercises-grid .exercise-card:nth-child(1)  { animation-delay: 0.04s; }
.exercises-grid .exercise-card:nth-child(2)  { animation-delay: 0.08s; }
.exercises-grid .exercise-card:nth-child(3)  { animation-delay: 0.12s; }
.exercises-grid .exercise-card:nth-child(4)  { animation-delay: 0.16s; }
.exercises-grid .exercise-card:nth-child(5)  { animation-delay: 0.20s; }
.exercises-grid .exercise-card:nth-child(6)  { animation-delay: 0.24s; }
.exercises-grid .exercise-card:nth-child(7)  { animation-delay: 0.28s; }
.exercises-grid .exercise-card:nth-child(8)  { animation-delay: 0.32s; }
.exercises-grid .exercise-card:nth-child(9)  { animation-delay: 0.36s; }
.exercises-grid .exercise-card:nth-child(10) { animation-delay: 0.40s; }
.exercises-grid .exercise-card:nth-child(11) { animation-delay: 0.44s; }
.exercises-grid .exercise-card:nth-child(12) { animation-delay: 0.48s; }

/* Better inputs */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--cyan) !important;
    box-shadow: 0 0 0 3px var(--cyan-dim), 0 0 14px rgba(0, 245, 212, 0.10) !important;
    background: rgba(0, 245, 212, 0.025) !important;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(124, 77, 255, 0.35);
    border-radius: var(--r-pill);
    transition: background var(--t-fast);
}
::-webkit-scrollbar-thumb:hover { background: var(--violet); }

/* Toast redesign */
.toast {
    background: rgba(12, 10, 22, 0.92);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--violet);
    border-radius: 0 var(--r-md) var(--r-md) 0;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: toastSlide var(--t-spring) both;
}
.toast.success { border-left-color: var(--lvl-easy); }
.toast.error   { border-left-color: var(--lvl-hard); }
.toast.info    { border-left-color: var(--cyan); }
.toast.warning { border-left-color: var(--lvl-medium); }

@keyframes toastSlide {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

/* Filter buttons pill style */
.filter-btn.active {
    background: linear-gradient(135deg, var(--violet), rgba(124, 77, 255, 0.7));
    color: #fff;
    box-shadow: 0 2px 12px var(--violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: var(--r-pill);
}

.filter-btn {
    border-radius: var(--r-pill);
    padding: 0.5rem 1.1rem;
    font-weight: 600;
    font-size: 0.83rem;
    letter-spacing: 0.01em;
}

/* Buttons elevation */
.btn-primary {
    background: linear-gradient(135deg, var(--violet) 0%, #5c34cc 100%);
    box-shadow: 0 4px 16px var(--violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: var(--r-md);
    letter-spacing: 0.02em;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--violet) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--violet-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Header ambient line */
.app-header {
    background: rgba(8, 6, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-sm);
}

/* Badge refinements */
.badge {
    border-radius: var(--r-pill);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.65rem;
}

/* Tab active underline gradient */
.tab-btn.active::after {
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    height: 2px;
    box-shadow: 0 0 8px var(--cyan-glow);
    border-radius: var(--r-pill);
}

/* Ambient glow circles — more refined */
.circle-1 {
    opacity: 0.10;
    filter: blur(140px);
    background: var(--violet);
}
.circle-2 {
    opacity: 0.07;
    filter: blur(160px);
    background: var(--cyan);
}

/* Vault status pill */
.vault-status {
    border-radius: var(--r-pill);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
}

/* Search box refinement */
.search-box input {
    border-radius: var(--r-pill);
    padding-left: 2.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-default);
}

/* Section titles gradient */
.library-header h2, .form-section h2 {
    background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    letter-spacing: -0.03em;
}

/* ═══════════════════════════════════════════════════════════════════
   CABECERA SUPERIOR: OCULTA POR DEFECTO
   Solo visible cuando se haya entrado/iniciado sesión como:
   1. Gimnasio / Franquicia / Entrenador Personal
   2. Entrenador / Monitor Responsable
   3. SuperAdmin SaaS / Administración
═══════════════════════════════════════════════════════════════════ */
.app-sidebar,
aside.app-sidebar,
#main-navigation-header-bar {
    display: none !important;
}

body.staff-auth-active .app-sidebar,
body.staff-auth-active aside.app-sidebar {
    display: flex !important;
}

body.staff-auth-active #main-navigation-header-bar {
    display: flex !important;
}

/* Pestaña NutriTerrones: oculta por defecto en todas las barras de navegación,
   únicamente visible para usuarios/centros que la tengan contratada */
.nav-item[data-target="tab-nutriterrones"],
.btn-tool-nutri {
    display: none !important;
}

body.nutriterrones-enabled .nav-item[data-target="tab-nutriterrones"],
body.nutriterrones-enabled .btn-tool-nutri {
    display: inline-flex !important;
}

/* ═══════════════════════════════════════════════════════════════════
   MODO EXCLUSIVO NATIVO SOCIO / QR - CERO MENUS ADMINISTRATIVOS
═══════════════════════════════════════════════════════════════════ */
body.socio-portal-active {
    overflow-y: auto !important;
    height: 100% !important;
    min-height: 100vh !important;
}

body.socio-portal-active .app-sidebar,
body.socio-portal-active aside.app-sidebar,
body.socio-portal-active .nav-row-1,
body.socio-portal-active .nav-row-2,
body.socio-portal-active #main-navigation-header-bar,
body.socio-portal-active .btn-portal-socio {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.socio-portal-active .main-content {
    flex: 1 1 100vh !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.socio-portal-active #tab-portal-socio {
    padding: 0.8rem 0.8rem 12rem 0.8rem !important;
    min-height: 100vh !important;
    height: auto !important;
    overflow-y: visible !important;
    box-sizing: border-box !important;
}

body.socio-portal-active #ios18-bottom-dock {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999999 !important;
}
