/* modules/paciente_360/p360-topbar-v2.css · v2.0.0 · SPRINT SHELL-A
 * LUZOcrm V2 / TRANSED ONG · Estilos del topbar Staff-style para P360
 *
 * Este archivo se carga DESPUÉS de p360.css y sobreescribe las reglas
 * viejas del topbar por orden de cascade. No toca el resto del módulo
 * (sidebar, detalle, pacientes, etc.).
 *
 * Convenciones:
 *   - Topbar usa clases .st-* (patrón Staff real)
 *   - Body usa clases .p360-* (mantiene el namespace del módulo)
 *   - Tokens LUZOkit: --c-brand, --bbg, --tx-base, --border, etc.
 *   - Bordes 0.5px · radius 8/10/12px · font-weight 500
 *   - SIN border-left decorativo · solo bg-tint o box-shadow
 */

/* ═══════════════════════════════════════════════════════════════════════
   1. TOPBAR ÚNICO · 56px · patrón Staff (.st-topbar)
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .st-topbar,
.p360-topbar.st-topbar {
  height: 56px;
  background: var(--bg-card);
  border-bottom: .5px solid var(--border-soft, #eef2f7);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  flex-shrink: 0;
}

/* ─── Icono SIN FONDO color marca ────────────────────────────────────── */
.p360-shell .st-mod-icon {
  display: flex;
  align-items: center;
  color: var(--c-brand);
  /* No background · no border · no padding */
}
.p360-shell .st-mod-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Título del módulo ──────────────────────────────────────────────── */
.p360-shell .st-mod-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--tx-base);
  white-space: nowrap;
  letter-spacing: -.1px;
}

.p360-shell .st-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════
   2. PILL CENTRAL · 3 toggle-btn con separator (.st-toggle-group)
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .st-toggle-group {
  display: flex;
  border: .5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}

.p360-shell .st-toggle-btn {
  height: 32px;
  padding: 0 14px;
  min-width: 130px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--tx-muted);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.p360-shell .st-toggle-btn svg {
  width: 12px; height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p360-shell .st-toggle-btn:hover:not(.active) {
  color: var(--tx-base);
}

.p360-shell .st-toggle-btn.active {
  background: var(--c-brand-light, rgba(124, 58, 237, .08));
  color: var(--c-brand);
}

.p360-shell .st-toggle-btn + .st-toggle-btn {
  border-left: .5px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════
   3. SEARCH EXPANDIBLE (.st-search-*)
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .st-search-wrap {
  display: flex;
  align-items: center;
  border: .5px solid transparent;
  border-radius: 8px;
  transition: all .2s;
}

.p360-shell .st-search-wrap.open {
  border-color: var(--border);
  background: var(--bg-surface);
}

.p360-shell .st-search-icon-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--tx-muted);
  transition: background .15s, color .15s;
}

.p360-shell .st-search-icon-btn:hover {
  background: var(--c-brand-light, rgba(124, 58, 237, .08));
  color: var(--c-brand);
}

.p360-shell .st-search-wrap.open .st-search-icon-btn {
  color: var(--c-brand);
}

.p360-shell .st-search-icon-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.p360-shell .st-search-input {
  height: 30px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--tx-base);
  outline: none;
  overflow: hidden;
  transition: width .22s, padding .22s;
}

.p360-shell .st-search-input::placeholder {
  color: var(--tx-muted);
  opacity: .6;
}

/* ═══════════════════════════════════════════════════════════════════════
   4. VIEW MODES (cards / list) · .st-view-btns
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .st-view-btns {
  display: flex;
  border: .5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.p360-shell .st-view-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-muted);
  transition: background .15s, color .15s;
}

.p360-shell .st-view-btn svg {
  width: 13px; height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.p360-shell .st-view-btn:hover { color: var(--tx-base); }

.p360-shell .st-view-btn.active {
  background: var(--c-brand-light, rgba(124, 58, 237, .08));
  color: var(--c-brand);
}

.p360-shell .st-view-btn + .st-view-btn {
  border-left: .5px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════
   5. NUEVO PACIENTE · primario violeta + dropdown chevron
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .st-nuevo-wrap {
  display: flex;
  border-radius: 7px;
  overflow: hidden;
}

.p360-shell .st-btn-nuevo {
  height: 32px;
  background: var(--c-brand);
  color: #fff;
  border: none;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  transition: filter .15s;
}

.p360-shell .st-btn-nuevo:hover { filter: brightness(.92); }

.p360-shell .st-btn-nuevo svg {
  width: 11px; height: 11px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.p360-shell .st-btn-nuevo-dd {
  width: 28px; height: 32px;
  background: var(--c-brand);
  color: #fff;
  border: none;
  border-left: .5px solid rgba(255, 255, 255, .2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s;
}

.p360-shell .st-btn-nuevo-dd:hover { filter: brightness(.92); }

.p360-shell .st-btn-nuevo-dd svg {
  width: 10px; height: 10px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* ═══════════════════════════════════════════════════════════════════════
   6. BODY · contenedor que aloja SmartView card + view container
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .p360-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-body);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.p360-shell .p360-view-container {
  flex: 1;
  min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   7. SMARTVIEW CARD · ahora vive en el body, no en el topbar
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .p360-smartview-card {
  background: var(--bg-card);
  border: .5px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow-card, 0 1px 3px rgba(15, 23, 42, .04));
}

/* Anillo donut con conic-gradient · usa --p360-sv-pct para el progreso */
.p360-shell .p360-sv-ring {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: conic-gradient(
    var(--c-brand) var(--p360-sv-pct, 0%),
    var(--bbg) 0
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.p360-shell .p360-sv-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  background: var(--bg-card);
  border-radius: 50%;
}

.p360-shell .p360-sv-ring strong {
  position: relative;
  font-size: 17px;
  font-weight: 500;
  color: var(--tx-base);
  font-variant-numeric: tabular-nums;
}

.p360-shell .p360-sv-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.p360-shell .p360-sv-kpis {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.p360-shell .p360-sv-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p360-shell .p360-sv-kpi .v {
  font-size: 18px;
  font-weight: 500;
  color: var(--tx-base);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}

.p360-shell .p360-sv-kpi .l {
  font-size: 11px;
  color: var(--tx-muted);
}

.p360-shell .p360-sv-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.p360-shell .p360-sv-pill {
  background: var(--bg-surface);
  border: .5px solid var(--border);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 11.5px;
  color: var(--tx-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.p360-shell .p360-sv-pill svg {
  width: 11px; height: 11px;
  color: var(--c-brand);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   8. PLACEHOLDER · vistas no implementadas (Pacientes/Documentos)
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell .p360-placeholder {
  background: var(--bg-card);
  border: .5px solid var(--border);
  border-radius: 12px;
  padding: 80px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card, 0 1px 3px rgba(15, 23, 42, .04));
}

.p360-shell .p360-placeholder-ic {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bbg);
  color: var(--c-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.p360-shell .p360-placeholder-ic svg {
  width: 26px; height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p360-shell .p360-placeholder-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--tx-base);
  margin: 0;
  letter-spacing: -.2px;
}

.p360-shell .p360-placeholder-desc {
  font-size: 13px;
  color: var(--tx-muted);
  max-width: 440px;
  line-height: 1.55;
  margin: 0;
}

.p360-shell .p360-placeholder-sub {
  font-size: 11.5px;
  color: var(--tx-subtle, #94a3b8);
  margin: 0;
  letter-spacing: .3px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════
   9. SHELL CONTAINER · el root del módulo
   ═══════════════════════════════════════════════════════════════════════ */

.p360-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-body);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════
   10. OVERRIDES · ocultar el SmartView viejo si existe en el DOM
      (mientras existan en p360.css las reglas de la versión anterior)
   ═══════════════════════════════════════════════════════════════════════ */

/* El SmartView viejo vivía como segunda zona del topbar.
   Si aparece, lo ocultamos. Las nuevas reglas .p360-smartview-card
   en el body lo reemplazan. */
.p360-shell .p360-sv-bar,
.p360-shell .p360-topbar-smartview,
.p360-shell .p360-mod-count {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   11. RESPONSIVE · mobile / tablet
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .p360-shell .st-toggle-btn {
    min-width: 90px;
    padding: 0 10px;
  }
  .p360-shell .st-mod-name {
    font-size: 14px;
  }
  .p360-shell .st-btn-nuevo span {
    display: none;
  }
  .p360-shell .p360-body {
    padding: 16px;
  }
  .p360-shell .p360-sv-kpis {
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .p360-shell .st-toggle-btn {
    min-width: 60px;
    padding: 0 8px;
  }
  .p360-shell .st-toggle-btn span {
    display: none;
  }
  .p360-shell .st-view-btns {
    display: none;
  }
  .p360-shell .st-search-wrap.open .st-search-input {
    width: 120px;
  }
}
