/* -------------------------------------------------------------
   SYSTEMA DE DISEÑO PHYSIOFLOW - TECH-MEDICAL NEO-DARK AESTHETICS
   ------------------------------------------------------------- */

:root {
    /* Colors (HSL) */
    --bg-base: #060913;
    --bg-surface: #0e1424;
    --bg-card: rgba(20, 28, 48, 0.45);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-glow: rgba(0, 242, 254, 0.25);
    
    --primary: #00F2FE;
    --primary-rgb: 0, 242, 254;
    --primary-hover: #4FACFE;
    
    --accent: #8B5CF6;
    --accent-rgb: 139, 92, 246;
    
    --success: #10B981;
    --success-rgb: 16, 185, 129;
    
    --warning: #F59E0B;
    --warning-rgb: 245, 158, 11;
    
    --danger: #EF4444;
    --danger-rgb: 239, 68, 68;
    
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --text-bright: #FFFFFF;

    /* Shadows & Transitions */
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.15);
    --shadow-glow-strong: 0 0 30px rgba(0, 242, 254, 0.35);
    --shadow-glow-accent: 0 0 20px rgba(139, 92, 246, 0.2);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bouncy: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 45%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-bright);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(14, 20, 36, 0.7);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-logo {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-name .highlight {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

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

.nav-item.active {
    color: var(--primary);
    background: rgba(0, 242, 254, 0.07);
    border-color: rgba(0, 242, 254, 0.15);
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.05);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.patient-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #000;
    box-shadow: var(--shadow-glow);
}

.profile-info .name {
    font-weight: 600;
    color: var(--text-bright);
}

.profile-info .role {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

/* Main Content area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

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

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: rgba(255, 255, 255, 0.05);
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    opacity: 0.6;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse-green 2s infinite;
}

.status-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--success);
}

/* Sections */
.app-section {
    display: none;
    animation: fade-in-slide 0.5s ease forwards;
}

.app-section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    border-color: var(--border-color-glow);
    box-shadow: 0 10px 40px 0 rgba(0, 242, 254, 0.05), var(--shadow-card);
}

/* Utilities */
.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }

.w-100 { width: 100%; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* Buttons */
.btn {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #060913;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-strong);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: var(--text-bright);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-accent);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--text-muted);
}

.btn-tab {
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-tab.active {
    background: rgba(0, 242, 254, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.btn-glow {
    position: relative;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    box-shadow: 0 0 15px var(--primary);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: -1;
}

.btn-glow:hover::after {
    opacity: 0.6;
}

/* -------------------------------------------------------------
   MODULE 1: BODY MAPPER
   ------------------------------------------------------------- */
.body-mapper-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: start;
}

.mapper-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 520px;
}

.view-controls {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.anatomical-container {
    width: 100%;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Human SVG styles */
.human-svg {
    height: 100%;
    width: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.human-body-outline {
    fill: #151d30;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 1.2;
    transition: var(--transition-smooth);
}

.human-bone-line {
    stroke: rgba(255,255,255,0.03);
    stroke-width: 1;
}

/* Joint hotspots */
.joint-hotspot {
    fill: rgba(0, 242, 254, 0.15);
    stroke: var(--primary);
    stroke-width: 1.5;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.joint-hotspot:hover {
    fill: rgba(239, 68, 68, 0.3);
    stroke: var(--danger);
    filter: drop-shadow(0 0 6px var(--danger));
    r: 9;
}

.joint-hotspot.active {
    fill: rgba(239, 68, 68, 0.5);
    stroke: var(--danger);
    filter: drop-shadow(0 0 12px var(--danger));
    r: 9;
}

/* Detail pathology card */
.detail-card {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-auto: auto;
    padding: 3rem 1rem;
    flex-grow: 1;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.3));
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 280px;
}

/* Pathology detail styles */
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fade-in 0.4s ease forwards;
}

.joint-badge {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

.pathology-title {
    font-size: 1.6rem;
    line-height: 1.25;
}

.pathology-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.mini-metric {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}

.mini-metric .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mini-metric .value {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-top: 0.25rem;
}

.treatment-section h4 {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.treatment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.treatment-list li {
    position: relative;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.treatment-list li::before {
    content: '⚡';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-size: 0.85rem;
}

.actions-row {
    margin-top: 1.5rem;
}

.actions-row button {
    width: 100%;
}

/* -------------------------------------------------------------
   MODULE 2: ROUTINE TIMER
   ------------------------------------------------------------- */
.routine-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 1.5rem;
}

.routine-selector-card {
    min-height: 520px;
}

.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.exercise-list::-webkit-scrollbar,
.time-slots-grid::-webkit-scrollbar {
    width: 6px;
}

.exercise-list::-webkit-scrollbar-thumb,
.time-slots-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.exercise-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.exercise-item:hover {
    border-color: rgba(0, 242, 254, 0.2);
    background: rgba(0, 242, 254, 0.02);
}

.exercise-item.active {
    background: rgba(0, 242, 254, 0.05);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.05);
}

.ex-status {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.exercise-item.completed .ex-status {
    background-color: var(--success);
    border-color: var(--success);
    color: #000;
}

.ex-details {
    flex-grow: 1;
}

.ex-details h4 {
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.ex-details .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.player-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 450px;
}

/* Player Screen */
.player-content {
    animation: fade-in 0.4s ease forwards;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.ex-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sets-counter {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.player-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
    min-height: 220px;
}

/* Breath Visualizer Styles */
.breath-visualizer-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.breath-circle {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(6, 9, 19, 0.7) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.1);
    transition: width 4s ease-in-out, height 4s ease-in-out;
}

/* Breathing phases */
.breath-circle.inhale {
    transform: scale(1.22);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.45) 0%, rgba(6, 9, 19, 0.7) 100%);
    border-color: rgba(0, 242, 254, 0.5);
    box-shadow: var(--shadow-glow);
}

.breath-circle.hold {
    transform: scale(1.22);
    background: radial-gradient(circle, rgba(16, 185, 129, 0.45) 0%, rgba(6, 9, 19, 0.7) 100%);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.35);
}

.breath-circle.exhale {
    transform: scale(0.9);
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(6, 9, 19, 0.7) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

.breath-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 242, 254, 0.3);
    animation: circular-grow 2s infinite linear;
    pointer-events: none;
    opacity: 0;
}

.breath-circle.inhale .breath-pulse-ring {
    opacity: 1;
}

.breath-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.timer-countdown {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-bright);
    letter-spacing: -1px;
}

.breath-instruction {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 0.25rem;
    transition: var(--transition-smooth);
}

.breath-circle.inhale .breath-instruction { color: var(--primary); }
.breath-circle.hold .breath-instruction { color: var(--success); }
.breath-circle.exhale .breath-instruction { color: var(--accent); }

/* SVG Exercise Animation */
.exercise-animation-container {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.01);
    border-radius: 15px;
    border: 1px dashed var(--border-color);
}

/* Footer progress */
.progress-container {
    margin-bottom: 1.5rem;
}

.progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    transition: var(--transition-smooth);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* -------------------------------------------------------------
   MODULE 3: DASHBOARD
   ------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
}

.full-width {
    grid-column: span 2;
}

/* Pain slider */
.pain-emoji-container {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.pain-emoji {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.3));
    transition: var(--transition-smooth);
}

.pain-slider-wrapper {
    margin: 1.5rem 0;
}

.pain-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 10px;
    outline: none;
    transition: background 0.3s;
    background: linear-gradient(to right, var(--success) 0%, var(--warning) 50%, var(--danger) 100%);
}

.pain-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--text-bright);
    border: 3px solid #060913;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    transition: transform 0.1s;
}

.pain-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pain-status-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.pain-status-box.pain-0-2 { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.02); }
.pain-status-box.pain-3-5 { border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.02); }
.pain-status-box.pain-6-8 { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.02); }
.pain-status-box.pain-9-10 { border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.05); }

.pain-status-box .pain-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.pain-status-box .pain-label {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
}

.pain-status-box p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ROM metrics */
.rom-card {
    display: flex;
    flex-direction: column;
}

.rom-charts-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-grow: 1;
    gap: 1.5rem;
    padding: 1rem 0;
}

.rom-circular-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
}

.circular-svg {
    width: 100%;
    max-height: 110px;
}

.circle-bg {
    fill: none;
    stroke: rgba(255,255,255,0.03);
    stroke-width: 2.8;
}

.circle-fill {
    fill: none;
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary));
    transition: var(--transition-smooth);
}

.circle-fill.accent {
    stroke: var(--accent);
    filter: drop-shadow(0 0 6px var(--accent));
}

.circle-percentage {
    fill: var(--text-bright);
    font-family: 'Outfit', sans-serif;
    font-size: 7px;
    font-weight: 700;
    text-anchor: middle;
}

.rom-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.85rem;
    text-align: center;
    color: var(--text-bright);
}

.rom-sublabel {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* History Chart */
.chart-container {
    width: 100%;
    height: 260px;
    margin-top: 1rem;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-axis-line {
    stroke: rgba(255,255,255,0.08);
    stroke-width: 1;
}

.chart-grid-line {
    stroke: rgba(255,255,255,0.03);
    stroke-width: 1;
    stroke-dasharray: 4, 4;
}

.chart-line-pain {
    fill: none;
    stroke: var(--danger);
    stroke-width: 3;
    stroke-linecap: round;
    filter: drop-shadow(0 3px 8px rgba(239, 68, 68, 0.4));
}

.chart-area-pain {
    fill: url(#pain-area-grad);
}

.chart-line-compliance {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 4 2;
}

.chart-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.chart-dot {
    fill: #060913;
    stroke-width: 3;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.chart-dot:hover {
    r: 6;
}

.chart-dot.pain-dot { stroke: var(--danger); }
.chart-dot.comp-dot { stroke: var(--primary); }

/* -------------------------------------------------------------
   MODULE 4: BOOKING / SCHEDULER
   ------------------------------------------------------------- */
.scheduler-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.5rem;
    align-items: start;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: 0.5px;
}

.services-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.service-chip {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.service-chip:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
}

.service-chip.active {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.06);
    color: #a78bfa;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.05);
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.form-control option {
    background-color: var(--bg-surface);
    color: var(--text-main);
}

/* Micro Calendar */
.calendar-micro {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
}

.cal-day-header {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.cal-day.empty {
    cursor: default;
    opacity: 0.25;
}

.cal-day:not(.empty):hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.cal-day.active {
    background: var(--primary);
    color: #060913;
    box-shadow: var(--shadow-glow);
}

.cal-day.unavailable {
    opacity: 0.35;
    text-decoration: line-through;
    cursor: not-allowed;
}

/* Time Slots */
.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 125px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.time-slot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.time-slot:hover {
    border-color: var(--primary-hover);
    background: rgba(0, 242, 254, 0.02);
}

.time-slot.active {
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

/* Hologram Ticket Card */
.ticket-card {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.ticket-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-grow: 1;
    color: var(--text-muted);
}

.ticket-outline {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 1rem;
}

.ticket-container {
    animation: fade-in 0.5s ease forwards;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Cyber Hologram Ticket Styling */
.ticket {
    background: linear-gradient(135deg, rgba(20, 28, 48, 0.85) 0%, rgba(30, 41, 59, 0.85) 100%);
    border: 1px solid rgba(0, 242, 254, 0.25);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 10px 40px 0 rgba(0, 242, 254, 0.15);
    overflow: hidden;
}

.ticket::before, .ticket::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--bg-base);
    border-radius: 50%;
    top: 65%;
    z-index: 5;
    border: 1px solid rgba(0, 242, 254, 0.25);
}

.ticket::before {
    left: -10px;
}

.ticket::after {
    right: -10px;
}

.ticket-glow {
    position: absolute;
    top: -20%; left: -20%; right: -20%; bottom: -20%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(0, 242, 254, 0.25);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.ticket-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.ticket-badge {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 1px;
}

.ticket-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
}

.ticket-col {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ticket-col .lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.ticket-col .val {
    font-size: 0.9rem;
    color: var(--text-bright);
    font-weight: 600;
    margin-top: 0.15rem;
}

.ticket-barcodes {
    border-top: 1px dashed rgba(0, 242, 254, 0.25);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.barcode {
    flex-grow: 1;
    margin-right: 2rem;
}

.bar-lines {
    height: 38px;
    background: repeating-linear-gradient(90deg, 
        var(--primary), 
        var(--primary) 2px, 
        transparent 2px, 
        transparent 5px, 
        var(--primary) 5px, 
        var(--primary) 8px, 
        transparent 8px, 
        transparent 9px, 
        var(--primary) 9px, 
        var(--primary) 10px,
        transparent 10px,
        transparent 13px
    );
    opacity: 0.6;
}

.ticket-dots {
    width: 40px;
    height: 40px;
    background-image: radial-gradient(circle, var(--accent) 30%, transparent 35%);
    background-size: 8px 8px;
    opacity: 0.5;
}

/* -------------------------------------------------------------
   MODULE 5: EMG BIOFEEDBACK
   ------------------------------------------------------------- */
.biofeedback-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

/* EMG screen wrapper */
.emg-panel-card {
    display: flex;
    flex-direction: column;
}

.emg-screen-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #02050B;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    height: 280px;
    margin-bottom: 1.5rem;
}

#emg-oscilloscope {
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
    position: relative;
}

.emg-grid-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 2;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 20px 20px;
}

.emg-target-zone-indicator {
    position: absolute;
    left: 0; right: 0;
    top: 98px; /* 35% de alto, inyectado por JS */
    height: 84px; /* 30% de alto, inyectado por JS */
    background: rgba(139, 92, 246, 0.08);
    border-top: 1px dashed rgba(139, 92, 246, 0.4);
    border-bottom: 1px dashed rgba(139, 92, 246, 0.4);
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1.5rem;
}

.emg-target-zone-indicator span {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
    background-color: #02050B;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.emg-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.emg-instructions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.key-cap {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-bottom-width: 3px;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 700;
    color: var(--text-bright);
}

/* Stats EMG side panel */
.emg-stats-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.emg-status-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: var(--transition-smooth);
}

.emg-status-indicator.target-match {
    background-color: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.3);
}

.emg-status-indicator.fatigue {
    background-color: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.3);
}

.indicator-icon {
    font-size: 2rem;
}

.indicator-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.indicator-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.gauge-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-bright);
}

.gauge-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 0.25rem;
}

.emg-gamification h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.emg-gamification p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.score-card {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 1rem;
}

.score-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item:first-child {
    border-right: 1px solid var(--border-color);
}

.score-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.score-item .val {
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.15rem;
}

/* -------------------------------------------------------------
   RESPONSIVE DESIGN (Adaptive Layouts)
   ------------------------------------------------------------- */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100vw;
        height: auto;
        position: relative;
        padding: 1.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .brand {
        margin-bottom: 0;
    }
    
    .nav-menu {
        flex-direction: row;
        gap: 0.25rem;
        flex-grow: 0;
    }
    
    .nav-item {
        padding: 0.65rem 0.85rem;
        font-size: 0.8rem;
        gap: 0.5rem;
    }
    
    .nav-item span {
        display: none; /* Iconos solamente en tablets */
    }
    
    .patient-profile {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .body-mapper-grid,
    .routine-grid,
    .dashboard-grid,
    .scheduler-grid,
    .biofeedback-grid {
        grid-template-columns: 1fr;
    }
    
    .full-width {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        padding: 1rem;
        position: fixed;
        bottom: 0;
        top: auto;
        border-bottom: none;
        border-top: 1px solid var(--border-color);
        background: rgba(14, 20, 36, 0.92);
        z-index: 1000;
        width: 100%;
        justify-content: center;
    }
    
    .brand {
        display: none;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-item span {
        display: none;
    }
    
    .main-content {
        padding-bottom: 6rem; /* Deja espacio para el menu inferior */
    }
    
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .player-body {
        grid-template-columns: 1fr;
    }
    
    .rom-charts-container {
        flex-direction: column;
    }
    
    .services-selector-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------
   KEYFRAMES ANIMATIONS
   ------------------------------------------------------------- */
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes fade-in-slide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes circular-grow {
    from {
        transform: scale(0.9);
        opacity: 0.8;
    }
    to {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* -------------------------------------------------------------
   CRM, AUTH PORTAL & GOOGLE CALENDAR EXTRA STYLES
   ------------------------------------------------------------- */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: radial-gradient(circle at 50% 50%, rgba(14, 20, 36, 0.96) 0%, rgba(6, 9, 19, 0.99) 100%);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.auth-toggle-text a:hover {
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

/* CRM Console Styles */
.crm-table {
    margin-top: 1rem;
}

.crm-table th {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-muted);
}

.crm-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: var(--transition-smooth);
}

.crm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(0,242,254,0.1);
}

.crm-patient-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem;
}

.crm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #000;
}

.badge-pain {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-pain.pain-low { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-pain.pain-med { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-pain.pain-high { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: var(--danger); }

.badge-count {
    display: inline-block;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Sidebar Nav elements adjust */
.nav-item.hidden {
    display: none !important;
}

.nav-item:not(.hidden) {
    display: flex;
}

/* Google Calendar Button */
#btn-google-calendar {
    transition: var(--transition-smooth);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.2);
}

#btn-google-calendar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
    background: #357ae8 !important;
}

