/* =====================================================
   TERAPEUTA.CSS – Design clínico da Área do Terapeuta
   ===================================================== */

:root {
  --t-primary:    #4A6CF7;
  --t-primary-dk: #3451D1;
  --t-accent:     #7C3AED;
  --t-success:    #10B981;
  --t-warning:    #F59E0B;
  --t-danger:     #EF4444;
  --t-info:       #3B82F6;

  --t-bg:         #F1F5F9;
  --t-surface:    #FFFFFF;
  --t-border:     #E2E8F0;
  --t-border-dk:  #CBD5E1;

  --t-text:       #0F172A;
  --t-text-2:     #475569;
  --t-text-3:     #94A3B8;

  --t-font: 'Inter', 'Nunito', system-ui, sans-serif;
  --t-radius: 12px;
  --t-radius-lg: 20px;
  --t-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --t-shadow:    0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.04);
  --t-shadow-md: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);
  --t-shadow-lg: 0 20px 25px rgba(0,0,0,0.08), 0 10px 10px rgba(0,0,0,0.04);
}

/* ── RESET / BASE ── */
.t-page * { box-sizing: border-box; }
.t-page, .t-page body {
  font-family: var(--t-font);
  background: var(--t-bg);
  color: var(--t-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.t-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.t-sidebar {
  width: 240px;
  background: var(--t-surface);
  border-right: 1px solid var(--t-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  box-shadow: var(--t-shadow-sm);
}
.t-sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--t-border);
}
.t-sidebar-brand h2 {
  font-size: 1rem; font-weight: 700; color: var(--t-primary);
  margin: 0; letter-spacing: -0.01em;
}
.t-sidebar-brand p {
  font-size: 0.72rem; color: var(--t-text-3); margin: 2px 0 0;
}
.t-sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}
.t-nav-section { margin-bottom: 18px; }
.t-nav-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--t-text-3);
  padding: 0 10px 6px;
  display: block;
}
.t-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--t-text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.t-nav-item:hover { background: #F1F5F9; color: var(--t-text); }
.t-nav-item.active { background: #EEF2FF; color: var(--t-primary); font-weight: 700; }
.t-nav-item svg { flex-shrink: 0; opacity: 0.7; }
.t-nav-item.active svg { opacity: 1; }

/* MAIN */
.t-main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.t-topbar {
  background: var(--t-surface);
  border-bottom: 1px solid var(--t-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
}
.t-topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--t-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.t-topbar-actions { display: flex; gap: 10px; align-items: center; }
.t-content {
  padding: 24px 28px;
  flex: 1;
}

/* ── CARDS / PAINÉIS ── */
.t-card {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius-lg);
  box-shadow: var(--t-shadow);
  overflow: hidden;
}
.t-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--t-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.t-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--t-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.t-card-body { padding: 20px; }

/* ── STATS (KPI) ── */
.t-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.t-stat {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius-lg);
  padding: 18px 20px;
  box-shadow: var(--t-shadow-sm);
  position: relative;
  overflow: hidden;
}
.t-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.t-stat.c-blue::before   { background: var(--t-primary); }
.t-stat.c-green::before  { background: var(--t-success); }
.t-stat.c-purple::before { background: var(--t-accent); }
.t-stat.c-amber::before  { background: var(--t-warning); }
.t-stat.c-red::before    { background: var(--t-danger); }

.t-stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--t-text-3); margin-bottom: 6px; }
.t-stat-value { font-size: 2rem; font-weight: 800; color: var(--t-text); line-height: 1; }
.t-stat-sub   { font-size: 0.75rem; color: var(--t-text-3); margin-top: 4px; }
.t-stat-icon  { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 2rem; opacity: 0.12; }

/* ── TABELA ── */
.t-table-wrap { overflow-x: auto; }
.t-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.t-table thead th {
  padding: 10px 14px;
  background: #F8FAFC;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t-text-3);
  border-bottom: 1px solid var(--t-border);
  text-align: left;
  white-space: nowrap;
}
.t-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--t-border);
  color: var(--t-text-2);
  vertical-align: middle;
}
.t-table tbody tr:last-child td { border-bottom: none; }
.t-table tbody tr:hover { background: #F8FAFC; }
.t-table .fw { font-weight: 700; color: var(--t-text); }

/* ── BADGES ── */
.t-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.t-badge.green  { background: #DCFCE7; color: #15803D; }
.t-badge.amber  { background: #FEF9C3; color: #854D0E; }
.t-badge.red    { background: #FEE2E2; color: #991B1B; }
.t-badge.blue   { background: #DBEAFE; color: #1D4ED8; }
.t-badge.purple { background: #EDE9FE; color: #6D28D9; }
.t-badge.gray   { background: #F1F5F9; color: #475569; }

/* ── BOTÕES ── */
.t-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: var(--t-font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}
.t-btn:hover { transform: translateY(-1px); }
.t-btn:active { transform: scale(0.97); }
.t-btn.primary { background: var(--t-primary); color: #fff; box-shadow: 0 2px 8px rgba(74,108,247,0.3); }
.t-btn.primary:hover { background: var(--t-primary-dk); }
.t-btn.success { background: var(--t-success); color: #fff; }
.t-btn.danger  { background: var(--t-danger); color: #fff; }
.t-btn.outline { background: transparent; color: var(--t-text-2); border: 1.5px solid var(--t-border-dk); }
.t-btn.outline:hover { background: #F8FAFC; color: var(--t-text); }
.t-btn.ghost   { background: transparent; color: var(--t-text-3); }
.t-btn.ghost:hover { background: #F1F5F9; color: var(--t-text-2); }
.t-btn.sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 7px; }

/* ── FORMULÁRIOS ── */
.t-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.t-field { display: flex; flex-direction: column; gap: 5px; }
.t-field.full { grid-column: 1 / -1; }
.t-label { font-size: 0.8rem; font-weight: 600; color: var(--t-text-2); }
.t-label.required::after { content: ' *'; color: var(--t-danger); }
.t-input, .t-select, .t-textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--t-border-dk);
  border-radius: var(--t-radius);
  font-family: var(--t-font);
  font-size: 0.875rem;
  color: var(--t-text);
  background: #FAFAFA;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  width: 100%;
}
.t-input:focus, .t-select:focus, .t-textarea:focus {
  border-color: var(--t-primary);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.12);
  background: #fff;
}
.t-textarea { resize: vertical; min-height: 90px; }
.t-select { appearance: none; cursor: pointer; }

/* ── AVATAR ── */
.t-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}

/* ── PROGRESS BAR ── */
.t-progress-wrap {
  height: 8px;
  background: var(--t-border);
  border-radius: 99px;
  overflow: hidden;
}
.t-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}
.t-progress-fill.blue   { background: var(--t-primary); }
.t-progress-fill.green  { background: var(--t-success); }
.t-progress-fill.amber  { background: var(--t-warning); }
.t-progress-fill.red    { background: var(--t-danger); }
.t-progress-fill.purple { background: var(--t-accent); }

/* ── SEÇÃO ANALÍTICA ── */
.t-activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--t-border);
}
.t-activity-item:last-child { border-bottom: none; }
.t-activity-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.t-activity-info { flex: 1; min-width: 0; }
.t-activity-name { font-size: 0.9rem; font-weight: 700; color: var(--t-text); }
.t-activity-desc { font-size: 0.75rem; color: var(--t-text-3); line-height: 1.4; margin-top: 2px; }
.t-activity-stats { display: flex; gap: 14px; align-items: center; flex-shrink: 0; }
.t-activity-stat  { text-align: center; }
.t-activity-stat .val { font-size: 1.1rem; font-weight: 800; color: var(--t-text); }
.t-activity-stat .lbl { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--t-text-3); }

/* ── CHIPS ── */
.t-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.t-chip {
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #EEF2FF;
  color: var(--t-primary);
  border: 1px solid #C7D2FE;
}

/* ── MODAL ── */
.t-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.t-modal-backdrop.show { opacity: 1; pointer-events: all; }
.t-modal {
  background: var(--t-surface);
  border-radius: var(--t-radius-lg);
  box-shadow: var(--t-shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.t-modal-backdrop.show .t-modal { transform: scale(1) translateY(0); }
.t-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--t-border);
  display: flex; align-items: center; justify-content: space-between;
}
.t-modal-title { font-size: 1rem; font-weight: 700; }
.t-modal-body  { padding: 22px; }
.t-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--t-border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── TOAST ── */
.t-toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9000; display: flex; flex-direction: column; gap: 8px; }
.t-toast {
  background: var(--t-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--t-shadow-md);
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 240px;
  display: flex; align-items: center; gap: 10px;
}
.t-toast.show { transform: translateX(0); }
.t-toast.success { background: var(--t-success); }
.t-toast.error   { background: var(--t-danger); }
.t-toast.info    { background: var(--t-primary); }

/* ── EMPTY STATE ── */
.t-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center;
}
.t-empty-icon { font-size: 3.5rem; margin-bottom: 14px; opacity: 0.5; }
.t-empty-title { font-size: 1rem; font-weight: 700; color: var(--t-text-2); margin-bottom: 6px; }
.t-empty-sub   { font-size: 0.85rem; color: var(--t-text-3); }

/* ── BREADCRUMB ── */
.t-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--t-text-3); flex-wrap: wrap; }
.t-breadcrumb a { color: var(--t-primary); text-decoration: none; font-weight: 600; }
.t-breadcrumb a:hover { text-decoration: underline; }
.t-breadcrumb span { color: var(--t-text-3); }

/* ── DIVISOR ── */
.t-divider { height: 1px; background: var(--t-border); margin: 20px 0; }

/* ── FASE BADGE ── */
.fase-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 0.75rem; font-weight: 800;
  background: #EEF2FF; color: var(--t-primary);
}
.fase-pill.done { background: #DCFCE7; color: #15803D; }

/* ── RESPONSIVIDADE ── */
@media (max-width: 768px) {
  .t-sidebar { width: 200px; }
  .t-main    { margin-left: 200px; }
  .t-content { padding: 16px; }
  .t-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .t-sidebar { transform: translateX(-100%); }
  .t-sidebar.open { transform: translateX(0); }
  .t-main { margin-left: 0; }
}
