/* ============================================================
   Indexer Sizing Calculator
   ============================================================ */

/* ─── Layout ─────────────────────────────────────────────── */
.ic-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  font-family: inherit;
  color: #333;
}

/* ─── Job info header ─────────────────────────────────────── */
.ic-job-info {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.ic-job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

/* ─── Legend ─────────────────────────────────────────────── */
.ic-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #555;
  margin-bottom: 1.25rem;
}

.ic-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ic-dot--blue { background: #cce5ff; border: 1px solid #4d9fdc; }
.ic-dot--tan  { background: #fff3cd; border: 1px solid #e0c060; }

/* ─── Sections ───────────────────────────────────────────── */
.ic-sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ic-section {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.25rem;
  background: #fff;
}

.ic-section__title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1948ba;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e8ecf7;
}

.ic-section__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ic-section__title-row .ic-section__title {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* ─── Grid ───────────────────────────────────────────────── */
.ic-grid {
  display: grid;
  gap: 0.875rem;
  margin-bottom: 0.875rem;
}

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

@media (max-width: 768px) {
  .ic-grid--2,
  .ic-grid--3,
  .ic-grid--4 { grid-template-columns: 1fr; }
}

@media (min-width: 480px) and (max-width: 768px) {
  .ic-grid--3,
  .ic-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Fields ─────────────────────────────────────────────── */
.ic-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ic-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #444;
  line-height: 1.3;
}

.ic-label--req {
  border-left: 3px solid #1948ba;
  padding-left: 0.4rem;
}

.ic-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}

.ic-input-wrap .ic-input {
  flex: 1;
  border-radius: 4px 0 0 4px;
}

.ic-input-wrap .ic-unit {
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-left: none;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  color: #555;
  white-space: nowrap;
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
}

/* ─── Inputs ─────────────────────────────────────────────── */
.ic-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #fff;
  color: #333;
  transition: border-color 0.15s;
  box-sizing: border-box;
  line-height: 1.5;
}

.ic-input:focus {
  outline: none;
  border-color: #1948ba;
  box-shadow: 0 0 0 2px rgba(25, 72, 186, 0.15);
}

.ic-input--req {
  background: #ddeeff;
  border-color: #4d9fdc;
}

.ic-input--req:focus {
  border-color: #1948ba;
}

.ic-input--calc {
  background: #fff8e1;
  border-color: #e0c060;
  color: #5a4a00;
  cursor: default;
}

.ic-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

/* ─── Calculated row ─────────────────────────────────────── */
.ic-calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e0e0e0;
}

.ic-calc-field {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ─── Tooltip ────────────────────────────────────────────── */
.ic-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1948ba;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  position: relative;
  margin-left: 3px;
  font-style: normal;
}

.ic-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  width: 220px;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.ic-tip:hover::after { opacity: 1; }

/* ─── Auto-fill bar ──────────────────────────────────────── */
.ic-autofill-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: flex-end;
  background: #f0f4ff;
  border: 1px solid #c5d3f5;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.875rem;
}

.ic-autofill-pair {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ic-autofill-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #1948ba;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  align-self: flex-end;
}

.ic-autofill-btn:hover { background: #1238a0; }

/* ─── Toggle buttons ─────────────────────────────────────── */
.ic-toggle-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1948ba;
  background: transparent;
  border: 1px solid #1948ba;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.ic-toggle-btn:hover {
  background: #1948ba;
  color: #fff;
}

/* ─── Action buttons ─────────────────────────────────────── */
.ic-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.ic-actions--results {
  justify-content: flex-end;
  border-top: 1px solid #dee2e6;
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

.ic-btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ic-btn--primary {
  background: #1948ba;
  color: #fff;
}

.ic-btn--primary:hover { background: #1238a0; }

.ic-btn--ghost {
  background: #fff;
  color: #1948ba;
  border: 2px solid #1948ba;
}

.ic-btn--ghost:hover {
  background: #f0f4ff;
}

/* ─── Results ────────────────────────────────────────────── */
.ic-results {
  margin-top: 2rem;
  border-top: 3px solid #1948ba;
  padding-top: 1.5rem;
}

.ic-results__header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.25rem;
}

.ic-results__title {
  font-size: 1.5rem;
  color: #1948ba;
  margin: 0;
  text-transform: uppercase;
  font-family: inherit;
}

.ic-results__meta {
  font-size: 0.85rem;
  color: #777;
}

/* ─── Summary cards ──────────────────────────────────────── */
.ic-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ic-card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.ic-card--rec {
  border-color: #1948ba;
  background: #f0f4ff;
}

.ic-card--warn {
  border-color: #dc3545;
  background: #fff5f5;
}

.ic-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  margin-bottom: 0.25rem;
}

.ic-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1948ba;
  line-height: 1.2;
}

.ic-card--warn .ic-card__value { color: #dc3545; }

.ic-card__unit {
  font-size: 0.875rem;
  font-weight: 400;
  color: #555;
}

.ic-card__sub {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.25rem;
}

/* ─── Result sections ────────────────────────────────────── */
.ic-result-section {
  margin-top: 2rem;
}

.ic-result-section h3 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1948ba;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #e8ecf7;
}

.ic-note {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.75rem;
}

/* ─── Product table ──────────────────────────────────────── */
.ic-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: normal;
}

.ic-table th {
  background: #1948ba;
  color: #fff;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.ic-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #e8e8e8;
  color: #333;
}

.ic-table tbody tr:hover { background: #f7f9ff; }

.ic-tr--selected td {
  background: #eef3ff !important;
  font-weight: 600;
}

/* ─── Badges ─────────────────────────────────────────────── */
.ic-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ic-badge--pass     { background: #d4edda; color: #155724; }
.ic-badge--fail     { background: #f8d7da; color: #721c24; }
.ic-badge--selected { background: #1948ba; color: #fff; }
.ic-badge--na       { background: #e9ecef; color: #555; }

/* ─── Detail grid ────────────────────────────────────────── */
.ic-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.ic-detail-block h4 {
  font-size: 0.9375rem;
  color: #1948ba;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  font-family: inherit;
}

.ic-detail-block h4 small {
  text-transform: none;
  font-size: 0.8rem;
  color: #666;
  font-weight: 400;
}

.ic-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ic-detail-table th {
  text-align: left;
  font-weight: 600;
  color: #444;
  padding: 0.35rem 1rem 0.35rem 0.5rem;
  width: 55%;
  border-bottom: 1px solid #eee;
}

.ic-detail-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #eee;
  color: #222;
}

/* ─── Sibling variant chips ──────────────────────────────── */
.ic-sibling-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  font-size: 0.875rem;
}

.ic-chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #e9ecef;
  border-radius: 100px;
  font-size: 0.8rem;
  color: #333;
}

.ic-chip--hl {
  background: #1948ba;
  color: #fff;
}

/* ─── Formula legend ─────────────────────────────────────── */
.ic-formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.ic-formula-table th {
  background: #f0f4ff;
  color: #1948ba;
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-weight: 700;
  border-bottom: 2px solid #c5d3f5;
}

.ic-formula-table td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.ic-formula-table code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: #1948ba;
  background: none;
}

/* ─── Quote form ─────────────────────────────────────────── */
.ic-quote-form {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
}

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .ic-sections,
  .ic-actions,
  .no-print,
  .ic-autofill-bar,
  .ic-toggle-btn,
  .ic-quote-form {
    display: none !important;
  }

  .ic-wrap {
    padding: 0;
    max-width: 100%;
  }

  .ic-results {
    display: block !important;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }

  .ic-job-info,
  .ic-legend {
    display: block !important;
  }

  .ic-card {
    break-inside: avoid;
  }

  .ic-result-section {
    break-inside: avoid;
  }

  .ic-table {
    font-size: 0.75rem;
  }

  .ic-table th {
    background: #1948ba !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ic-badge--pass {
    background: #d4edda !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ic-badge--fail {
    background: #f8d7da !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ic-badge--selected {
    background: #1948ba !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ic-tr--selected td {
    background: #eef3ff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page {
    margin: 0.75in;
    size: letter;
  }
}
