/* ============================================================
   InBody Tracker — Design System & Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Colors */
  --bg:           #08080f;
  --surface:      #10101a;
  --card:         #16162a;
  --card-hover:   #1e1e35;
  --border:       #252540;
  --border-light: #303055;

  --primary:      #00d4ff;
  --primary-dim:  rgba(0, 212, 255, 0.15);
  --primary-glow: rgba(0, 212, 255, 0.3);
  --success:      #00e87a;
  --success-dim:  rgba(0, 232, 122, 0.12);
  --warning:      #ffb800;
  --warning-dim:  rgba(255, 184, 0, 0.12);
  --danger:       #ff4466;
  --danger-dim:   rgba(255, 68, 102, 0.12);
  --purple:       #a855f7;
  --purple-dim:   rgba(168, 85, 247, 0.12);

  --text:         #eeeef5;
  --text-muted:   #7070a0;
  --text-dim:     #4a4a70;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --gap-xs:  0.25rem;
  --gap-sm:  0.5rem;
  --gap:     1rem;
  --gap-md:  1.5rem;
  --gap-lg:  2rem;
  --gap-xl:  3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --trans: 0.2s ease;
  --trans-slow: 0.4s ease;

  /* Shadows */
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--gap-md) 0 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0 var(--gap-md) var(--gap-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #0090ff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 16px var(--primary-glow);
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo .logo-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 0 var(--gap-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: var(--gap-sm) var(--gap-sm);
  margin-top: var(--gap-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.625rem var(--gap-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--trans);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--card);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.nav-item .nav-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.main-content {
  padding: var(--gap-lg);
  overflow-x: hidden;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap-lg);
  gap: var(--gap);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--trans);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
  background: #33deff;
  box-shadow: 0 0 30px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--border-light);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 68, 102, 0.25);
}

.btn-danger:hover {
  background: rgba(255, 68, 102, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--card);
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8rem;
}

.btn-icon {
  font-size: 16px;
}

/* ── Metric Cards ─────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-md);
  position: relative;
  overflow: hidden;
  transition: all var(--trans);
  cursor: default;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--metric-color, var(--primary));
  opacity: 0.7;
}

.metric-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--gap-sm);
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.metric-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--gap-sm);
  padding: 2px 6px;
  border-radius: 4px;
}

.metric-delta.positive {
  background: var(--success-dim);
  color: var(--success);
}

.metric-delta.negative {
  background: var(--danger-dim);
  color: var(--danger);
}

.metric-delta.neutral {
  background: var(--card-hover);
  color: var(--text-dim);
}

/* ── Charts ──────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-md);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
}

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.chart-legend {
  display: flex;
  gap: var(--gap);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.chart-wrapper {
  position: relative;
  height: 220px;
}

/* ── Table ───────────────────────────────────────────────────── */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--gap-lg);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-md);
  border-bottom: 1px solid var(--border);
}

.table-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface);
  padding: 0.625rem var(--gap-md);
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid var(--border);
  transition: background var(--trans);
}

tbody tr.clickable-row {
  cursor: pointer;
}

tbody tr.clickable-row:hover {
  background: var(--card-hover);
  box-shadow: inset 3px 0 0 var(--primary);
}

tbody tr.clickable-row:hover td:first-child {
  color: var(--primary);
}

tbody tr.clickable-row:hover .material-symbols-outlined {
  color: var(--primary);
}

tbody td {
  padding: 0.875rem var(--gap-md);
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-score {
  background: var(--primary-dim);
  color: var(--primary);
}

.badge-good  { background: var(--success-dim); color: var(--success); }
.badge-warn  { background: var(--warning-dim); color: var(--warning); }
.badge-bad   { background: var(--danger-dim);  color: var(--danger); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--gap-xl);
  text-align: center;
  gap: var(--gap);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 280px;
}

/* ── Loading ─────────────────────────────────────────────────── */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,8,15,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--gap);
}

.loading-overlay .loading-spinner {
  margin: 0;
}

.loading-overlay.active {
  display: flex;
}

.loading-overlay p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: var(--gap-md);
  right: var(--gap-md);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.75rem var(--gap);
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 260px;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
.toast.info    { border-color: var(--primary); color: var(--primary); }

/* ── Form Styles ─────────────────────────────────────────────── */
.form-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-md);
  margin-bottom: var(--gap);
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
input[type="password"],
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--trans);
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Upload Zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--gap-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--trans);
  position: relative;
  background: var(--surface);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-dim);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: var(--gap-sm);
  opacity: 0.5;
}

.upload-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Mode Tabs ───────────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--gap-md);
}

.mode-tab {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
}

.mode-tab.active {
  background: var(--card);
  color: var(--primary);
}

/* ── AI Panel ────────────────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, rgba(0,212,255,0.05), rgba(0,144,255,0.05));
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: var(--radius);
  padding: var(--gap-md);
  margin-bottom: var(--gap);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--gap-sm);
}

/* ── Image Preview ───────────────────────────────────────────── */
.image-preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 450px; /* Limit width so portrait paper printouts look natural and not too wide */
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  display: none;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.image-preview img {
  width: 100%;
  height: auto; /* Preserve natural aspect ratio */
  max-height: 500px; /* Avoid making it too tall */
  display: block;
  object-fit: contain;
  background: var(--surface);
}

.image-preview.visible {
  display: block;
}

.remove-image-btn {
  position: absolute;
  top: var(--gap-sm);
  right: var(--gap-sm);
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* ── Body Composition Bar ────────────────────────────────────── */
.composition-bar {
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  margin: var(--gap) 0;
}

.comp-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all var(--trans-slow);
}

/* ── Detail Grid ─────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-key {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.detail-val {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Segment Bars (Muscle by Segment) ───────────────────────── */
.segment-bars {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.seg-row {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.seg-label {
  width: 90px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.seg-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.seg-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width var(--trans-slow);
}

.seg-val {
  width: 50px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

/* ── No Sidebar pages ────────────────────────────────────────── */
.single-page {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--gap-lg);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fade-up 0.4s ease both;
}

.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }
.fade-up-5 { animation-delay: 0.25s; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 50;
    height: 100vh;
    transition: left var(--trans);
    width: 240px;
  }

  .sidebar.open { left: 0; }

  .mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .main-content { padding: var(--gap); }
}

.mobile-header {
  display: none;
}

/* ── Score Ring ──────────────────────────────────────────────── */
.score-ring-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap);
}

.score-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-num {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--primary);
}

.score-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.85;
}

/* ── Divider ─────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--gap-md) 0;
}

/* ── Backdrop for mobile sidebar ─────────────────────────────── */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 45;
}

#sidebar-backdrop.active { display: block; }

/* ── Compare diff colors ─────────────────────────────────────── */
.delta-up   { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-same { color: var(--text-dim); }

/* ── Segmental Muscle Mass Visual Body Model ── */
.segmental-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--gap-md);
  align-items: center;
  margin-top: var(--gap-sm);
}

@media (max-width: 768px) {
  .segmental-layout {
    grid-template-columns: 1fr;
  }
}

.body-model-container {
  position: relative;
  width: 100%;
  max-width: 260px;
  height: 320px;
  margin: 0 auto;
  background: radial-gradient(circle, rgba(22,22,42,0.6) 0%, rgba(8,8,15,0.8) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,212,255,0.05);
}

.body-silhouette {
  height: 85%;
  width: auto;
  opacity: 0.85;
  filter: drop-shadow(0 0 10px rgba(0,212,255,0.1));
}

/* SVG Parts */
.body-part {
  fill: #1d1d36;
  stroke: var(--border-light);
  stroke-width: 1.5;
  transition: all 0.3s ease;
}

.body-part.active-trunk {
  fill: rgba(168, 85, 247, 0.15);
  stroke: var(--purple);
}

.body-part.active-arm {
  fill: rgba(0, 212, 255, 0.15);
  stroke: var(--primary);
}

.body-part.active-leg {
  fill: rgba(0, 232, 122, 0.15);
  stroke: var(--success);
}

/* Absolute Badges on Body Model */
.body-badge {
  position: absolute;
  background: rgba(22, 22, 42, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: all var(--trans);
  z-index: 10;
}

.body-badge:hover {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0,212,255,0.2);
}

.body-badge .badge-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.body-badge .badge-value {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

/* Positionings */
.badge-right-arm { top: 20%; left: 8%; border-left: 3px solid var(--primary); }
.badge-left-arm  { top: 20%; right: 8%; border-right: 3px solid var(--primary); }
.badge-trunk     { top: 40%; left: 50%; transform: translateX(-50%); border-bottom: 3px solid var(--purple); }
.badge-right-leg { bottom: 15%; left: 10%; border-left: 3px solid var(--success); }
.badge-left-leg  { bottom: 15%; right: 10%; border-right: 3px solid var(--success); }

/* Segmental Fat Model Specifics */
.body-silhouette.fat-model {
  filter: drop-shadow(0 0 10px rgba(255,68,102,0.15));
}
.body-part.active-fat-trunk {
  fill: rgba(255, 68, 102, 0.12);
  stroke: var(--danger);
}
.body-part.active-fat-arm {
  fill: rgba(255, 68, 102, 0.12);
  stroke: var(--danger);
}
.body-part.active-fat-leg {
  fill: rgba(255, 68, 102, 0.12);
  stroke: var(--danger);
}
.body-badge.fat-badge:hover {
  border-color: var(--danger);
  box-shadow: 0 0 10px rgba(255,68,102,0.25);
}
.badge-right-arm.fat-badge { border-left: 3px solid var(--danger) !important; }
.badge-left-arm.fat-badge  { border-right: 3px solid var(--danger) !important; }
.badge-trunk.fat-badge     { border-bottom: 3px solid var(--danger) !important; }
.badge-right-leg.fat-badge { border-left: 3px solid var(--danger) !important; }
.badge-left-leg.fat-badge  { border-right: 3px solid var(--danger) !important; }

/* Right side list */
.segment-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: all var(--trans);
}

.legend-card-row:hover {
  border-color: var(--border-light);
  background: rgba(255,255,255,0.04);
}

.legend-part-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-part-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-part-name {
  font-weight: 600;
  color: var(--text);
}

.legend-part-val {
  font-weight: 800;
  font-size: 0.85rem;
}

/* ── Form Field Info text ── */
/* ── Form Field Tooltips ── */
.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
}

.tooltip-icon {
  font-size: 14px !important;
  color: var(--text-muted);
  transition: color var(--trans);
}

.info-tooltip:hover .tooltip-icon {
  color: var(--primary);
}

.tooltip-text {
  visibility: hidden;
  width: 240px;
  background: var(--card);
  color: var(--text);
  text-align: left;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  position: absolute;
  z-index: 150;
  bottom: 130%; /* Position above the icon */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, bottom 0.2s ease;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 8px 30px rgba(0,0,0,0.7);
  pointer-events: none;
  white-space: normal;
  text-transform: none; /* Prevent uppercase from labels */
}

/* Arrow for tooltip */
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--border-light) transparent transparent transparent;
}

.info-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
  bottom: 145%;
}

/* ── Language Switcher in Sidebar ── */
.lang-selector {
  padding: 0.5rem 1.25rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  border-top: 1px solid var(--border);
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all var(--trans);
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  color: var(--primary);
  background: var(--primary-dim);
}



