/* Calculator styles: roi */

/* ====================================
   ROI Calculator - Clean Modern Design
   ==================================== */

/* Form container */
.roi-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section styling */
.roi-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.roi-section__header {
  gap: 12px;
  min-width: 0;
}

.roi-section__title {
  color: var(--sc-accent, #3b82f6);
}

/* Grid layouts */
.roi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.roi-grid--optional-details {
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
  min-width: 0;
}

.roi-grid--optional-details > .roi-field:nth-child(1) {
  grid-column: 1 / -1;
  grid-row: 1;
}

.roi-grid--optional-details > .roi-field:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.roi-grid--optional-details > .roi-field:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

/* Field styling */
.roi-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.roi-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sc-card-text, #374151);
}

.roi-field input,
.roi-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 8px;
  background: var(--sc-input-bg, #fff);
  color: var(--sc-card-text, #111827);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.roi-field input:focus,
.roi-field select:focus {
  outline: none;
  border-color: var(--sc-accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.roi-field input::placeholder {
  color: var(--sc-muted-text, #9ca3af);
}

.roi-field input:disabled,
.roi-field select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Duration input with unit select */
.roi-duration-input {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.roi-duration-input > .vareoncalc-stepper,
.roi-duration-input > input,
.roi-duration-input > .vareoncalc-input-adorned {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.roi-duration-input > select {
  flex: 0 0 116px;
  width: 116px;
  min-width: 116px;
}

/* ====================================
   Result Panel: The Scoreboard
   ==================================== */
.vareoncalc-roi-result {
  display: flex;
  flex-direction: column;
  background: var(--sc-input-bg, #f9fafb);
  border-radius: 12px;
  overflow: hidden;
}

/* Placeholder state */
.vareoncalc-roi-result__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 320px;
  text-align: center;
  padding: var(--sc-card-padding);
  gap: 12px;
}

.vareoncalc-roi-result__placeholder .placeholder-icon {
  font-size: 48px;
  opacity: 0.8;
}

.vareoncalc-roi-result__placeholder .placeholder-text {
  font-size: 14px;
  color: var(--sc-muted-text, #6b7280);
  max-width: 200px;
}

/* Results content */
.vareoncalc-roi-result__content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Error display */
.vareoncalc-roi-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  min-height: 320px;
  padding: var(--sc-card-padding);
  gap: 12px;
}

.vareoncalc-roi-error .error-icon {
  font-size: 36px;
  opacity: 0.8;
}

.vareoncalc-roi-error .error-text {
  font-size: 14px;
  color: var(--sc-error, #dc2626);
  font-weight: 500;
  max-width: 280px;
}

/* The Headline: Massive ROI Percentage */
.roi-result-headline {
  padding: var(--sc-card-padding);
  text-align: center;
  background: var(--sc-card-bg, #fff);
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.roi-percentage {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
}

.roi-percentage--profit {
  color: var(--sc-success, #10b981);
}

.roi-percentage--loss {
  color: var(--sc-error, #dc2626);
}

.roi-multiplier {
  font-size: 16px;
  font-weight: 600;
  color: var(--sc-muted-text, #6b7280);
  margin-top: 6px;
  display: none;
}

/* Visual Bar: Investment Growth Waterfall */
.roi-visual-bar {
  padding: var(--sc-card-padding);
  flex: 1;
}

.roi-visual-bar__header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 14px;
}

.roi-visual-bar__track {
  display: flex;
  width: 100%;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sc-card-border, #e5e7eb);
}

.roi-visual-bar__initial {
  height: 100%;
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  transition: width 0.5s ease-out;
  border-radius: 8px 0 0 8px;
}

.roi-visual-bar__profit {
  height: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  transition: width 0.5s ease-out;
  border-radius: 0 8px 8px 0;
}

.roi-visual-bar__profit--loss {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* When only initial investment (no growth) */
.roi-visual-bar__initial:only-child,
.roi-visual-bar__profit[style*="width: 0"]+.roi-visual-bar__initial {
  border-radius: 8px;
}

/* Bar Labels */
.roi-visual-bar__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}

.roi-bar-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roi-bar-label--initial {
  align-items: flex-start;
}

.roi-bar-label--profit {
  align-items: center;
  flex: 1;
}

.roi-bar-label--total {
  align-items: flex-end;
}

.roi-bar-label__title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sc-muted-text, #6b7280);
}

.roi-bar-label__value {
  font-size: 13px;
  font-weight: 700;
  color: var(--sc-card-text, #111827);
  white-space: nowrap;
}

.roi-bar-label__value--profit {
  color: var(--sc-success, #10b981);
}

.roi-bar-label__value--loss {
  color: var(--sc-error, #dc2626);
}

/* Annualized + Real ROI Cards Row */
.roi-metrics-row {
  display: flex;
  gap: 12px;
  margin: 0 20px 20px;
}

.roi-speed-metric,
.roi-real-metric {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 12px;
}

.roi-speed-metric__icon,
.roi-real-metric__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.roi-speed-metric__icon {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
}

.roi-real-metric__icon {
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
}

.roi-speed-metric__icon svg,
.roi-real-metric__icon svg {
  width: 20px;
  height: 20px;
}

.roi-speed-metric__content,
.roi-real-metric__content {
  flex: 1;
  min-width: 0;
}

.roi-speed-metric__label,
.roi-real-metric__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sc-muted-text, #6b7280);
  line-height: 1.3;
}

.roi-speed-metric__value,
.roi-real-metric__value {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.roi-speed-metric__value--profit,
.roi-real-metric__value--profit {
  color: var(--sc-success, #10b981);
}

.roi-speed-metric__value--loss,
.roi-real-metric__value--loss {
  color: var(--sc-error, #dc2626);
}

.roi-speed-metric__duration {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--sc-muted-text, #6b7280);
  background: var(--sc-input-bg, #f1f5f9);
  padding: 4px 10px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Break-Even Requirement */
.roi-break-even {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 20px 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--sc-panel-warning-soft-bg, #fef3c7) 0%, var(--sc-panel-warning-bg, #fde68a) 100%);
  border: 1px solid var(--sc-panel-warning-border, #fcd34d);
  border-radius: 10px;
  color: var(--sc-panel-warning-text, #78350f);
}

.roi-break-even__icon {
  font-size: 24px;
  flex-shrink: 0;
}

.roi-break-even__content {
  flex: 1;
}

.roi-break-even__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sc-panel-warning-text, #78350f);
  opacity: 0.8;
}

.roi-break-even__value {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

/* Cost Note */
.roi-cost-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 16px;
  padding: 10px 14px;
  background: var(--sc-panel-warning-bg, #fef3c7);
  border: 1px solid var(--sc-panel-warning-border, #fcd34d);
  border-radius: 8px;
  font-size: 12px;
  color: var(--sc-panel-warning-text, #78350f);
}

.roi-cost-note__icon {
  font-size: 14px;
}

/* ====================================
   Dark Theme
   ==================================== */
.vareoncalc-root[data-theme="dark"] .roi-section__title,
.vareoncalc-root.theme-dark .roi-section__title {
  color: var(--sc-accent, #60a5fa);
}

.vareoncalc-root[data-theme="dark"] .roi-field label,
.vareoncalc-root.theme-dark .roi-field label {
  color: var(--sc-card-text, #e5e7eb);
}

.vareoncalc-root[data-theme="dark"] .roi-field input,
.vareoncalc-root[data-theme="dark"] .roi-field select,
.vareoncalc-root.theme-dark .roi-field input,
.vareoncalc-root.theme-dark .roi-field select {
  background: var(--sc-input-bg, #1f2937);
  border-color: var(--sc-card-border, #374151);
  color: var(--sc-card-text, #f3f4f6);
}

.vareoncalc-root[data-theme="dark"] .roi-field input::placeholder,
.vareoncalc-root.theme-dark .roi-field input::placeholder {
  color: var(--sc-muted-text, #6b7280);
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-roi-result,
.vareoncalc-root.theme-dark .vareoncalc-roi-result {
  background: var(--sc-input-bg, #1f2937);
}

.vareoncalc-root[data-theme="dark"] .roi-result-headline,
.vareoncalc-root.theme-dark .roi-result-headline {
  background: var(--sc-card-bg, #111827);
  border-color: var(--sc-card-border, #374151);
}

.vareoncalc-root[data-theme="dark"] .roi-visual-bar__track,
.vareoncalc-root.theme-dark .roi-visual-bar__track {
  background: var(--sc-card-border, #374151);
}

.vareoncalc-root[data-theme="dark"] .roi-visual-bar__initial,
.vareoncalc-root.theme-dark .roi-visual-bar__initial {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.vareoncalc-root[data-theme="dark"] .roi-speed-metric,
.vareoncalc-root.theme-dark .roi-speed-metric,
.vareoncalc-root[data-theme="dark"] .roi-real-metric,
.vareoncalc-root.theme-dark .roi-real-metric {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root[data-theme="dark"] .roi-speed-metric__icon,
.vareoncalc-root.theme-dark .roi-speed-metric__icon {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.vareoncalc-root[data-theme="dark"] .roi-real-metric__icon,
.vareoncalc-root.theme-dark .roi-real-metric__icon {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.vareoncalc-root[data-theme="dark"] .roi-speed-metric__duration,
.vareoncalc-root.theme-dark .roi-speed-metric__duration {
  background: rgba(255, 255, 255, 0.08);
}

.vareoncalc-root[data-theme="dark"] .roi-break-even,
.vareoncalc-root.theme-dark .roi-break-even {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.vareoncalc-root[data-theme="dark"] .roi-break-even__label,
.vareoncalc-root.theme-dark .roi-break-even__label {
  color: #fcd34d;
}

.vareoncalc-root[data-theme="dark"] .roi-cost-note,
.vareoncalc-root.theme-dark .roi-cost-note {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.vareoncalc-root[data-theme="dark"] .vareoncalc-roi-error .error-text,
.vareoncalc-root.theme-dark .vareoncalc-roi-error .error-text {
  color: #f87171;
}

/* ====================================
   Responsive
   ==================================== */
@media (max-width: 520px) {
  .roi-grid {
    grid-template-columns: 1fr;
  }

  .roi-section--optional,
  .roi-optional-content,
  .roi-grid--optional-details,
  .roi-grid--optional-details > .roi-field,
  .roi-duration-input {
    min-width: 0;
  }

  .roi-grid--optional-details {
    grid-template-columns: 1fr;
  }

  .roi-grid--optional-details > .roi-field,
  .roi-grid--optional-details > .roi-field:nth-child(1),
  .roi-grid--optional-details > .roi-field:nth-child(2),
  .roi-grid--optional-details > .roi-field:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
  }

  .roi-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .roi-section__header > * {
    min-width: 0;
    max-width: 100%;
  }

  .roi-optional-accordion {
    max-width: 100%;
  }

  .roi-duration-input {
    flex-direction: column;
    align-items: stretch;
  }

  .roi-duration-input > select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .roi-percentage {
    font-size: 36px;
  }

  .roi-visual-bar {
    padding: 16px;
  }

  .roi-visual-bar__labels {
    flex-direction: column;
    gap: 8px;
  }

  .roi-bar-label {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .roi-bar-label--initial,
  .roi-bar-label--profit,
  .roi-bar-label--total {
    align-items: center;
  }

  .roi-metrics-row {
    flex-direction: column;
    margin: 0 16px 16px;
  }

  .roi-speed-metric {
    flex-wrap: wrap;
  }

  .roi-speed-metric__content {
    min-width: calc(100% - 50px);
  }

  .roi-speed-metric__icon,
  .roi-real-metric__icon {
    width: 34px;
    height: 34px;
  }

  .roi-speed-metric__icon svg,
  .roi-real-metric__icon svg {
    width: 17px;
    height: 17px;
  }

  .roi-break-even {
    flex-wrap: wrap;
    margin: 0 16px 16px;
  }
}

@media (max-width: 410px) {
  .roi-visual-bar {
    padding: 14px;
  }

  .roi-metrics-row {
    margin: 0 14px 14px;
    gap: 10px;
  }

  .roi-speed-metric,
  .roi-real-metric {
    padding: 12px 14px;
    gap: 10px;
  }

  .roi-speed-metric__icon,
  .roi-real-metric__icon {
    width: 30px;
    height: 30px;
  }

  .roi-speed-metric__icon svg,
  .roi-real-metric__icon svg {
    width: 15px;
    height: 15px;
  }

  .roi-break-even {
    margin: 0 14px 14px;
    padding: 12px 14px;
    gap: 10px;
  }

  .roi-cost-note {
    margin: 0 14px 14px;
  }

  .roi-percentage {
    font-size: 34px;
  }

  .roi-speed-metric__value,
  .roi-real-metric__value {
    font-size: 16px;
  }

  .roi-bar-label__value {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .roi-visual-bar {
    padding: 12px;
  }

  .roi-metrics-row {
    margin: 0 12px 12px;
    gap: 8px;
  }

  .roi-speed-metric,
  .roi-real-metric {
    padding: 10px 12px;
  }

  .roi-break-even {
    margin: 0 12px 12px;
    padding: 10px 12px;
  }

  .roi-cost-note {
    margin: 0 12px 12px;
    padding: 8px 10px;
  }

  .roi-percentage {
    font-size: 28px;
  }

  .roi-speed-metric__value,
  .roi-real-metric__value {
    font-size: 15px;
  }

  .roi-speed-metric__label,
  .roi-real-metric__label,
  .roi-break-even__label {
    font-size: 10px;
  }

  .roi-bar-label__title {
    font-size: 9px;
  }

  .roi-bar-label__value {
    font-size: 11px;
  }
}

@container vareoncalc (max-width: 520px) {
  .roi-grid {
    grid-template-columns: 1fr;
  }

  .roi-section--optional,
  .roi-optional-content,
  .roi-grid--optional-details,
  .roi-grid--optional-details > .roi-field,
  .roi-duration-input {
    min-width: 0;
  }

  .roi-grid--optional-details {
    grid-template-columns: 1fr;
  }

  .roi-grid--optional-details > .roi-field,
  .roi-grid--optional-details > .roi-field:nth-child(1),
  .roi-grid--optional-details > .roi-field:nth-child(2),
  .roi-grid--optional-details > .roi-field:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
  }

  .roi-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .roi-section__header > * {
    min-width: 0;
    max-width: 100%;
  }

  .roi-optional-accordion {
    max-width: 100%;
  }

  .roi-duration-input {
    flex-direction: column;
    align-items: stretch;
  }

  .roi-duration-input > select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  .roi-percentage {
    font-size: 36px;
  }

  .roi-visual-bar {
    padding: 16px;
  }

  .roi-visual-bar__labels {
    flex-direction: column;
    gap: 8px;
  }

  .roi-bar-label {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .roi-bar-label--initial,
  .roi-bar-label--profit,
  .roi-bar-label--total {
    align-items: center;
  }

  .roi-metrics-row {
    flex-direction: column;
    margin: 0 16px 16px;
  }

  .roi-speed-metric {
    flex-wrap: wrap;
  }

  .roi-speed-metric__content {
    min-width: calc(100% - 50px);
  }

  .roi-speed-metric__icon,
  .roi-real-metric__icon {
    width: 34px;
    height: 34px;
  }

  .roi-speed-metric__icon svg,
  .roi-real-metric__icon svg {
    width: 17px;
    height: 17px;
  }

  .roi-break-even {
    flex-wrap: wrap;
    margin: 0 16px 16px;
  }
}

@container vareoncalc (max-width: 410px) {
  .roi-visual-bar {
    padding: 14px;
  }

  .roi-metrics-row {
    margin: 0 14px 14px;
    gap: 10px;
  }

  .roi-speed-metric,
  .roi-real-metric {
    padding: 12px 14px;
    gap: 10px;
  }

  .roi-speed-metric__icon,
  .roi-real-metric__icon {
    width: 30px;
    height: 30px;
  }

  .roi-speed-metric__icon svg,
  .roi-real-metric__icon svg {
    width: 15px;
    height: 15px;
  }

  .roi-break-even {
    margin: 0 14px 14px;
    padding: 12px 14px;
    gap: 10px;
  }

  .roi-cost-note {
    margin: 0 14px 14px;
  }

  .roi-percentage {
    font-size: 34px;
  }

  .roi-speed-metric__value,
  .roi-real-metric__value {
    font-size: 16px;
  }

  .roi-bar-label__value {
    font-size: 12px;
  }
}

@container vareoncalc (max-width: 360px) {
  .roi-visual-bar {
    padding: 12px;
  }

  .roi-metrics-row {
    margin: 0 12px 12px;
    gap: 8px;
  }

  .roi-speed-metric,
  .roi-real-metric {
    padding: 10px 12px;
  }

  .roi-break-even {
    margin: 0 12px 12px;
    padding: 10px 12px;
  }

  .roi-cost-note {
    margin: 0 12px 12px;
    padding: 8px 10px;
  }

  .roi-percentage {
    font-size: 28px;
  }

  .roi-speed-metric__value,
  .roi-real-metric__value {
    font-size: 15px;
  }

  .roi-speed-metric__label,
  .roi-real-metric__label,
  .roi-break-even__label {
    font-size: 10px;
  }

  .roi-bar-label__title {
    font-size: 9px;
  }

  .roi-bar-label__value {
    font-size: 11px;
  }
}
