/* ============================================
   FITCALC HUB — Components CSS
   ============================================ */

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 18px;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Tool Card (Grid item) */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-subtle);
  opacity: 0;
  transition: opacity var(--transition);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-accent);
  border-color: var(--border-accent);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card:active {
  transform: scale(0.97);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.tool-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.tool-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

/* Stat Chip */
.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  flex: 1;
  min-width: 0;
  transition: background var(--transition);
}

.stat-chip-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-chip-label i {
  font-size: 12px;
}

.stat-chip-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-chip-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 3px;
}

.stat-chip-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-chip-change.positive { color: var(--success); }
.stat-chip-change.negative { color: var(--danger); }

/* ============ CHART SECTION ============ */
.chart-section {
  margin: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  transition: background var(--transition);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
}

.chart-select {
  background: var(--bg-input);
  color: var(--accent);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FF6B35' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.chart-canvas-wrapper {
  height: 180px;
  position: relative;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.chart-labels span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 20px;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn:hover::after {
  background: rgba(255,255,255,0.05);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #FFFFFF;
  width: 100%;
  box-shadow: var(--shadow-accent);
  font-size: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(255,107,53,0.4);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  width: 100%;
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--primary,
.primary-action {
  min-height: 58px;
  padding: 0 22px;
  border-radius: var(--radius-2xl);
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-strong));
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent-lg);
  font-size: 18px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn--secondary,
.secondary-action {
  min-height: 58px;
  padding: 0 22px;
  border-radius: var(--radius-2xl);
  background: var(--surface-overlay-soft);
  border: 1px solid var(--border-strong);
  color: var(--text-heading-soft);
  font-size: 18px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), border-color var(--transition);
}

.btn--primary:hover,
.btn--secondary:hover,
.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-1px);
}

.btn--secondary[disabled],
.secondary-action[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--block {
  width: 100%;
}

.btn--large {
  min-height: 58px;
  font-size: 18px;
  font-weight: 900;
}


.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
}

.btn-ghost:hover {
  background: var(--accent-subtle);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
}

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
}

/* ============ FORM INPUTS ============ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;         /* Tránh iOS auto-zoom */
  font-weight: 500;
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  outline: none;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field.has-unit {
  padding-right: 60px;
}

.input-unit {
  position: absolute;
  right: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

/* Select dropdown */
.select-field {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  padding: 14px 40px 14px 16px;
  transition: border-color var(--transition);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23A0A0A0' d='M7 9L2 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.select-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  outline: none;
}

/* Gender toggle */
.gender-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.gender-btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gender-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: var(--shadow-accent);
}

/* Error state */
.input-error .input-field {
  border-color: var(--danger);
}

.error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: -4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ RESULT BOX ============ */
.result-box {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-top: 8px;
  display: none;
  animation: slideUp 0.3s ease-out both;
}

.result-box.show {
  display: block;
}

.result-primary {
  text-align: center;
  margin-bottom: 20px;
}

.result-value {
  font-family: var(--font-heading);
  font-size: 52px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.result-unit {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

.result-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 8px;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 12px;
}

.badge-athlete { background: rgba(76,175,80,0.15); color: #4CAF50; }
.badge-fitness { background: rgba(33,150,243,0.15); color: #2196F3; }
.badge-average { background: rgba(255,193,7,0.15); color: #FFC107; }
.badge-obese   { background: rgba(244,67,54,0.15); color: #F44336; }
.badge-ecto    { background: rgba(156,39,176,0.15); color: #9C27B0; }
.badge-meso    { background: rgba(76,175,80,0.15); color: #4CAF50; }
.badge-endo    { background: rgba(255,152,0,0.15); color: #FF9800; }

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-row-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-row-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-interpretation {
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
}

/* ============ CALCULATOR SHARED COMPONENTS ============ */
.calculator-card,
.bmr-card {
  background: var(--surface-panel);
  border: 1px solid var(--border-accent-soft);
  border-radius: var(--radius-4xl);
  box-shadow: var(--shadow-panel);
  min-width: 0;
}

.calculator-card--panel,
.calculator-card--comparison,
.calculator-card--metric-list,
.user-card,
.formula-card,
.tdee-card,
.result-card {
  padding: var(--space-2xl);
}

.calculator-card--result,
.result-card {
  background: var(--surface-panel-strong);
  box-shadow: var(--shadow-panel-strong), 0 0 0 1px rgba(60, 128, 212, 0.12) inset;
}

.calculator-card--note,
.advice-card {
  padding: var(--space-2xl) 30px;
}

.card-title,
.calculator-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-heading-soft);
}

.card-title i,
.calculator-card-title i {
  color: var(--accent-primary);
}

.calc-form,
.field-stack {
  display: grid;
  gap: 20px;
}

.calc-field,
.field-row {
  display: grid;
  gap: 10px;
}

.calc-label,
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-body-soft);
  letter-spacing: 0.02em;
}

.segmented-control,
.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: var(--surface-input-strong);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-2xl);
}

.segmented-control__item,
.toggle-chip {
  min-width: 0;
  min-height: 58px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted-strong);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.25s ease;
}

.segmented-control__item.active,
.toggle-chip.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-strong));
  color: var(--text-on-accent);
  box-shadow: 0 16px 30px rgba(90, 149, 216, 0.18);
}

/* Female gender button - Pink gradient */
#btn-female.active,
#gender-female.active {
  background: linear-gradient(135deg, #ff8cb7, #ff6f91) !important;
  color: #fff7fb !important;
  box-shadow: 0 16px 32px rgba(255, 111, 145, 0.2) !important;
}

/* Imperial unit button - Purple gradient */
#btn-imperial.active,
#unit-imperial.active {
  background: linear-gradient(135deg, #8b78ff, #5d88ff) !important;
  color: #f7fbff !important;
  box-shadow: 0 16px 32px rgba(93, 136, 255, 0.2) !important;
}

.calc-input-grid,
.input-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.calc-split-grid,
.height-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.calc-input-shell,
.input-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 0 18px;
  background: var(--surface-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.calc-input-shell input,
.input-shell input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-strong);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.calc-input-shell input::placeholder,
.input-shell input::placeholder {
  color: var(--text-subtle);
}

.calc-input-unit,
.input-unit {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  position: static;
  right: auto;
  color: var(--text-subtle);
  font-size: 14px;
  font-weight: 800;
  text-transform: lowercase;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.calc-help-text,
.input-help {
  margin: 0;
  color: var(--text-subtle);
  font-size: 13px;
  line-height: 1.5;
}

.calc-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.calc-actions > *,
.form-actions > * {
  flex: 1 1 220px;
}

.calc-field-error,
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: #ff835d;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.is-invalid .calc-input-shell,
.field-has-error .input-shell {
  border-color: var(--border-danger-strong);
  box-shadow: 0 0 0 1px rgba(236, 98, 98, 0.12);
}

.result-hero__eyebrow,
.result-eyebrow {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #77bdef;
  text-align: center;
}

.result-hero__value-row,
.result-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.result-hero__value {
  font-size: clamp(68px, 8vw, 120px);
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: -0.07em;
  color: #fff9f3;
}

.result-hero__unit,
.result-unit {
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 900;
  color: var(--accent-primary-soft);
  line-height: 1.1;
}

.result-hero__summary {
  margin: 0 auto;
  max-width: 430px;
  text-align: center;
  color: var(--text-body);
  font-size: 18px;
  line-height: 1.65;
}

.result-hero__meta-grid,
.result-status {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-pill,
.mini-pill {
  padding: 14px 16px;
  border-radius: var(--radius-2xl);
  background: var(--surface-overlay-soft);
  border: 1px solid var(--surface-overlay-medium);
}

.result-pill span,
.mini-pill span {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #89a0b8;
}

.result-pill strong,
.mini-pill strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-strong);
}

.comparison-list,
.formula-list {
  display: grid;
  gap: 18px;
}

.comparison-item,
.formula-item {
  display: grid;
  gap: 10px;
}

.comparison-copy,
.formula-copy {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.comparison-copy strong,
.formula-copy strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-heading-soft);
}

.comparison-copy span,
.formula-copy span {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-strong);
}

.comparison-copy small,
.formula-copy small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted-strong);
}

.comparison-bar,
.formula-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-overlay-medium);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.comparison-bar > i,
.formula-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-cyan-strong));
  transition: width 0.3s ease;
  box-shadow: 0 0 18px rgba(93, 159, 226, 0.2);
}

.comparison-bar--secondary > i,
.formula-bar.alt i {
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-violet-strong));
  box-shadow: 0 0 18px rgba(88, 119, 255, 0.22);
}

.comparison-bar--soft > i,
.formula-bar.soft i {
  background: linear-gradient(90deg, var(--accent-mint), var(--accent-mint-strong));
  box-shadow: 0 0 18px rgba(95, 224, 210, 0.2);
}

.metric-list,
.tdee-list {
  display: grid;
  gap: 14px;
}

.metric-list__item,
.tdee-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: var(--radius-3xl);
  background: var(--surface-list-item);
  border: 1px solid rgba(255,255,255,0.04);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.metric-list__item--active,
.tdee-item.active {
  background: linear-gradient(135deg, rgba(46, 86, 123, 0.46), rgba(30, 56, 90, 0.24));
  border-color: var(--border-accent-strong);
  box-shadow: 0 0 0 1px rgba(97, 183, 233, 0.12) inset;
}

.metric-list__icon,
.tdee-icon {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-2xl);
  background: var(--surface-overlay-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted-strong);
  font-size: 22px;
}

.metric-list__content strong,
.tdee-copy strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: #f5fbff;
}

.metric-list__content span,
.tdee-copy span {
  display: block;
  margin-top: 4px;
  color: #879cb1;
  font-size: 15px;
  line-height: 1.45;
}

.metric-list__value,
.tdee-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-primary-soft);
  text-align: right;
}

.note-card,
.advice-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.note-card__icon,
.advice-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: rgba(99, 183, 232, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary-soft);
  font-size: 28px;
}

.note-card__content h3,
.advice-copy h3 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 900;
  color: #f4fbff;
}

.note-card__content p,
.advice-copy p {
  margin: 0;
  color: var(--text-body-soft);
  font-size: 18px;
  line-height: 1.7;
}

.note-card__actions,
.advice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}


/* ============ BOTTOM NAVIGATION (Mobile) ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--transition);
}

/* Hide bottom-nav on desktop */
@media (min-width: 1180px) {
  .bottom-nav {
    display: none;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  transition: all var(--transition);
  min-width: 52px;
  -webkit-tap-highlight-color: transparent;
}

.nav-item i {
  font-size: 20px;
  transition: color var(--transition), transform var(--transition);
}

.nav-item span {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  line-height: 1.2;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active i {
  transform: translateY(-2px);
}

/* Center FAB (mobile) */
.nav-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: var(--shadow-accent);
  cursor: pointer;
  border: none;
  transition: transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.nav-fab:active {
  transform: scale(0.9);
}

/* ============ DESKTOP + MOBILE SIDEBAR NAVIGATION ============ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: min(86vw, 320px);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-secondary) 92%, rgba(10, 14, 24, 0.35));
  border-right: 1px solid var(--border);
  box-shadow: 0 28px 70px rgba(3, 8, 20, 0.32);
  z-index: 260;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(-104%);
  transition: transform 0.32s ease, background var(--transition), border-color var(--transition);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(5, 10, 18, 0.58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  z-index: 250;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sidebar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.sidebar-open {
  overflow: hidden;
}

.sidebar-mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-secondary) 92%, transparent);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.sidebar-logo-mobile {
  flex: 1;
  min-width: 0;
}

.sidebar-logo-desktop {
  display: none;
}

.sidebar-close-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: all var(--transition);
}

.sidebar-close-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.sidebar-logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}

.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.sidebar-section {
  padding: 16px 12px 8px;
  flex: 1;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.sidebar-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.sidebar-item i {
  width: 20px;
  font-size: 16px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-theme-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.sidebar-theme-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-theme-btn i {
  width: 20px;
  font-size: 16px;
  text-align: center;
}

@media (min-width: 1180px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(0);
    box-shadow: none;
    background: var(--bg-secondary);
    z-index: 200;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar-overlay,
  .sidebar-mobile-topbar {
    display: none;
  }

  body.sidebar-open {
    overflow: auto;
  }

  .sidebar-logo-desktop {
    display: flex;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
  }
}


/* ============ CTA BANNER ============ */
.cta-banner {
  margin: 8px 20px 20px;
  background: linear-gradient(135deg, #FF6B35 0%, #FF9F1C 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '\f44b';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 100px;
  color: rgba(255,255,255,0.12);
  pointer-events: none;
}

.cta-banner h3 {
  color: white;
  font-size: 22px;
  margin-bottom: 8px;
}

.cta-banner p {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-cta {
  background: white;
  color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

.btn-cta:active {
  transform: scale(0.97);
}

/* ============ PROGRESS BAR ============ */
.progress-bar-wrapper {
  background: var(--bg-input);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.6s ease;
}

/* ============ PERCENTAGE TABLE ============ */
.percent-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.percent-table th,
.percent-table td {
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.percent-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.percent-table tr:last-child td {
  border-bottom: none;
}

.percent-table .highlight td {
  color: var(--accent);
  font-weight: 700;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 0 0 var(--nav-height);
  animation: fadeSlideIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 32px 24px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s ease-out;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 24px;
}

/* ============ TOGGLE SWITCH ============ */
.toggle-switch {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: transform var(--transition);
}

.toggle-switch.on .toggle-thumb {
  transform: translateX(24px);
}

/* ============ INFORMATIONAL ROWS ============ */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.info-item:last-child {
  border-bottom: none;
}

.info-item-label {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-item-label i {
  width: 20px;
  color: var(--accent);
  font-size: 14px;
}

.info-item-value {
  font-weight: 700;
  font-size: 15px;
}

/* ============ SEARCH BAR ============ */
.search-wrapper {
  margin: 12px 20px 4px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  padding: 13px 16px 13px 44px;
  transition: border-color var(--transition);
  font-family: var(--font-body);
}

.search-input:focus {
  border-color: var(--accent);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

/* ============ DONUT CHART ============ */
.donut-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
}

.donut-labels {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.donut-label-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.donut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============ DISCLAIMER ============ */
.disclaimer {
  background: rgba(255,193,7,0.1);
  border: 1px solid rgba(255,193,7,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--warning);
  line-height: 1.6;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
}

/* ============ AVATAR ============ */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
  cursor: pointer;
}

/* ============ SECTION DIVIDER ============ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ============ PILL TABS ============ */
.pill-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.pill-tab {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
  text-align: center;
}

.pill-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ============ SCROLLABLE CONTENT ============ */
.scroll-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============ NOTIFICATION BADGE ============ */
.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 8px;
  right: 8px;
  border: 2px solid var(--bg-primary);
}
