/* ═══════════════════════════════════════════════════════════════
   CogniaData — Estilos base v1.0
   Paleta: Paciente=Azul, Terapeuta=Verde, Admin=Gris oscuro
════════════════════════════════════════════════════════════════ */

:root {
    --cd-blue:       #1A6BB5;
    --cd-blue-light: #EBF4FF;
    --cd-blue-mid:   #5B9BD5;
    --cd-green:      #1E7E34;
    --cd-green-light:#E8F5E9;
    --cd-green-mid:  #4CAF50;
    --cd-admin-dark: #1E2A38;
    --cd-admin-mid:  #2C3E50;
    --cd-admin-light:#ECF0F1;
    --cd-sidebar-w:  240px;
    --cd-navbar-h:   56px;
    --cd-topbar-h:   52px;
    --cd-text:       #212529;
    --cd-muted:      #6C757D;
    --cd-border:     #DEE2E6;
    --cd-radius:     8px;
    --cd-shadow:     0 1px 3px rgba(0,0,0,.08);
}

/* ── Reset y base ── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--cd-text); background: #F4F6F9; }
a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ── Layout general ── */
.cd-main-content {
    margin-top: calc(var(--cd-navbar-h) + 8px);
    min-height: calc(100vh - var(--cd-navbar-h) - 52px);
    padding: 1.5rem;
}
.cd-main-content.with-banner {
    margin-top: calc(var(--cd-navbar-h) + 36px);
}

/* ── Logo ── */
.cd-logo-icon {
    width: 32px; height: 32px;
    background: var(--cd-blue);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 15px;
}
.cd-logo-icon.cd-logo-terapeuta { background: var(--cd-green); }
.cd-logo-icon.cd-logo-admin     { background: var(--cd-admin-dark); }
.cd-logo-text { font-size: 16px; color: var(--cd-text); font-weight: 400; }
.cd-logo-text strong { font-weight: 700; }
.cd-logo-sub  { font-size: 10px; color: var(--cd-muted); line-height: 1; }

/* ═══════════════════════════════════════════
   NAVBAR — PACIENTE (azul)
════════════════════════════════════════════ */
.cd-navbar-paciente {
    background: #FFFFFF;
    border-bottom: 2px solid var(--cd-blue);
    height: var(--cd-navbar-h);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.cd-navbar-paciente .cd-nav-link {
    color: var(--cd-text);
    font-size: 13.5px;
    padding: .4rem .75rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.cd-navbar-paciente .cd-nav-link:hover,
.cd-navbar-paciente .cd-nav-link.active {
    background: var(--cd-blue-light);
    color: var(--cd-blue);
}
.cd-navbar-paciente .cd-nav-link.active { font-weight: 600; }

/* ═══════════════════════════════════════════
   NAVBAR — TERAPEUTA (verde)
════════════════════════════════════════════ */
.cd-navbar-terapeuta {
    background: #FFFFFF;
    border-bottom: 2px solid var(--cd-green);
    height: var(--cd-navbar-h);
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.cd-navbar-terapeuta .cd-nav-link {
    color: var(--cd-text);
    font-size: 13.5px;
    padding: .4rem .75rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.cd-navbar-terapeuta .cd-nav-link:hover,
.cd-navbar-terapeuta .cd-nav-link.active {
    background: var(--cd-green-light);
    color: var(--cd-green);
}
.cd-navbar-terapeuta .cd-nav-link.active { font-weight: 600; }

/* ═══════════════════════════════════════════
   DROPDOWN compartido
════════════════════════════════════════════ */
.cd-dropdown {
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    padding: .4rem 0;
    min-width: 220px;
}
.cd-dropdown .dropdown-item {
    font-size: 13px;
    padding: .45rem 1rem;
    color: var(--cd-text);
    transition: background .12s;
}
.cd-dropdown .dropdown-item:hover { background: #F8F9FA; }
.cd-dropdown .dropdown-divider { margin: .3rem 0; }

/* ── Avatar ── */
.cd-avatar-sm {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--cd-blue-light);
    color: var(--cd-blue);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
}
.cd-avatar-terapeuta { background: var(--cd-green-light); color: var(--cd-green); }
.cd-avatar-admin     { background: var(--cd-admin-light); color: var(--cd-admin-dark); }

/* ── Badges ── */
.cd-badge-ia  { background: #E8F5E9; color: #1B5E20; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.cd-badge-pro { background: #FFF8E1; color: #E65100; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.cd-badge-plan{ background: #EEE; color: #555; font-size: 10px; }

/* ── Selector de perfil tutelado ── */
.cd-perfil-selector { gap: 6px; }
.cd-perfil-select {
    min-width: 160px; max-width: 220px;
    font-size: 12px;
    border-color: var(--cd-border);
}

/* ── Banner perfil tutelado activo ── */
.cd-banner-tutelado {
    background: var(--cd-blue);
    color: white;
    font-size: 12.5px;
    padding: 6px 0;
    position: fixed;
    top: var(--cd-navbar-h);
    left: 0; right: 0;
    z-index: 1020;
}

/* ── Sesión online activa (terapeuta) ── */
.cd-sesion-activa-badge {
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--cd-green);
}
.cd-dot-online {
    width: 8px; height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-green 1.5s infinite;
}
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}
.cd-btn-sesion-activa {
    background: var(--cd-green); color: white;
    font-size: 11px; padding: 2px 10px; border-radius: 12px;
}
.cd-btn-sesion-activa:hover { background: #165a26; color: white; }

/* ═══════════════════════════════════════════
   ADMIN — SIDEBAR
════════════════════════════════════════════ */
.cd-layout-admin body,
body.cd-layout-admin { background: #F0F2F5; }

.cd-sidebar {
    width: var(--cd-sidebar-w);
    min-height: 100vh;
    background: var(--cd-admin-dark);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.cd-sidebar-brand {
    padding: 1rem 1rem .75rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.cd-sidebar-brand .cd-logo-text { color: white; }
.cd-sidebar-brand .cd-logo-sub  { color: rgba(255,255,255,.45); }

.cd-sidebar-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: 1rem 1rem .25rem;
    font-weight: 600;
}
.cd-sidebar-nav { padding: .5rem 0; }
.cd-sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: .5rem 1rem;
    color: rgba(255,255,255,.7);
    font-size: 13px;
    border-radius: 0;
    transition: background .15s, color .15s;
}
.cd-sidebar-link i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.cd-sidebar-link:hover { background: rgba(255,255,255,.07); color: white; }
.cd-sidebar-link.active { background: rgba(255,255,255,.12); color: white; font-weight: 600;
    border-left: 3px solid #5B9BD5; padding-left: calc(1rem - 3px); }

.cd-sidebar-user {
    padding: .75rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
}
.cd-sidebar-user .fw-semibold { color: rgba(255,255,255,.9); font-size: 12.5px; }
.cd-sidebar-user .x-small { font-size: 10.5px; }

/* ── Admin main area ── */
.cd-admin-main {
    margin-left: var(--cd-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
@media (max-width: 991.98px) {
    .cd-admin-main { margin-left: 0; }
}

.cd-topbar {
    height: var(--cd-topbar-h);
    background: white;
    border-bottom: 1px solid var(--cd-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.cd-topbar-title { font-size: 15px; color: var(--cd-text); }

.cd-admin-content {
    padding: 1.5rem;
    flex-grow: 1;
}

/* ═══════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.cd-footer {
    background: white;
    border-top: 1px solid var(--cd-border);
    padding: .75rem 0;
    margin-top: 2rem;
}

/* ═══════════════════════════════════════════
   COMPONENTES DE PÁGINA — reutilizables
════════════════════════════════════════════ */

/* Encabezado de página */
.cd-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--cd-border);
}
.cd-page-title { font-size: 20px; font-weight: 600; margin: 0; }
.cd-page-subtitle { font-size: 13px; color: var(--cd-muted); margin: 2px 0 0; }

/* Cards */
.cd-card {
    background: white;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    box-shadow: var(--cd-shadow);
}
.cd-card-header {
    padding: .875rem 1.125rem;
    border-bottom: 1px solid var(--cd-border);
    display: flex; align-items: center; justify-content: space-between;
}
.cd-card-body { padding: 1.125rem; }

/* KPI metric card */
.cd-metric-card {
    background: white;
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 1rem 1.25rem;
}
.cd-metric-label { font-size: 11.5px; color: var(--cd-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cd-metric-value { font-size: 26px; font-weight: 700; line-height: 1; }
.cd-metric-delta { font-size: 11.5px; margin-top: 4px; }
.cd-metric-delta.up   { color: #1E7E34; }
.cd-metric-delta.down { color: #C62828; }

/* Modalidad badges */
.cd-mod-presencial { background: #E3F2FD; color: #0D47A1; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.cd-mod-online     { background: #E8F5E9; color: #1B5E20; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.cd-mod-domicilio  { background: #FFF3E0; color: #BF360C; font-size: 11px; padding: 2px 8px; border-radius: 4px; }

/* Tablas */
.cd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cd-table th { padding: .6rem .875rem; background: #F8F9FA; border-bottom: 2px solid var(--cd-border);
    font-weight: 600; font-size: 12px; color: var(--cd-muted); text-transform: uppercase; letter-spacing: .04em; }
.cd-table td { padding: .6rem .875rem; border-bottom: 1px solid #F1F3F5; vertical-align: middle; }
.cd-table tr:hover td { background: #FAFBFC; }
.cd-table tr:last-child td { border-bottom: none; }

/* Responsive */
@media (max-width: 767.98px) {
    .cd-main-content { padding: 1rem; }
    .cd-page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
}
