/* ============================================================
   THESIS PROTOCOL MODULE — thesis_protocol.css
   Encapsulated under .tp-wrap to avoid global style conflicts
   ============================================================ */

.tp-wrap {
  /* Local CSS variable overrides to fit platform aesthetic */
  --tp-primary: #378ADD;
  --tp-primary-dark: #185FA5;
  --tp-text-main: #1a1a2e;
  --tp-text-secondary: #4a4a6a;
  --tp-text-tertiary: #8888aa;
  --tp-bg-main: #ffffff;
  --tp-bg-secondary: #f5f5fa;
  --tp-border: rgba(0,0,0,0.1);
  --tp-border-strong: rgba(0,0,0,0.2);
  --tp-radius-sm: 6px;
  --tp-radius-md: 10px;
  --tp-radius-lg: 14px;

  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  min-height: 600px;
  max-height: 80vh;
  overflow: hidden;
  border: 3px solid #000;
  box-shadow: 8px 8px 0 #000;
  border-radius: 4px;
}

.tp-wrap *, .tp-wrap *::before, .tp-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- SIDEBAR ---- */
.tp-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--tp-bg-secondary);
  border-right: 1px solid var(--tp-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tp-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--tp-border);
  background: #1a1a2e;
  color: #fff;
}
.tp-sidebar-header h1 {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
  border: none;
  padding: 0;
  margin: 0;
}
.tp-sidebar-header p {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 3px;
}

.tp-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
}
.tp-nav::-webkit-scrollbar { width: 4px; }
.tp-nav::-webkit-scrollbar-track { background: transparent; }
.tp-nav::-webkit-scrollbar-thumb { background: var(--tp-border-strong); border-radius: 4px; }

.tp-nav-section { margin-bottom: 4px; }
.tp-nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--tp-text-tertiary);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 8px 4px;
}

.tp-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--tp-radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--tp-text-secondary);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
}
.tp-nav-item:hover {
  background: rgba(55,138,221,0.08);
  color: var(--tp-text-main);
}
.tp-nav-item.active {
  background: rgba(55,138,221,0.12);
  color: var(--tp-primary-dark);
  font-weight: 600;
}
.tp-nav-item .tp-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tp-border-strong);
  flex-shrink: 0;
  transition: background .2s;
}
.tp-nav-item.active .tp-dot { background: var(--tp-primary); }

/* ---- PROGRESS BAR ---- */
.tp-progress-bar {
  padding: 12px 16px;
  border-top: 1px solid var(--tp-border);
}
.tp-progress-bar p {
  font-size: 11px;
  color: var(--tp-text-tertiary);
  margin-bottom: 6px;
}
.tp-progress-track {
  height: 4px;
  background: var(--tp-border);
  border-radius: 2px;
  overflow: hidden;
}
.tp-progress-fill {
  height: 4px;
  background: var(--tp-primary);
  border-radius: 2px;
  transition: width .35s cubic-bezier(0.4,0,0.2,1);
}

.tp-nav-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--tp-border);
  display: flex;
  gap: 8px;
}
.tp-nav-btn {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  border: 1px solid var(--tp-border-strong);
  border-radius: var(--tp-radius-sm);
  background: none;
  color: var(--tp-text-secondary);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: background .15s;
  box-shadow: none;
  text-transform: none;
}
.tp-nav-btn:hover {
  background: var(--tp-bg-main);
  transform: none;
  box-shadow: none;
}
.tp-nav-btn.tp-primary {
  background: var(--tp-primary);
  color: #fff;
  border-color: var(--tp-primary);
  font-weight: 600;
}
.tp-nav-btn.tp-primary:hover {
  background: var(--tp-primary-dark);
  transform: none;
  box-shadow: none;
}

/* ---- MAIN CONTENT ---- */
.tp-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--tp-bg-main);
  scrollbar-width: thin;
}
.tp-main::-webkit-scrollbar { width: 6px; }
.tp-main::-webkit-scrollbar-thumb { background: var(--tp-border-strong); border-radius: 4px; }

.tp-page { display: none; }
.tp-page.active { display: block; animation: tpFadeIn .25s ease; }

@keyframes tpFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- PAGE HEADER ---- */
.tp-page-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tp-border);
}
.tp-page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--tp-text-main);
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  border: none;
  padding: 0;
  margin: 0 0 4px 0;
}
.tp-page-header p {
  font-size: 13px;
  color: var(--tp-text-secondary);
  line-height: 1.6;
  margin: 0;
  font-weight: 400;
}

/* ---- BADGES ---- */
.tp-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.tp-badge-info   { background: #E6F1FB; color: #0C447C; }
.tp-badge-warn   { background: #FAEEDA; color: #633806; }
.tp-badge-ok     { background: #EAF3DE; color: #27500A; }
.tp-badge-danger { background: #FCEBEB; color: #791F1F; }

/* ---- CARDS ---- */
.tp-card {
  background: var(--tp-bg-main);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tp-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--tp-text-main);
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
  border: none;
  padding: 0;
}
.tp-card p, .tp-card li {
  font-size: 13px;
  color: var(--tp-text-secondary);
  line-height: 1.65;
}
.tp-card ul { padding-left: 16px; }
.tp-card li  { margin-bottom: 4px; }

/* ---- ALERTS ---- */
.tp-alert {
  border-left: 3px solid;
  padding: 12px 16px;
  border-radius: 0 var(--tp-radius-sm) var(--tp-radius-sm) 0;
  margin-bottom: 12px;
}
.tp-alert p { font-size: 13px; line-height: 1.6; }
.tp-alert-warn   { border-color: #EF9F27; background: #FAEEDA; }
.tp-alert-warn p { color: #633806; }
.tp-alert-ok     { border-color: #639922; background: #EAF3DE; }
.tp-alert-ok p   { color: #27500A; }
.tp-alert-danger { border-color: #E24B4A; background: #FCEBEB; }
.tp-alert-danger p { color: #791F1F; }

/* ---- TWO COL ---- */
.tp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* ---- KV ROWS ---- */
.tp-kv-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--tp-border);
  font-size: 13px;
  gap: 8px;
}
.tp-kv-row:last-child { border-bottom: none; }
.tp-kv-label { color: var(--tp-text-secondary); flex-shrink: 0; }
.tp-kv-val   { color: var(--tp-text-main); font-weight: 600; text-align: right; }

/* ---- STEPS ---- */
.tp-step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.tp-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tp-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.tp-step-body h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--tp-text-main);
  margin-bottom: 2px;
}
.tp-step-body p {
  font-size: 13px;
  color: var(--tp-text-secondary);
  line-height: 1.6;
}

/* ---- CHIPS ---- */
.tp-chip {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--tp-border-strong);
  color: var(--tp-text-secondary);
  margin: 3px;
}
.tp-chip.green { background: #EAF3DE; border-color: #97C459; color: #27500A; }
.tp-chip.red   { background: #FCEBEB; border-color: #F09595; color: #791F1F; }

/* ---- STAT ROW ---- */
.tp-stat-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tp-stat-card {
  flex: 1;
  min-width: 90px;
  background: var(--tp-bg-secondary);
  border-radius: var(--tp-radius-md);
  padding: 10px 12px;
  border: 1px solid var(--tp-border);
}
.tp-stat-card .stat-n { font-size: 22px; font-weight: 700; color: var(--tp-primary-dark); }
.tp-stat-card .stat-l { font-size: 11px; color: var(--tp-text-tertiary); margin-top: 2px; }

/* ---- TABLE ---- */
.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.tp-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--tp-border-strong);
  font-weight: 600;
  color: var(--tp-text-secondary);
  font-size: 12px;
}
.tp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tp-border);
  color: var(--tp-text-main);
  vertical-align: top;
}
.tp-table tr:last-child td { border-bottom: none; }
.tp-table tr:hover td { background: var(--tp-bg-secondary); }

/* ---- PICO GRID ---- */
.tp-pico-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.tp-pico-card {
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-md);
  padding: 14px;
  background: var(--tp-bg-secondary);
}
.tp-pico-letter { font-size: 26px; font-weight: 700; color: var(--tp-primary-dark); margin-bottom: 4px; }
.tp-pico-name   { font-size: 12px; font-weight: 700; color: var(--tp-text-main); }
.tp-pico-desc   { font-size: 12px; color: var(--tp-text-secondary); margin-top: 4px; line-height: 1.5; }
.tp-pico-ex     { font-size: 11px; color: var(--tp-primary); margin-top: 8px; font-style: italic; }

/* ---- DECISION TREE ---- */
.tp-decision-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.tp-decision-card {
  flex: 1;
  min-width: 140px;
  border-radius: var(--tp-radius-md);
  padding: 12px;
}
.tp-dc-blue   { background: #E6F1FB; border: 1px solid #B5D4F4; }
.tp-dc-green  { background: #E1F5EE; border: 1px solid #9FE1CB; }
.tp-dc-yellow { background: #FAEEDA; border: 1px solid #FAC775; }
.tp-decision-card .dc-label { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.tp-decision-card .dc-result { font-size: 13px; font-weight: 800; margin: 4px 0 2px; }
.tp-decision-card .dc-sub    { font-size: 11px; }
.tp-dc-blue .dc-label  { color: #0C447C; }
.tp-dc-blue .dc-result { color: #185FA5; }
.tp-dc-blue .dc-sub    { color: #185FA5; }
.tp-dc-green .dc-label  { color: #085041; }
.tp-dc-green .dc-result { color: #0F6E56; }
.tp-dc-green .dc-sub    { color: #0F6E56; }
.tp-dc-yellow .dc-label  { color: #633806; }
.tp-dc-yellow .dc-result { color: #854F0B; }
.tp-dc-yellow .dc-sub    { color: #854F0B; }

/* ---- CHECKLIST ---- */
.tp-checklist-item {
  display: flex;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--tp-radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid var(--tp-border);
  background: var(--tp-bg-main);
  transition: background .2s, border-color .2s;
  user-select: none;
}
.tp-checklist-item:hover { background: var(--tp-bg-secondary); }
.tp-checklist-item.checked { background: #EAF3DE; border-color: #97C459; }

.tp-cb-box {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid var(--tp-border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
}
.tp-checklist-item.checked .tp-cb-box { background: #639922; border-color: #639922; }
.tp-cb-check { display: none; color: #fff; font-size: 11px; font-weight: 800; }
.tp-checklist-item.checked .tp-cb-check { display: block; }
.tp-cb-text { font-size: 13px; color: var(--tp-text-main); line-height: 1.5; }
.tp-checklist-item.checked .tp-cb-text { color: var(--tp-text-tertiary); text-decoration: line-through; }

/* ---- CHECKLIST FOOTER ---- */
.tp-checklist-footer {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--tp-radius-md);
  background: var(--tp-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--tp-border);
}
.tp-checklist-footer span { font-size: 13px; color: var(--tp-text-secondary); }
.tp-reset-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--tp-border-strong);
  border-radius: var(--tp-radius-sm);
  background: none;
  color: var(--tp-text-secondary);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .15s;
  box-shadow: none;
  text-transform: none;
  font-weight: 500;
}
.tp-reset-btn:hover { background: var(--tp-bg-main); transform: none; box-shadow: none; }

/* ---- RESPONSIVE ---- */
@media (max-width: 700px) {
  .tp-wrap { flex-direction: column; max-height: none; }
  .tp-sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--tp-border); }
  .tp-nav { max-height: 200px; }
  .tp-two-col { grid-template-columns: 1fr; }
  .tp-pico-grid { grid-template-columns: 1fr; }
}
