/* Layout */
.calc {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

/* Mobile-first grid - single column on small screens */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Two columns on tablets and up */
@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.card {
  border: 1px solid #444;
  border-radius: 12px;
  padding: 16px;
  background: transparent;
}

/* Mobile: increase padding */
@media (max-width: 599px) {
  .card {
    padding: 12px;
  }

  .calc {
    padding: 0.5rem;
  }
}

.card.out.highlight {
  border: 2px solid #666;
  background: rgba(255, 255, 255, 0.03);
}

.card.out.highlight strong {
  font-size: 1.3em;
}

.card.out.highlight.positive {
  border-color: #55c173;
  background: rgba(85, 193, 115, 0.05);
}

.card.out.highlight.positive strong {
  color: #55c173;
}

.card.out.highlight.negative {
  border-color: #e26a6a;
  background: rgba(226, 106, 106, 0.05);
}

.card.out.highlight.negative strong {
  color: #e26a6a;
}

/* Results grid - single column on mobile */
.kpi {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Two columns on larger phones, three on tablets */
@media (min-width: 480px) {
  .kpi {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.section-header {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 700;
  color: #999;
  margin-top: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* First section header - no top margin */
.section-header:first-child {
  margin-top: 0;
}

/* Form */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Mobile: slightly larger labels */
@media (max-width: 599px) {
  label {
    font-size: 1rem;
  }
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

/* Checkbox styling */
label.inline input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  min-width: 20px;
  min-height: 20px;
}

label.inline span {
  line-height: 1.4;
}

.small {
  font-size: 0.9rem;
  line-height: 1.4;
}

.muted {
  color: #ccc;
}

.out {
  font-variant-numeric: tabular-nums;
}

/* Mobile: better word wrapping for result labels */
.out > div {
  font-size: 0.9rem;
  line-height: 1.3;
  margin-bottom: 4px;
}

.out strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 4px;
}

@media (min-width: 600px) {
  .out strong {
    font-size: 1.2rem;
  }
}

.ok {
  color: #55c173;
}

.warn {
  color: #e26a6a;
}

/* Button - full width on mobile */
button {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
}

@media (min-width: 600px) {
  button {
    width: auto;
    min-width: 200px;
  }
}

button:hover {
  background: #333;
}

button:active {
  background: #1a1a1a;
}

/* Inputs - better touch targets on mobile */
.calc input,
.calc select {
  width: 100%;
  padding: 12px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  color: #fff;
  border-radius: 8px;
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Disabled state */
.calc input:disabled,
.calc select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.calc input:focus,
.calc select:focus {
  outline: 2px solid #55c173;
  outline-offset: 2px;
}

.calc input.warning {
  border-color: #e26a6a;
}

/* Note text */
.note {
  margin-top: 10px;
  opacity: 0.85;
  line-height: 1.5;
  font-size: 0.9rem;
}

/* Percentage inputs */
.percentage-input .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.percentage-input .input-wrapper input {
  padding-right: 40px;
}

.percentage-input .input-suffix {
  position: absolute;
  right: 12px;
  color: #888;
  pointer-events: none;
  font-weight: 400;
  font-size: 1rem;
}

/* Header text responsive */
.calc h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.calc h2 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 599px) {
  .calc h1 {
    font-size: 1.5rem;
  }

  .calc h2 {
    font-size: 1.25rem;
  }
}

/* Top note text */
.calc > p.muted {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* Light mode */
@media (prefers-color-scheme: light) {
  .card {
    border-color: #ccc;
  }
}
