/* ─────────────────────────────────────────────────────────────────
   BC Estimator — main stylesheet
   ───────────────────────────────────────────────────────────────── */

:root {
  --brand:        #0078d4;
  --brand-dark:   #005fa3;
  --brand-light:  #e8f3fb;
  --accent:       #00c08b;
  --bg:           #f5f7fa;
  --surface:      #ffffff;
  --border:       #d8dde6;
  --text:         #1a1d23;
  --text-muted:   #6b7280;
  --error:        #c0392b;
  --warning:      #f39c12;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(0,0,0,.09);
  --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition:   .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ── Layout helpers ──────────────────────────────────────────────── */
.container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* ── Header ──────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.header-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 24px; height: 60px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--brand); text-decoration: none; }
.logo svg { flex-shrink: 0; }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.header-nav a { color: var(--text-muted); text-decoration: none; font-size: .93rem; transition: color var(--transition); }
.header-nav a:hover { color: var(--brand); }

.portal-divider {
  width: 1px; height: 22px;
  background: var(--border);
  flex-shrink: 0;
}
.portal-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  border-radius: 6px;
  font-size: .85rem; font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border: 1.5px solid transparent;
}
.portal-link--customer {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}
.portal-link--customer:hover {
  background: #e6faf5;
  color: var(--accent);
}
.portal-link--admin {
  color: var(--brand);
  border-color: var(--brand);
  background: transparent;
}
.portal-link--admin:hover {
  background: var(--brand-light);
  color: var(--brand);
}
@media (max-width: 680px) {
  .portal-divider { display: none; }
  .portal-link { font-size: .8rem; padding: 4px 10px; }
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 10px 22px; font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary.btn-large { padding: 13px 30px; font-size: 1.05rem; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--brand); border-radius: var(--radius);
  padding: 8px 18px; font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--brand-light); }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0f3460 0%, #0078d4 60%, #00c08b 100%);
  color: #fff;
  padding: 80px 24px;
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.2; margin-bottom: 20px; }
.hero h1 .accent { color: #7fe4c8; }
.hero-sub { font-size: 1.1rem; opacity: .9; margin-bottom: 32px; }
@media (max-width: 600px) { .hero h1 { font-size: 1.7rem; } }

/* ── How it works ────────────────────────────────────────────────── */
.how-it-works { padding: 64px 0; }
.how-it-works h2 { text-align: center; font-size: 1.7rem; margin-bottom: 40px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.step {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px 24px; text-align: center;
  box-shadow: var(--shadow);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-weight: 800; font-size: 1.1rem; margin-bottom: 14px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: .93rem; }

/* ── Estimator section ───────────────────────────────────────────── */
.estimator-section { padding: 64px 0 80px; }
.estimator-section h2 { font-size: 1.7rem; margin-bottom: 32px; }

/* ── Form ────────────────────────────────────────────────────────── */
#estimate-form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 6px; }
.req { color: var(--error); }
.form-group textarea,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: var(--font); font-size: .95rem; color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,120,212,.15);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.field-hint { display: block; font-size: .82rem; color: var(--text-muted); margin-top: 5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 580px) { .form-row { grid-template-columns: 1fr; } }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
  margin-top: 8px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }

.contact-details {
  background: var(--bg);
  border-radius: 7px;
  padding: 14px 18px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}
.contact-details summary {
  cursor: pointer; font-size: .93rem; font-weight: 600; color: var(--text-muted);
  user-select: none;
}
.contact-details .form-row { margin-top: 16px; }

.form-actions { text-align: right; margin-top: 10px; }

/* Ensure [hidden] attribute always wins over display rules */
[hidden] { display: none !important; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ─────────────────────────────────────────────────────── */
.results {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.results-header h3 { font-size: 1.4rem; }

.estimate-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}
@media (max-width: 640px) { .estimate-summary { grid-template-columns: 1fr; } }

.summary-card {
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.card-hours    { background: #eef4fc; border-left: 4px solid var(--brand); }
.card-price    { background: #edf9f4; border-left: 4px solid var(--accent); }
.card-delivery { background: #fdf6ee; border-left: 4px solid var(--warning); }
.card-icon { font-size: 1.8rem; line-height: 1; margin-bottom: 8px; }
.card-label { font-size: .82rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.card-value { font-size: 1.45rem; font-weight: 800; color: var(--text); }

.results-body { display: grid; grid-template-columns: 1fr 340px; gap: 32px; }
@media (max-width: 860px) { .results-body { grid-template-columns: 1fr; } }

.results-block { margin-bottom: 28px; }
.results-block h4 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1.5px solid var(--border); }

.breakdown-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.breakdown-table th, .breakdown-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.breakdown-table th { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.breakdown-table tr:last-child td { border-bottom: none; }

.plain-list { list-style: none; padding: 0; font-size: .9rem; }
.plain-list li { padding: 6px 0; padding-left: 18px; position: relative; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: none; }
.plain-list li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.risk-list li::before { content: '⚠'; color: var(--warning); }

.price-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.price-table td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.price-table td:last-child { text-align: right; font-weight: 600; }
.price-table tr:last-child td { border-bottom: none; }
.vat-row td { color: var(--text-muted); font-style: italic; }

.pricing-detail { background: var(--bg); border-radius: 8px; padding: 18px; }
.pricing-detail h4 { border-bottom-color: transparent; }

.disclaimer {
  margin-top: 24px;
  padding: 14px 18px;
  background: #fffbe6;
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  font-size: .85rem;
  color: #7a6000;
}

/* ── Error box ───────────────────────────────────────────────────── */
.error-box {
  background: #fff5f5;
  border-left: 4px solid var(--error);
  border-radius: 6px;
  padding: 14px 18px;
  color: var(--error);
  font-size: .93rem;
  margin-top: 20px;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 28px 24px;
  font-size: .85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Customer header elements ─────────────────────────────────────── */
.header-customer {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-customer .cust-name {
  font-size: .85rem;
  color: var(--text-muted);
}
.header-customer .cust-name strong { color: var(--text); }
.header-customer .btn-my-projects,
.header-customer .btn-logout {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.header-customer .btn-my-projects {
  background: #e8f3fb;
  color: var(--brand);
  border-color: #bcd4f5;
}
.header-customer .btn-my-projects:hover { background: #d0e8f7; }
.header-customer .btn-logout {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.header-customer .btn-logout:hover { background: var(--bg); color: var(--text); }

/* ── Calculation overlay (full-page) ─────────────────────────────── */
.calc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 25, 50, 0.80);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-overlay[hidden] { display: none !important; }

.calc-overlay-card {
  background: #fff;
  border-radius: 20px;
  padding: 52px 48px 44px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 28px 70px rgba(0,0,0,.3);
  animation: overlayIn .3s ease;
}
@keyframes overlayIn {
  from { transform: translateY(16px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.ovl-logo { margin-bottom: 24px; }
.ovl-ring {
  width: 68px; height: 68px; border-radius: 50%;
  border: 5px solid #e8f3fb;
  border-top-color: var(--brand);
  animation: ovlSpin 1s linear infinite;
  margin: 0 auto 28px;
}
@keyframes ovlSpin { to { transform: rotate(360deg); } }

.ovl-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}
.ovl-sub {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 30px;
  line-height: 1.65;
}
.ovl-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.ovl-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: #9ca3af;
  background: #f5f7fa;
  border-radius: 8px;
  padding: 9px 14px;
  transition: all .4s ease;
}
.ovl-step.active {
  color: var(--brand);
  background: #e8f3fb;
  font-weight: 600;
}
.ovl-step.done { color: var(--accent); background: #f0fdf9; }
.ovl-step.done .dot {
  background: transparent;
  width: auto; height: auto;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.ovl-step .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── "View projects" link in results ─────────────────────────────── */
.view-projects-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #e8f3fb, #d1fae5);
  border-radius: var(--radius);
  margin-top: 20px;
  font-size: .93rem;
}
.view-projects-bar a {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1.5px solid var(--brand);
  transition: opacity var(--transition);
}
.view-projects-bar a:hover { opacity: .75; }

/* ── Clarification panel ──────────────────────────────────────────── */
.clarify-panel {
  background: linear-gradient(135deg, #f0f7ff 0%, #f0fdf9 100%);
  border: 1.5px solid #93c5fd;
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-top: 24px;
  animation: fadeIn .25s ease;
}
.clarify-panel[hidden] { display: none !important; }
.clarify-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.clarify-icon { font-size: 1.6rem; flex-shrink: 0; margin-top: 2px; }
.clarify-header h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; color: #1e3a5f; }
.clarify-header p { font-size: .88rem; color: var(--text-muted); line-height: 1.5; }
.clarify-questions { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.clarify-question label {
  display: block; font-size: .85rem; font-weight: 700; color: #1e3a5f; margin-bottom: 6px;
}
.clarify-question input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid #bfdbfe; border-radius: 8px;
  font-size: .93rem; font-family: var(--font);
  background: #fff; color: var(--text);
  transition: border-color var(--transition);
}
.clarify-question input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,120,212,.1); }
.clarify-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-clarify-submit {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 26px; border-radius: var(--radius);
  background: var(--brand); color: #fff;
  border: none; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background var(--transition);
}
.btn-clarify-submit:hover { background: var(--brand-dark); }
.btn-clarify-skip {
  background: none; border: none; font-size: .88rem;
  color: var(--text-muted); cursor: pointer; text-decoration: underline; padding: 4px;
}
.btn-clarify-skip:hover { color: var(--text); }
.clarify-fetching { display: flex; align-items: center; gap: 10px; padding: 14px 0; color: var(--text-muted); font-size: .9rem; }

/* ── Post-estimate clarification follow-up panel ──────────────────── */
.clarify-followup {
  display: flex; align-items: flex-start; gap: 14px;
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border: 1.5px solid #fbbf24;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.clarify-followup[hidden] { display: none !important; }
.clarify-followup-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }
.clarify-followup h4 { font-size: .95rem; font-weight: 700; color: #78350f; margin-bottom: 10px; }
.clarify-followup-list {
  padding-left: 18px; margin: 0 0 10px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.clarify-followup-list li { font-size: .88rem; color: #92400e; line-height: 1.55; }
.clarify-followup-hint { font-size: .82rem; color: #a16207; margin: 0; }
.clarify-followup-hint a { color: #b45309; font-weight: 600; }

/* ── Customer sign-in modal ───────────────────────────────────────── */
.login-modal-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.login-modal-backdrop[hidden] { display: none !important; }
.login-modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
