/* Calculator styles: tip */

/* Layout: tip form sections */
.tip-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.tip-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-field>input,
.tip-field>select {
  width: 100%;
  margin-bottom: 0;
}

.tip-field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

.tip-field--full {
  grid-column: 1 / -1;
}

.tip-actions {
  margin-top: 4px;
}

.tip-actions .vareoncalc-btn {
  width: 100%;
}

@media (max-width: 640px) {
  .tip-grid {
    grid-template-columns: 1fr;
  }
}

/* Tip preset toggle group */
.vareoncalc-tip-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vareoncalc-tip-presets .tip-preset {
  flex: 1;
  min-width: 52px;
  padding: 10px 14px;
  border: 2px solid var(--sc-card-border, #e5e7eb);
  background: var(--sc-card-bg, #ffffff);
  color: var(--sc-card-text, #111827);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  text-align: center;
}

.vareoncalc-tip-presets .tip-preset:hover {
  border-color: var(--sc-accent, #3b82f6);
  background: var(--sc-input-bg, #f9fafb);
}

.vareoncalc-tip-presets .tip-preset--active {
  background: var(--sc-accent, #3b82f6);
  border-color: var(--sc-accent, #3b82f6);
  color: #ffffff;
}

.vareoncalc-tip-presets .tip-preset--active:hover {
  background: var(--sc-accent, #3b82f6);
  border-color: var(--sc-accent, #3b82f6);
}

/* ── Tip Results: Hero ── */
.tip-results__hero {
  text-align: center;
  padding: 20px var(--sc-card-padding, 16px) 16px;
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.tip-results__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 4px;
}

.tip-results__amount {
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 800;
  color: var(--sc-card-text, #111827);
  line-height: 1.1;
  margin-bottom: 12px;
}

.tip-results__bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto 8px;
  max-width: 240px;
}

.tip-results__bar-bill {
  background: var(--sc-card-text, #111827);
  opacity: 0.18;
  transition: width 0.3s ease;
}

.tip-results__bar-tip {
  background: #10b981;
  transition: width 0.3s ease;
}

.tip-results__bar-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11px;
  color: var(--sc-muted-text, #6b7280);
}

.tip-results__legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.tip-results__legend-dot--bill {
  background: var(--sc-card-text, #111827);
  opacity: 0.22;
}

.tip-results__legend-dot--tip {
  background: #10b981;
}

/* ── Tip Results: Detail Rows ── */
.tip-results__details {
  padding: 14px var(--sc-card-padding, 16px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tip-results__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.tip-results__row-label {
  color: var(--sc-muted-text, #6b7280);
}

.tip-results__row-value {
  color: var(--sc-card-text, #111827);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tip-results__row--accent .tip-results__row-value {
  color: #10b981;
  font-weight: 600;
}

.tip-results__divider {
  border: none;
  border-top: 1px dashed var(--sc-card-border, #e5e7eb);
  margin: 2px 0;
}

.tip-results__row--total .tip-results__row-label {
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

.tip-results__row--total .tip-results__row-value {
  font-weight: 700;
  font-size: 15px;
}

/* ── Tip Results: Smart Rounding ── */
.tip-results__rounding {
  border-top: 1px dashed var(--sc-card-border, #e5e7eb);
  padding: 12px var(--sc-card-padding, 16px);
  text-align: center;
}

.tip-results__rounding-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 8px;
}

.tip-results__rounding-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tip-results__round-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--sc-card-border, #e5e7eb);
  background: var(--sc-card-bg, #ffffff);
  color: var(--sc-card-text, #111827);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tip-results__round-btn:hover {
  border-color: var(--sc-accent, #3b82f6);
  background: var(--sc-input-bg, #f9fafb);
}

.tip-results__round-btn svg {
  color: var(--sc-muted-text, #6b7280);
  flex-shrink: 0;
}

/* ── Tip Results: Split / Per Person ── */
.tip-results__split {
  background: #ecfdf5;
  border-top: 1px solid #a7f3d0;
  border-radius: 0 0 8px 8px;
  padding: 14px var(--sc-card-padding, 16px) 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tip-results__split-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tip-results__split-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(5, 150, 105, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #059669;
}

.tip-results__split-icon svg {
  width: 18px;
  height: 18px;
}

.tip-results__split-amount {
  font-size: 20px;
  font-weight: 700;
  color: #059669;
  line-height: 1.2;
}

.tip-results__split-label {
  font-size: 12px;
  color: #10b981;
  font-weight: 500;
}

.tip-results__split-adjust {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #a7f3d0;
  border-radius: 20px;
  padding: 3px 5px;
  flex-shrink: 0;
}

.tip-results__adj-btn {
  background: none;
  border: none;
  color: #059669;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}

.tip-results__adj-btn:hover:not(:disabled) {
  background: #d1fae5;
}

.tip-results__adj-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tip-results__adj-count {
  font-size: 14px;
  font-weight: 600;
  color: #047857;
  min-width: 18px;
  text-align: center;
}

/* ── Tip Results: Footer / Copy (inside green split) ── */
.tip-results__footer {
  flex-basis: 100%;
  display: flex;
  justify-content: center;
  padding: 4px 0 0;
  border-top: 1px solid rgba(5, 150, 105, 0.12);
  margin-top: 2px;
}

.tip-results__copy-btn {
  background: none;
  border: none;
  color: #059669;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.tip-results__copy-btn:hover {
  background: rgba(5, 150, 105, 0.1);
}

/* ── Tip: Dark Theme ── */
.vareoncalc-root[data-theme="dark"] .vareoncalc-tip-presets .tip-preset,
.vareoncalc-root.theme-dark .vareoncalc-tip-presets .tip-preset {
  background: var(--sc-card-bg, #1f2937);
  border-color: var(--sc-card-border, #374151);
  color: var(--sc-card-text, #f9fafb);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-tip-presets .tip-preset:hover,
.vareoncalc-root.theme-dark .vareoncalc-tip-presets .tip-preset:hover {
  border-color: var(--sc-accent, #3b82f6);
  background: var(--sc-input-bg, #111827);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-tip-presets .tip-preset--active,
.vareoncalc-root.theme-dark .vareoncalc-tip-presets .tip-preset--active {
  background: var(--sc-accent, #3b82f6);
  border-color: var(--sc-accent, #3b82f6);
  color: #ffffff;
}

.vareoncalc-root[data-theme="dark"] .tip-results__bar-bill,
.vareoncalc-root.theme-dark .tip-results__bar-bill {
  background: var(--sc-card-text, #f9fafb);
  opacity: 0.15;
}

.vareoncalc-root[data-theme="dark"] .tip-results__legend-dot--bill,
.vareoncalc-root.theme-dark .tip-results__legend-dot--bill {
  background: var(--sc-card-text, #f9fafb);
  opacity: 0.25;
}

.vareoncalc-root[data-theme="dark"] .tip-results__divider,
.vareoncalc-root.theme-dark .tip-results__divider {
  border-top-color: var(--sc-card-border, #374151);
}

.vareoncalc-root[data-theme="dark"] .tip-results__row--accent .tip-results__row-value,
.vareoncalc-root.theme-dark .tip-results__row--accent .tip-results__row-value {
  color: #34d399;
}

.vareoncalc-root[data-theme="dark"] .tip-results__round-btn,
.vareoncalc-root.theme-dark .tip-results__round-btn {
  background: var(--sc-panel-bg, #1b2435);
  border-color: var(--sc-card-border, #374151);
  color: var(--sc-card-text, #f9fafb);
}

.vareoncalc-root[data-theme="dark"] .tip-results__round-btn:hover,
.vareoncalc-root.theme-dark .tip-results__round-btn:hover {
  border-color: var(--sc-accent, #60a5fa);
}

.vareoncalc-root[data-theme="dark"] .tip-results__split,
.vareoncalc-root.theme-dark .tip-results__split {
  background: rgba(16, 185, 129, 0.12);
  border-top-color: rgba(16, 185, 129, 0.25);
}

.vareoncalc-root[data-theme="dark"] .tip-results__split-icon,
.vareoncalc-root.theme-dark .tip-results__split-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.vareoncalc-root[data-theme="dark"] .tip-results__split-amount,
.vareoncalc-root.theme-dark .tip-results__split-amount {
  color: #34d399;
}

.vareoncalc-root[data-theme="dark"] .tip-results__split-label,
.vareoncalc-root.theme-dark .tip-results__split-label {
  color: #6ee7b7;
}

.vareoncalc-root[data-theme="dark"] .tip-results__split-adjust,
.vareoncalc-root.theme-dark .tip-results__split-adjust {
  background: transparent;
  border-color: rgba(52, 211, 153, 0.35);
}

.vareoncalc-root[data-theme="dark"] .tip-results__adj-btn,
.vareoncalc-root.theme-dark .tip-results__adj-btn {
  color: #34d399;
}

.vareoncalc-root[data-theme="dark"] .tip-results__adj-btn:hover:not(:disabled),
.vareoncalc-root.theme-dark .tip-results__adj-btn:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.18);
}

.vareoncalc-root[data-theme="dark"] .tip-results__adj-count,
.vareoncalc-root.theme-dark .tip-results__adj-count {
  color: #6ee7b7;
}

.vareoncalc-root[data-theme="dark"] .tip-results__footer,
.vareoncalc-root.theme-dark .tip-results__footer {
  border-top-color: rgba(52, 211, 153, 0.15);
}

.vareoncalc-root[data-theme="dark"] .tip-results__copy-btn,
.vareoncalc-root.theme-dark .tip-results__copy-btn {
  color: #6ee7b7;
}

.vareoncalc-root[data-theme="dark"] .tip-results__copy-btn:hover,
.vareoncalc-root.theme-dark .tip-results__copy-btn:hover {
  background: rgba(52, 211, 153, 0.12);
}

/* ── Tip: Responsive ── */
@media (max-width: 410px) {
  .tip-form,
  .tip-grid {
    gap: 8px;
  }

  .vareoncalc-tip-presets {
    gap: 6px;
  }

  .vareoncalc-tip-presets .tip-preset {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    padding: 9px 10px;
  }

  .tip-results__split {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .tip-results__split-main {
    flex-direction: column;
    align-items: center;
  }

  .tip-results__split-icon {
    width: 32px;
    height: 32px;
  }

  .tip-results__split-icon svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 360px) {
  .vareoncalc-tip-presets .tip-preset {
    flex-basis: 100%;
  }
}

@container vareoncalc (max-width: 410px) {
  .tip-form,
  .tip-grid {
    gap: 8px;
  }

  .vareoncalc-tip-presets {
    gap: 6px;
  }

  .vareoncalc-tip-presets .tip-preset {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    padding: 9px 10px;
  }

  .tip-results__split {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .tip-results__split-main {
    flex-direction: column;
    align-items: center;
  }

  .tip-results__split-icon {
    width: 32px;
    height: 32px;
  }

  .tip-results__split-icon svg {
    width: 16px;
    height: 16px;
  }
}

@container vareoncalc (max-width: 360px) {
  .vareoncalc-tip-presets .tip-preset {
    flex-basis: 100%;
  }
}
