/* ============================================================
   Startup Tools Hub — Frontend Tool Styles
   ============================================================ */

:root {
  --sth-accent:        #2563EB;
  --sth-accent-light:  #EEF2FF;
  --sth-accent-dark:   #1D4ED8;
  --sth-bg:            #F8FAFC;
  --sth-card:          #FFFFFF;
  --sth-border:        #E2E8F0;
  --sth-text:          #1E293B;
  --sth-muted:         #64748B;
  --sth-success:       #16A34A;
  --sth-success-bg:    #DCFCE7;
  --sth-warning:       #D97706;
  --sth-warning-bg:    #FEF3C7;
  --sth-radius:        12px;
  --sth-radius-sm:     8px;
  --sth-shadow:        0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --sth-font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ── Container ────────────────────────────────────────────── */
.sth-tool {
  font-family: var(--sth-font);
  color: var(--sth-text);
  max-width: 780px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.sth-tool *, .sth-tool *::before, .sth-tool *::after {
  box-sizing: border-box;
}

/* ── Tool Header ──────────────────────────────────────────── */
.sth-tool__header {
  margin-bottom: 24px;
}

.sth-tool__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--sth-text);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sth-tool__title svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--sth-accent);
}

.sth-tool__desc {
  color: var(--sth-muted);
  font-size: 14px;
  margin: 0;
}

/* ── Form Panel ───────────────────────────────────────────── */
.sth-form-panel {
  background: var(--sth-card);
  border: 1.5px solid var(--sth-border);
  border-radius: var(--sth-radius);
  padding: 28px;
  box-shadow: var(--sth-shadow);
  margin-bottom: 20px;
}

/* ── Input Grid ───────────────────────────────────────────── */
.sth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.sth-grid--2 { grid-template-columns: repeat(2, 1fr); }
.sth-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ── Field ────────────────────────────────────────────────── */
.sth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.sth-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--sth-text);
}

.sth-field .sth-hint {
  font-size: 12px;
  color: var(--sth-muted);
  margin-top: -2px;
}

/* ── Inputs ───────────────────────────────────────────────── */
.sth-input, .sth-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--sth-border);
  border-radius: var(--sth-radius-sm);
  font-size: 14px;
  font-family: var(--sth-font);
  color: var(--sth-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.sth-input:focus, .sth-select:focus {
  outline: none;
  border-color: var(--sth-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.sth-input-wrap {
  position: relative;
}

.sth-input-prefix, .sth-input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--sth-muted);
  pointer-events: none;
  font-weight: 500;
}
.sth-input-prefix { left: 13px; }
.sth-input-suffix { right: 13px; }

.sth-input-wrap .sth-input--prefix { padding-left: 26px; }
.sth-input-wrap .sth-input--suffix { padding-right: 36px; }

/* ── Section Header (collapsible) ─────────────────────────── */
.sth-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 14px 18px;
  background: var(--sth-bg);
  border-radius: var(--sth-radius-sm);
  margin-bottom: 16px;
  user-select: none;
}

.sth-section-header:hover { background: #F1F5F9; }

.sth-section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.sth-section-arrow {
  transition: transform .2s;
  color: var(--sth-muted);
}

.sth-section--collapsed .sth-section-arrow {
  transform: rotate(-90deg);
}

/* ── Calculate Button ─────────────────────────────────────── */
.sth-calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 24px;
  background: var(--sth-accent);
  color: #fff;
  border: none;
  border-radius: var(--sth-radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--sth-font);
  cursor: pointer;
  margin-top: 24px;
  transition: background .15s, transform .1s;
}

.sth-calc-btn:hover  { background: var(--sth-accent-dark); }
.sth-calc-btn:active { transform: scale(.99); }

.sth-calc-btn .sth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sth-spin .6s linear infinite;
  display: none;
}

.sth-calc-btn.sth-loading .sth-spinner { display: block; }
.sth-calc-btn.sth-loading .sth-btn-label { opacity: .6; }

@keyframes sth-spin { to { transform: rotate(360deg); } }

/* ── Results ──────────────────────────────────────────────── */
.sth-result {
  background: var(--sth-card);
  border: 1.5px solid var(--sth-border);
  border-radius: var(--sth-radius);
  padding: 28px;
  box-shadow: var(--sth-shadow);
  display: none;
  animation: sth-fade-in .3s ease-out;
}

.sth-result.sth-visible { display: block; }

@keyframes sth-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sth-result__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.sth-result__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sth-result__title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--sth-accent);
  border-radius: 2px;
}

/* ── Metric Grid ──────────────────────────────────────────── */
.sth-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.sth-metric {
  background: var(--sth-bg);
  border-radius: var(--sth-radius-sm);
  padding: 18px;
  border: 1px solid var(--sth-border);
}

.sth-metric__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sth-muted);
  margin-bottom: 6px;
}

.sth-metric__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--sth-text);
  line-height: 1.1;
}

.sth-metric__value--accent { color: var(--sth-accent); }
.sth-metric__value--success { color: var(--sth-success); }
.sth-metric__value--warn    { color: var(--sth-warning); }

.sth-metric__sub {
  font-size: 12px;
  color: var(--sth-muted);
  margin-top: 4px;
}

/* ── Result Highlight ─────────────────────────────────────── */
.sth-highlight {
  background: var(--sth-accent-light);
  border: 1.5px solid var(--sth-accent);
  border-radius: var(--sth-radius-sm);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.sth-highlight__icon {
  width: 40px;
  height: 40px;
  background: var(--sth-accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sth-highlight__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sth-accent);
}

.sth-highlight__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--sth-text);
  line-height: 1;
}

/* ── Table (results) ──────────────────────────────────────── */
.sth-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}

.sth-result-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sth-muted);
  border-bottom: 2px solid var(--sth-border);
  background: var(--sth-bg);
}

.sth-result-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #F1F5F9;
}

.sth-result-table tbody tr:last-child td { border-bottom: none; }
.sth-result-table tbody tr:hover { background: var(--sth-bg); }
.sth-result-table td.sth-td--right, .sth-result-table th.sth-td--right { text-align: right; }
.sth-result-table td.sth-td--bold  { font-weight: 700; }

/* ── PDF / Reset Buttons ──────────────────────────────────── */
.sth-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--sth-border);
}

.sth-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--sth-radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  font-family: var(--sth-font);
  transition: all .15s;
}

.sth-action-btn--pdf {
  background: var(--sth-accent);
  color: #fff;
  border-color: var(--sth-accent);
}
.sth-action-btn--pdf:hover { background: var(--sth-accent-dark); border-color: var(--sth-accent-dark); }

.sth-action-btn--reset {
  background: transparent;
  color: var(--sth-muted);
  border-color: var(--sth-border);
}
.sth-action-btn--reset:hover { background: var(--sth-bg); color: var(--sth-text); }

/* ── Disabled Notice ──────────────────────────────────────── */
.sth-disabled-notice {
  padding: 14px 18px;
  background: #F1F5F9;
  border-radius: 8px;
  color: var(--sth-muted);
  font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .sth-form-panel, .sth-result { padding: 20px 16px; }
  .sth-grid--2, .sth-grid--3 { grid-template-columns: 1fr; }
  .sth-metrics { grid-template-columns: repeat(2, 1fr); }
  .sth-highlight__value { font-size: 22px; }
  .sth-tool__title { font-size: 18px; }
}

@media (max-width: 400px) {
  .sth-metrics { grid-template-columns: 1fr; }
}
