/* ============================================================
   Chervis Group Proposal Portal — Public / Calculator CSS
   Colors: #f85353 (primary) | #1A173A (dark) | #ffa996 (accent)
   ============================================================ */

:root {
  --primary:   #f85353;
  --dark:      #1A173A;
  --accent:    #ffa996;
  --light-red: #fff5f5;
  --bg:        #f4f6fb;
  --card:      #ffffff;
  --text:      #1e1e2e;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --shadow:    0 4px 24px rgba(26,23,58,.08);
  --radius:    12px;
  --radius-sm: 8px;
  --transition: all .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Typography ─────────────────────────────────── */
h1,h2,h3,h4,h5 { font-weight: 700; line-height: 1.3; color: var(--dark); }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p  { color: var(--muted); }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top Navigation ──────────────────────────────── */
.site-nav {
  background: var(--dark);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-brand-logo { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 1.1rem; }
.nav-brand-name { color: white; font-weight: 700; font-size: 1rem; }
.nav-brand-name span { color: var(--accent); }
.nav-links a { color: rgba(255,255,255,.7); font-size: .9rem; margin-left: 24px; transition: var(--transition); }
.nav-links a:hover { color: white; text-decoration: none; }
.nav-links .btn-nav { background: var(--primary); color: white !important; padding: 8px 18px; border-radius: 8px; font-weight: 600; }

/* ── Hero ───────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--dark) 0%, #2d2860 60%, #1A173A 100%);
  color: white;
  padding: 80px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(248,83,83,.15) 0%, transparent 70%);
  top: -200px; right: -100px;
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,169,150,.1) 0%, transparent 70%);
  bottom: -100px; left: -50px;
  border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.hero h1 { color: white; margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.hero p { color: rgba(255,255,255,.75); font-size: 1.05rem; margin-bottom: 32px; }
.hero-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badge {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
}

/* ── Container ──────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Steps Indicator ────────────────────────────── */
.steps-bar {
  background: var(--dark);
  padding: 0;
}
.steps-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: rgba(255,255,255,.5);
  font-size: .85rem;
  font-weight: 500;
}
.step-item.active { color: white; }
.step-item.done { color: var(--accent); }
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-item.active .step-num { background: var(--primary); color: white; }
.step-item.done .step-num { background: #22c55e; color: white; }
.step-arrow { color: rgba(255,255,255,.2); }

/* ── Main Layout ────────────────────────────────── */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  padding: 32px 20px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
}

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid var(--border);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.card-icon {
  width: 42px; height: 42px;
  background: var(--light-red);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.card-header h3 { margin: 0; font-size: 1.1rem; }
.card-header p { margin: 0; font-size: .8rem; }

/* ── Section Tabs (Platform selector) ───────────── */
.platform-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.platform-tab {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}
.platform-tab:hover { border-color: var(--accent); }
.platform-tab.selected { border-color: var(--primary); background: var(--light-red); }
.platform-tab .pt-icon { font-size: 1.6rem; margin-bottom: 6px; }
.platform-tab .pt-name { font-size: .8rem; font-weight: 600; color: var(--dark); }
.platform-tab .pt-note { font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* ── Service Categories & Items ─────────────────── */
.service-category { margin-bottom: 20px; }
.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8f9fc;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.cat-header:hover { background: var(--light-red); border-color: var(--accent); }
.cat-title { font-weight: 600; font-size: .95rem; flex: 1; }
.cat-count { font-size: .75rem; color: var(--muted); }
.cat-arrow { transition: transform .2s; font-size: .85rem; color: var(--muted); }
.cat-header.open .cat-arrow { transform: rotate(180deg); }
.cat-body { display: none; padding: 8px 0 0; }
.cat-body.open { display: block; }

.service-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  margin-bottom: 8px;
  transition: var(--transition);
  background: white;
}
.service-item:hover { border-color: var(--accent); }
.service-item.selected { border-color: var(--primary); background: var(--light-red); }
.service-check { margin-top: 3px; }
.service-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.service-info { }
.service-name { font-weight: 600; font-size: .9rem; color: var(--dark); margin-bottom: 3px; }
.service-desc { font-size: .78rem; color: var(--muted); line-height: 1.4; }
.service-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.badge-renewal {
  font-size: .68rem;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-hours {
  font-size: .68rem;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 2px 8px;
  border-radius: 10px;
}
.service-qty { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.qty-wrap { display: flex; align-items: center; gap: 6px; }
.qty-wrap label { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.qty-input {
  width: 60px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: .85rem;
  text-align: center;
  transition: var(--transition);
}
.qty-input:focus { outline: none; border-color: var(--primary); }
.service-cost { font-size: .85rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ── Customer Form ──────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--dark);
}
.form-group label .req { color: var(--primary); }
.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .9rem;
  font-family: inherit;
  transition: var(--transition);
  background: white;
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(248,83,83,.1); }
.form-control.error { border-color: #ef4444; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Sticky Summary Panel ───────────────────────── */
.summary-panel { position: sticky; top: 80px; }
.summary-panel .card { padding: 24px; }
.summary-title { font-size: 1rem; font-weight: 700; color: var(--dark); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.summary-empty { text-align: center; padding: 20px 0; color: var(--muted); font-size: .85rem; }
.summary-items { max-height: 340px; overflow-y: auto; margin-bottom: 16px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.summary-item:last-child { border-bottom: none; }
.si-name { font-size: .8rem; font-weight: 600; color: var(--dark); flex: 1; }
.si-qty  { font-size: .75rem; color: var(--muted); }
.si-cost { font-size: .85rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.si-renewal { font-size: .68rem; color: #c2410c; }

.summary-divider { height: 1px; background: var(--border); margin: 16px 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .88rem; }
.summary-row .label { color: var(--muted); }
.summary-row .val { font-weight: 600; color: var(--dark); }
.summary-row.hours .val { color: #2563eb; }
.summary-row.total { margin-top: 8px; padding-top: 12px; border-top: 2px solid var(--border); font-size: 1rem; }
.summary-row.total .label { font-weight: 700; color: var(--dark); }
.summary-row.total .val { font-weight: 800; color: var(--primary); font-size: 1.15rem; }
.summary-row.gst .val { color: var(--muted); }

.renewal-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: .78rem;
  color: #92400e;
}
.renewal-note strong { display: block; margin-bottom: 4px; }

.discount-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.discount-row label { font-size: .82rem; font-weight: 600; color: var(--dark); white-space: nowrap; }
.discount-input { width: 70px; border: 1.5px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: .85rem; text-align: center; }
.discount-input:focus { outline: none; border-color: var(--primary); }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .9rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #e03e3e; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(248,83,83,.35); text-decoration: none; color: white; }
.btn-dark { background: var(--dark); color: white; }
.btn-dark:hover { background: #2d2860; transform: translateY(-1px); text-decoration: none; color: white; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--light-red); text-decoration: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Toast ──────────────────────────────────────── */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  padding: 14px 20px;
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  max-width: 340px;
  animation: slideIn .3s ease;
}
.toast.success { border-color: #22c55e; }
.toast.error   { border-color: #ef4444; }
.toast.warning { border-color: #f59e0b; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Loading Spinner ────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,23,58,.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  transform: scale(.95);
  transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--border); color: var(--dark); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* ── Success State ──────────────────────────────── */
.success-screen {
  text-align: center;
  padding: 60px 20px;
}
.success-icon { font-size: 4rem; margin-bottom: 16px; }
.success-screen h2 { color: var(--dark); margin-bottom: 12px; }
.success-screen p { color: var(--muted); max-width: 400px; margin: 0 auto 24px; }

/* ── Footer ─────────────────────────────────────── */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 24px;
  font-size: .82rem;
  margin-top: 40px;
}
.site-footer a { color: var(--accent); }

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 48px 16px 36px; }
  .calc-layout { padding: 16px; gap: 16px; }
  .card { padding: 18px; }
}
