/* ================================================
   MINDSPACE — Estilos v2.0
   Paleta: Azul pizarra profundo + Teal
   ================================================ */

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

:root {
    --azul:        #1e3a5f;
    --azul-medio:  #2c4f7c;
    --azul-suave:  #3b6498;
    --teal:        #0d9488;
    --teal-suave:  #14b8a6;
    --teal-bg:     #f0fdfa;
    --teal-borde:  #99f6e4;
    --acento:      #0d9488;
    --acento-dark: #0f766e;
    --page-bg:     #f4f6f9;
    --card-bg:     #ffffff;
    --sidebar-bg:  #1e3a5f;
    --sidebar-borde: rgba(255,255,255,0.07);
    --sidebar-activo: rgba(13,148,136,0.18);
    --sidebar-hover:  rgba(255,255,255,0.05);
    --texto-dark:  #0f1f35;
    --texto-medio: #4a6080;
    --texto-claro: #7a96b5;
    --borde:       #e2e8f0;
    --borde-medio: #cbd5e1;
    --shadow-card: 0 1px 3px rgba(30,58,95,0.06), 0 4px 12px rgba(30,58,95,0.04);
    --shadow-hover:0 4px 16px rgba(30,58,95,0.12);
    --radius-sm:   6px;
    --radius:      10px;
    --radius-lg:   14px;
    --verde-bg:    #f0fdf4;
    --verde-texto: #166534;
    --verde-borde: #bbf7d0;
    --verde-fill:  #16a34a;
    --amber-bg:    #fffbeb;
    --amber-texto: #92400e;
    --amber-borde: #fde68a;
    --rojo-bg:     #fef2f2;
    --rojo-texto:  #991b1b;
    --rojo-borde:  #fecaca;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--page-bg);
    color: var(--texto-dark);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--acento-dark); text-decoration: underline; }

/* ================================================
   LAYOUT
   ================================================ */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.main-content { display: flex; flex-direction: column; min-height: 100vh; background: var(--page-bg); }

/* ================================================
   SIDEBAR
   ================================================ */
.sidebar {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.side-top {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--sidebar-borde);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logo-icono {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icono i { font-size: 18px; color: white; }

.logo-texto {
    font-size: 16px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

.doc-chip { display: flex; align-items: center; gap: 10px; }

.av {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.av-pro     { background: rgba(13,148,136,0.25); color: #5eead4; }
.av-accent  { background: rgba(59,100,152,0.4);  color: #93c5fd; }
.av-success { background: rgba(22,163,74,0.2);   color: #86efac; }
.av-warning { background: rgba(217,119,6,0.2);   color: #fcd34d; }

.doc-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.92); }
.doc-role { font-size: 11px; color: rgba(255,255,255,0.38); margin-top: 1px; }

.nav-menu { flex: 1; padding: 10px 10px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.75);
    text-decoration: none;
}

.nav-item.active {
    background: var(--sidebar-activo);
    color: #5eead4;
    font-weight: 500;
    border-left: 2px solid var(--teal-suave);
}

.nav-item i { font-size: 17px; flex-shrink: 0; }

.badge-count {
    margin-left: auto;
    font-size: 10px;
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
    border-radius: 999px;
    padding: 2px 7px;
    font-weight: 600;
}

.side-foot {
    padding: 14px 18px;
    border-top: 1px solid var(--sidebar-borde);
}

.plan-pill {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(13,148,136,0.2);
    color: #5eead4;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 6px;
    border: 1px solid rgba(94,234,212,0.2);
}

.plan-txt { font-size: 11px; color: rgba(255,255,255,0.3); line-height: 1.5; }
.plan-txt a { color: #5eead4; }

/* Logout link en sidebar */
.side-foot a[href*="logout"] {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-decoration: none;
    transition: color 0.15s;
}
.side-foot a[href*="logout"]:hover { color: rgba(255,255,255,0.6); text-decoration: none; }

/* ================================================
   TOPBAR
   ================================================ */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--borde);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 0 rgba(30,58,95,0.04);
}

.topbar-title { font-size: 18px; font-weight: 700; color: var(--texto-dark); letter-spacing: -0.4px; }
.topbar-sub   { font-size: 11px; color: var(--texto-claro); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.ib {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--borde);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--texto-medio);
    background: var(--card-bg);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.ib:hover { border-color: var(--borde-medio); background: var(--page-bg); color: var(--texto-dark); text-decoration: none; }
.ib i { font-size: 17px; }

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--azul);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-primary:hover { background: var(--azul-medio); color: white; text-decoration: none; }
.btn-primary i { font-size: 15px; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--texto-medio);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--borde);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: inherit;
}
.btn-secondary:hover { border-color: var(--borde-medio); background: var(--page-bg); color: var(--texto-dark); text-decoration: none; }
.btn-danger { border-color: var(--rojo-borde); color: var(--rojo-texto); }
.btn-danger:hover { background: var(--rojo-bg); }

/* ================================================
   BODY / CONTENIDO
   ================================================ */
.body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

/* ================================================
   STAT CARDS
   ================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--borde);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--azul-suave));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-lbl { font-size: 11px; color: var(--texto-claro); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-val { font-size: 24px; font-weight: 700; color: var(--texto-dark); letter-spacing: -0.5px; line-height: 1.1; }
.stat-sub { font-size: 11px; color: var(--teal); margin-top: 5px; font-weight: 500; }

/* ================================================
   CARDS
   ================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--borde);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sec-lbl { font-size: 10px; font-weight: 700; color: var(--texto-claro); text-transform: uppercase; letter-spacing: .07em; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ================================================
   FILAS
   ================================================ */
.row-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.row-item:last-child { border-bottom: none; }
.row-info { flex: 1; min-width: 0; }
.row-name { font-size: 13px; font-weight: 500; color: var(--texto-dark); }
.row-meta { font-size: 11px; color: var(--texto-claro); margin-top: 1px; }
.time-block { font-size: 11px; color: var(--texto-claro); width: 42px; flex-shrink: 0; text-align: right; font-weight: 500; }

/* ================================================
   BADGES
   ================================================ */
.status { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.s-green  { background: var(--verde-bg);  color: var(--verde-texto);  border: 1px solid var(--verde-borde); }
.s-amber  { background: var(--amber-bg);  color: var(--amber-texto);  border: 1px solid var(--amber-borde); }
.s-muted  { background: #f8fafc;          color: var(--texto-claro);  border: 1px solid var(--borde); }
.s-red    { background: var(--rojo-bg);   color: var(--rojo-texto);   border: 1px solid var(--rojo-borde); }
.s-blue   { background: #eff6ff;          color: #1d4ed8;             border: 1px solid #bfdbfe; }

/* ================================================
   ALERTAS
   ================================================ */
.alert-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); }
.alert-warning { background: var(--amber-bg); border: 1px solid var(--amber-borde); }
.alert-danger  { background: var(--rojo-bg);  border: 1px solid var(--rojo-borde); }
.alert-success { background: var(--verde-bg); border: 1px solid var(--verde-borde); }
.alert-box i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-warning i { color: #d97706; }
.alert-danger i  { color: #dc2626; }
.alert-success i { color: var(--verde-fill); }
.alert-txt { font-size: 13px; line-height: 1.5; }
.alert-warning .alert-txt { color: var(--amber-texto); }
.alert-danger  .alert-txt { color: var(--rojo-texto); }
.alert-success .alert-txt { color: var(--verde-texto); }

/* ================================================
   PROGRESS BAR
   ================================================ */
.progress-wrap { background: linear-gradient(135deg, #f0fdfa, #e0f2fe); border: 1px solid var(--teal-borde); border-radius: var(--radius-lg); padding: 14px 18px; display: flex; align-items: center; gap: 16px; }
.progress-lbl  { font-size: 13px; font-weight: 600; color: var(--azul); white-space: nowrap; }
.progress-bar-bg   { flex: 1; background: rgba(255,255,255,0.7); border-radius: 999px; height: 8px; }
.progress-fill { background: linear-gradient(90deg, var(--teal), var(--azul-suave)); height: 8px; border-radius: 999px; transition: width 0.4s ease; }
.progress-pct  { font-size: 13px; font-weight: 700; color: var(--azul); white-space: nowrap; }

/* ================================================
   FORMULARIOS
   ================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--texto-medio); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--borde);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
    color: var(--texto-dark);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--texto-claro); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================================================
   TABLA
   ================================================ */
table.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tabla th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    color: var(--texto-claro);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--borde);
}
table.tabla td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; color: var(--texto-dark); vertical-align: middle; }
table.tabla tr:last-child td { border-bottom: none; }
table.tabla tbody tr:hover td { background: #f8fafc; }

/* ================================================
   AVATARES
   ================================================ */
.av {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}

/* Colores de avatar para área clara */
.av-pro-light     { background: #ede9fe; color: #6d28d9; }
.av-teal-light    { background: var(--teal-bg); color: var(--teal); }
.av-amber-light   { background: var(--amber-bg); color: #d97706; }
.av-blue-light    { background: #eff6ff; color: #2563eb; }
.av-pink-light    { background: #fdf2f8; color: #db2777; }

/* ================================================
   TASK CHECK
   ================================================ */
.task-check {
    width: 20px; height: 20px;
    border-radius: 6px;
    border: 2px solid var(--borde-medio);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
.task-check.done { background: var(--verde-fill); border-color: var(--verde-fill); }
.task-check i { font-size: 12px; color: white; }

/* ================================================
   MOOD BUTTONS
   ================================================ */
.mood-grid { display: flex; gap: 8px; }
.mood-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 6px;
    background: var(--page-bg);
    border: 1px solid var(--borde);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.mood-btn:hover { background: var(--teal-bg); border-color: var(--teal-borde); transform: translateY(-1px); }
.mood-btn.selected { border-color: var(--teal); background: var(--teal-bg); box-shadow: 0 0 0 3px rgba(13,148,136,0.12); }
.mood-emoji { font-size: 24px; }
.mood-label { font-size: 10px; color: var(--texto-claro); font-weight: 500; }
.mood-btn.selected .mood-label { color: var(--teal); }

/* ================================================
   MENSAJES
   ================================================ */
.msg-bubble {
    background: #f8fafc;
    border-radius: 4px 12px 12px 12px;
    padding: 10px 14px;
    border: 1px solid var(--borde);
}
.msg-author { font-size: 11px; color: var(--texto-claro); margin-bottom: 3px; font-weight: 600; }
.msg-text { font-size: 13px; color: var(--texto-dark); line-height: 1.5; }
.msg-time { font-size: 10px; color: var(--texto-claro); text-align: right; margin-top: 5px; }

/* ================================================
   LOGIN
   ================================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8f4f0 100%);
}

.login-card {
    background: white;
    border: 1px solid var(--borde);
    border-radius: 20px;
    padding: 40px 36px;
    width: 400px;
    box-shadow: 0 8px 40px rgba(30,58,95,0.1);
}

.login-logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-icono {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--azul);
    display: flex; align-items: center; justify-content: center;
}
.login-icono i { font-size: 22px; color: white; }

.login-logo { font-size: 24px; font-weight: 800; color: var(--texto-dark); letter-spacing: -0.5px; }
.login-sub  { font-size: 13px; color: var(--texto-claro); margin-bottom: 28px; }

/* ================================================
   MODALES (position fixed — solo en páginas PHP reales)
   ================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,31,53,0.4);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 26px;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(30,58,95,0.2);
    border: 1px solid var(--borde);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title  { font-size: 16px; font-weight: 700; color: var(--texto-dark); }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .cols2, .cols3, .form-grid { grid-template-columns: 1fr; }
}

/* ================================================
   SCROLLBAR (Webkit)
   ================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--borde-medio); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--texto-claro); }
