/* Calculator styles: percentage */

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

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

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

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

.percentage-field--static .percentage-static {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--sc-input-border, #d1d5db);
  border-radius: 10px;
  background: var(--sc-input-bg, #f9fafb);
  color: var(--sc-card-text, #111827);
  font-size: 13px;
  font-weight: 600;
}

/* Sentence Builder: natural language input layout */
.vareoncalc-sentence-builder {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 0;
}

.vareoncalc-sentence-builder .percentage-field {
  flex: 1;
  min-width: 0;
}

.vareoncalc-sentence-builder .percentage-field label {
  display: block;
  margin-bottom: 8px;
}

.vareoncalc-sentence-connector {
  flex-shrink: 0;
  align-self: center;
  position: relative;
  top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--sc-muted-text, #6b7280);
  white-space: nowrap;
}

.vareoncalc-mode-header label {
  font-weight: 600;
  font-size: 15px;
  color: var(--sc-card-text, #111827);
}

/* Blackboard: Teacher's Note / Math Explanation panel */
.vareoncalc-blackboard {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--sc-input-bg, #f9fafb);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  min-height: 280px;
}

.vareoncalc-blackboard--placeholder {
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--sc-muted-text, #6b7280);
  font-size: 14px;
  padding: var(--sc-card-padding);
}

.vareoncalc-blackboard--placeholder .placeholder-icon {
  font-size: 48px;
  opacity: 0.4;
  margin-bottom: 12px;
}

.vareoncalc-blackboard--placeholder .placeholder-text {
  opacity: 0.7;
}

/* Blackboard headline: The Big Answer */
.blackboard-headline {
  padding: var(--sc-card-padding);
  text-align: center;
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
  background: var(--sc-card-bg, #ffffff);
}

.blackboard-answer {
  font-size: 42px;
  font-weight: 700;
  color: var(--vareoncalc-accent, #3b82f6);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.blackboard-answer--positive {
  color: #10b981;
}

.blackboard-answer--negative {
  color: #dc2626;
}

.blackboard-answer--ratio {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 2px;
}

.blackboard-label {
  font-size: 13px;
  color: var(--sc-muted-text, #6b7280);
  margin-top: 6px;
  line-height: 1.4;
}

/* Blackboard breakdown: Additional values */
.blackboard-breakdown {
  padding: var(--sc-card-padding);
  font-size: 13px;
  line-height: 1.6;
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.breakdown-row--bold .breakdown-value {
  font-weight: 700;
  font-size: 14px;
}

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

.breakdown-value {
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

.breakdown-value--positive {
  color: #10b981;
}

.breakdown-value--negative {
  color: #dc2626;
}

/* Formula Card: The "Why" - textbook style */
.blackboard-formula-card {
  margin: 16px;
  padding: var(--sc-card-padding);
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  flex: 1;
}

.formula-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.formula-icon {
  font-size: 18px;
  opacity: 0.8;
}

.formula-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sc-muted-text, #6b7280);
}

.formula-expression {
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--sc-card-text, #111827);
  background: var(--sc-input-bg, #f9fafb);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow-x: auto;
}

.formula-explanation {
  font-size: 12px;
  color: var(--sc-muted-text, #6b7280);
  line-height: 1.5;
  font-style: italic;
}

/* Ratio-specific: percentage bars */
.blackboard-percentages {
  padding: var(--sc-card-padding);
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.percentage-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 12px;
}

.percentage-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.percentage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  width: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sc-card-text, #111827);
  text-align: center;
}

.bar-track {
  flex: 1;
  height: 12px;
  background: var(--sc-card-border, #e5e7eb);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease-out;
}

.bar-fill--a {
  background: var(--vareoncalc-accent, #3b82f6);
}

.bar-fill--b {
  background: #10b981;
}

.bar-value {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--sc-card-text, #111827);
}

.percentage-total {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--sc-card-border, #e5e7eb);
  font-size: 13px;
  color: var(--sc-muted-text, #6b7280);
}

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

/* Educational tip box */
.blackboard-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 16px 16px;
  padding: 12px;
  background: var(--sc-panel-info-soft-bg, #eff6ff);
  border: 1px solid var(--sc-panel-info-border, #bfdbfe);
  border-radius: 8px;
  font-size: 12px;
  color: var(--sc-panel-info-text, #1e40af);
}

.blackboard-tip .tip-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.blackboard-tip .tip-text {
  line-height: 1.5;
}

/* Dark theme: Blackboard adjustments */
.vareoncalc-root[data-theme="dark"] .vareoncalc-blackboard,
.vareoncalc-root.theme-dark .vareoncalc-blackboard {
  background: var(--sc-input-bg, #1f2937);
}

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

.vareoncalc-root[data-theme="dark"] .blackboard-formula-card,
.vareoncalc-root.theme-dark .blackboard-formula-card {
  background: var(--sc-card-bg, #111827);
  border-color: var(--sc-card-border, #374151);
  box-shadow: none;
}

.vareoncalc-root[data-theme="dark"] .formula-title,
.vareoncalc-root.theme-dark .formula-title {
  color: var(--sc-muted-text, #9ca3af);
}

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

.vareoncalc-root[data-theme="dark"] .formula-explanation,
.vareoncalc-root.theme-dark .formula-explanation {
  color: var(--sc-muted-text, #9ca3af);
}

.vareoncalc-root[data-theme="dark"] .blackboard-tip,
.vareoncalc-root.theme-dark .blackboard-tip {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

/* Responsive: stack sentence builder on phones */
@media (max-width: 576px) {
  .vareoncalc-sentence-builder {
    flex-direction: column;
    align-items: stretch;
  }

  .vareoncalc-sentence-connector {
    display: none;
  }

  .blackboard-answer {
    font-size: 32px;
  }

  .formula-expression {
    font-size: 13px;
  }
}

@media (max-width: 410px) {
  .vareoncalc-sentence-builder {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .vareoncalc-sentence-connector {
    top: 0;
    min-height: 0;
    padding: 0;
    justify-content: flex-start;
  }

  .blackboard-headline {
    padding: var(--sc-card-padding);
  }

  .blackboard-answer {
    font-size: 36px;
  }
}

@media (max-width: 360px) {
  .blackboard-answer {
    font-size: 32px;
  }
}

@container vareoncalc (max-width: 410px) {
  .vareoncalc-sentence-builder {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .vareoncalc-sentence-connector {
    top: 0;
    min-height: 0;
    padding: 0;
    justify-content: flex-start;
  }

  .blackboard-headline {
    padding: var(--sc-card-padding);
  }

  .blackboard-answer {
    font-size: 36px;
  }
}

@container vareoncalc (max-width: 360px) {
  .blackboard-answer {
    font-size: 32px;
  }
}
