/**
 * Quote Builder — CSS Module
 */

/* ── Overlay ── */
.qb-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.qb-overlay.open { opacity: 1; pointer-events: all; }

.qb-modal {
  width: min(96vw, 1280px); max-height: 92vh;
  background: var(--card-bg, #1e1e2e); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  animation: qb-slideUp 0.35s cubic-bezier(0.16,1,0.3,1);
}
@keyframes qb-slideUp {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Header ── */
.qb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}
.qb-header-left { display: flex; align-items: baseline; gap: 12px; }
.qb-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--text-primary, #fff); }
.qb-lead-name {
  font-size: 13px; color: var(--accent-primary, #6366f1);
  background: rgba(99,102,241,0.1); padding: 3px 10px; border-radius: 12px;
}
.qb-close-btn {
  background: transparent; border: 1px solid var(--border-color, rgba(255,255,255,0.1));
  color: var(--text-muted, #888); font-size: 16px; width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.qb-close-btn:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ── Summary Bar ── */
.qb-summary-bar {
  display: flex; gap: 0; padding: 0 24px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
}
.qb-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 2px;
  border-right: 1px solid var(--border-color, rgba(255,255,255,0.04));
}
.qb-stat:last-child { border-right: none; }
.qb-stat-val { font-size: 20px; font-weight: 700; color: var(--text-primary, #fff); }
.qb-stat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted, #666); }

/* ── Controls ── */
.qb-controls {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.06));
  flex-wrap: wrap;
}
.qb-search-group { display: flex; gap: 8px; flex: 1; min-width: 300px; }
.qb-search {
  flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color, rgba(255,255,255,0.1));
  background: var(--bg-input, rgba(255,255,255,0.04)); color: var(--text-primary, #fff);
  font-size: 13px; outline: none;
}
.qb-search:focus { border-color: var(--accent-primary, #6366f1); }
.qb-select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color, rgba(255,255,255,0.1));
  background: var(--bg-input, rgba(255,255,255,0.04)); color: var(--text-primary, #fff);
  font-size: 13px; cursor: pointer; min-width: 120px;
}

.qb-upcharge-group {
  display: flex; align-items: center; gap: 8px;
  background: rgba(99,102,241,0.06); padding: 6px 12px; border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.15);
}
.qb-upcharge-label { font-size: 12px; color: var(--text-muted, #888); white-space: nowrap; }
.qb-upcharge-input {
  width: 56px; padding: 4px 6px; border-radius: 6px; text-align: center;
  border: 1px solid rgba(99,102,241,0.2); background: rgba(0,0,0,0.2);
  color: #6366f1; font-size: 14px; font-weight: 600;
}
.qb-upcharge-slider-wrap { width: 100px; }
.qb-upcharge-slider {
  -webkit-appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: rgba(99,102,241,0.2); outline: none;
}
.qb-upcharge-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #6366f1; cursor: pointer; box-shadow: 0 0 6px rgba(99,102,241,0.4);
}

/* ── Rate Table ── */
.qb-table-wrap {
  flex: 1; overflow-y: auto; padding: 0;
  max-height: calc(92vh - 280px);
}
.qb-rate-table { border-collapse: collapse; }
.qb-rate-table th { position: sticky; top: 0; z-index: 2; background: var(--card-bg, #1e1e2e); }
.qb-check-col { width: 36px; text-align: center !important; }
.qb-rate-row { cursor: pointer; transition: background 0.15s; }
.qb-rate-row:hover { background: rgba(99,102,241,0.06) !important; }
.qb-rate-row.qb-selected { background: rgba(99,102,241,0.1) !important; }
.qb-rate-row.qb-selected td:first-child { border-left: 3px solid #6366f1; }
.qb-score { font-weight: 600; font-size: 13px; }
.qb-more { text-align: center; padding: 12px; color: var(--text-muted, #888); font-size: 12px; }
.qb-empty { text-align: center; padding: 60px; color: var(--text-muted, #888); }

/* ── Footer (selection bar) ── */
.qb-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
  background: rgba(99,102,241,0.04);
  animation: qb-slideUp 0.2s ease;
}
.qb-footer-info { display: flex; align-items: center; gap: 20px; }
.qb-footer-count { font-size: 14px; font-weight: 600; color: var(--text-primary, #fff); }
.qb-footer-margin { font-size: 13px; color: var(--text-muted, #888); }
.qb-footer-actions { display: flex; gap: 8px; }
.qb-generate-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  font-weight: 600 !important; letter-spacing: 0.3px;
}

/* ── Loading / Success ── */
.qb-loading, .qb-error, .qb-success {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 40px; gap: 16px; text-align: center;
}
.qb-spinner {
  width: 36px; height: 36px; border: 3px solid rgba(99,102,241,0.2);
  border-top-color: #6366f1; border-radius: 50%;
  animation: qb-spin 0.7s linear infinite;
}
@keyframes qb-spin { to { transform: rotate(360deg); } }
.qb-success-icon { font-size: 48px; }
.qb-success h3 { margin: 0; color: var(--text-primary, #fff); }
.qb-success p { color: var(--text-muted, #888); margin: 4px 0; }
.qb-success-id { font-family: monospace; font-size: 12px; opacity: 0.6; }
.qb-success-actions { display: flex; gap: 8px; margin-top: 16px; }
