/* ============================================================
   ADV Automotive — Test Drive Scheduler
   Brand: navy #041028 · indigo accent #312783 · white · Mokoko
   ============================================================ */

/* ---- Mokoko (self-hosted, licensed web fonts) ---- */
@font-face {
  font-family: 'Mokoko';
  src: url('assets/fonts/Mokoko-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Mokoko';
  src: url('assets/fonts/Mokoko-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Mokoko';
  src: url('assets/fonts/Mokoko-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Mokoko';
  src: url('assets/fonts/Mokoko-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --navy: #041028;        /* primary brand */
  --navy-soft: #1c2740;
  --indigo: #312783;      /* accent */
  --indigo-tint: #edecf6;
  --bright: #2f6bff;      /* brighter electric blue for step labels/highlights */
  --bright-tint: #eaf1ff;
  --ink: #041028;
  --muted: #6a7385;
  --bg: #ffffff;
  --panel: #ffffff;
  --soft: #f5f6fa;        /* very light navy-grey surface */
  --line: #e5e7ef;
  --line-strong: #d4d8e4;
  --ok: #128a5a;
  --ok-bg: #e7f6ee;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(4,16,40,.04), 0 6px 20px rgba(4,16,40,.06);
  --shadow-lg: 0 14px 40px rgba(4,16,40,.14);
  --font-display: 'Mokoko', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .3em; line-height: 1.12; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
a { color: var(--indigo); }

.wrap { max-width: 780px; margin: 0 auto; padding: 26px 18px 56px; }
.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 22px 20px 64px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- Masthead ---- */
.masthead {
  position: relative;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 30px 30px 32px;
  margin-bottom: 22px;
  overflow: hidden;
}
.masthead .corner {
  position: absolute; top: 0; right: 0; width: 190px; height: auto; opacity: .16;
  pointer-events: none;
}
.topbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.lang-toggle { display: flex; gap: 5px; }
.lang-toggle button {
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: .3px; cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.lang-toggle button:hover { border-color: var(--navy); color: var(--navy); }
.lang-toggle button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.masthead img.logo { height: 30px; width: auto; margin-bottom: 20px; display: block; }
.masthead .badge {
  display: inline-block;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.24);
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .4px;
  margin-bottom: 12px;
}
.masthead h1 { font-size: 30px; color: #fff; margin-bottom: 8px; }
.masthead p { margin: 0; opacity: .82; font-size: 15px; max-width: 46ch; }

/* ---- Cards ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { font-size: 20px; }
/* Step cards (booking flow): more air under the step tag and under the title */
.card:has(.step-label) h2 { margin-bottom: 16px; }
.step-label {
  display: inline-block;
  font-size: 12px; font-weight: 700; color: var(--bright);
  letter-spacing: .8px; text-transform: uppercase; margin-bottom: 12px;
  background: var(--bright-tint); padding: 4px 11px; border-radius: 999px;
}

/* ---- Option grids ---- */
.grid { display: grid; gap: 12px; margin-top: 4px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }

/* Car option = image tile */
.option {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit;
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.option:hover { border-color: var(--indigo); transform: translateY(-2px); }
.option.selected { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo); }
.option .thumb {
  width: 100%; aspect-ratio: 16 / 9; background: var(--soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.option .thumb img { width: 100%; height: 100%; object-fit: contain; }
.option .cap { padding: 11px 14px 13px; }
.option .cap .t { font-weight: 600; font-size: 15px; }
.option .cap .s { font-size: 12px; color: var(--muted); }

/* Dealer list = two columns (collapses to one on phones) */
.dealer-grid { grid-template-columns: repeat(2, 1fr); }

/* Dealer card = logo (fixed height, any width) on the left, small photo on the right */
.option.dealer {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: #fff;
}
.option.dealer .dealer-info { flex: 1 1 auto; min-width: 0; }
.option.dealer .dealer-commune { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--navy); line-height: 1.1; margin-bottom: 7px; }
/* Logo is a small secondary brand mark under the commune headline.
   Fixed height, width auto, NO max-width -> every logo is exactly the same height. */
.option.dealer .dealer-logo { display: block; height: 14px; width: auto; object-fit: contain; object-position: left; opacity: .85; }
.option.dealer .dealer-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.option.dealer .dealer-address { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.35; }
.option.dealer .dealer-photo {
  flex: 0 0 auto; width: 76px; height: 56px; border-radius: 9px; overflow: hidden;
  background: var(--soft); display: flex; align-items: center; justify-content: center;
}
.option.dealer .dealer-photo img { width: 100%; height: 100%; object-fit: cover; }
.option.dealer .dealer-photo.noimg::after {
  content: attr(data-ph); font-family: var(--font-display); font-weight: 600;
  font-size: 11px; color: var(--navy); text-align: center; padding: 5px;
}
@media (max-width: 760px) {
  .dealer-grid { grid-template-columns: 1fr; }         /* one column on phones */
  .option.dealer .dealer-logo { height: 15px; }
  .option.dealer .dealer-photo { width: 84px; height: 60px; }
}

/* placeholder shown when an image is missing */
.thumb.noimg::after {
  content: attr(data-ph);
  color: var(--navy); font-family: var(--font-display); font-weight: 600; font-size: 16px;
  text-align: center; padding: 10px;
}

.chip {
  border: 1.5px solid var(--line-strong);
  background: #fff; border-radius: 999px; padding: 10px 16px; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--ink);
  transition: border-color .12s, background .12s, color .12s;
}
.chip:hover { border-color: var(--indigo); }
.chip.selected { border-color: var(--navy); background: var(--navy); color: #fff; }
.chip:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Forms ---- */
label.field { display: block; margin-bottom: 13px; }
label.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line-strong);
  border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-tint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff; border: none; border-radius: 10px;
  padding: 13px 22px; font: inherit; font-weight: 600; cursor: pointer;
  transition: filter .12s, transform .02s, background .12s;
}
.btn:hover { background: #0a1c3d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--soft); color: var(--navy); border: 1.5px solid var(--line-strong); }
.btn.secondary:hover { background: #eceef5; }
.btn.ghost { background: transparent; color: var(--indigo); padding: 9px 10px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a5322a; }
.btn.sm { padding: 8px 13px; font-size: 13px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ---- Summary / success ---- */
.summary { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.summary .line span:first-child { color: var(--muted); }
.summary .line span:last-child { font-weight: 600; text-align: right; }

.success { text-align: center; padding: 26px 20px; }
.success .tick {
  width: 66px; height: 66px; border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  display: flex; align-items: center; justify-content: center; font-size: 34px; margin: 0 auto 16px;
}
.success h2 { font-size: 26px; }

.notice { padding: 11px 15px; border-radius: 10px; font-size: 14px; margin-bottom: 13px; }
.notice.err { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }

.footer-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; opacity: .7; }
.footer-brand img { height: 22px; width: auto; }

/* ============================================================
   Admin dashboard
   ============================================================ */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.admin-head .brand { display: flex; align-items: center; gap: 14px; }
.admin-head .brand img { height: 30px; width: auto; }
.admin-head h1 { font-size: 22px; margin: 0; }
.admin-head .sub { font-size: 13px; color: var(--muted); }

.layout { display: grid; grid-template-columns: 270px 1fr; gap: 20px; align-items: start; }
.dealer-list { display: flex; flex-direction: column; gap: 7px; }
.dealer-list button {
  text-align: left; border: 1.5px solid var(--line); background: #fff;
  border-radius: 11px; padding: 12px 14px; cursor: pointer; font: inherit;
  transition: border-color .12s, background .12s;
}
.dealer-list button:hover { border-color: var(--indigo); }
.dealer-list button.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.dealer-list button .nm { font-weight: 600; font-size: 14px; }
.dealer-list button .cnt { font-size: 12px; opacity: .75; }

.checkgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.checkgrid label { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.checkgrid input { width: auto; }

/* per-car day matrix */
.carrow { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.carrow.off { opacity: .55; background: var(--soft); }
.carrow .head { display: flex; align-items: center; gap: 10px; }
.carrow .head .nm { font-weight: 600; }
.carrow .head input { width: auto; }
.carrow .days { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.carrow .days .quick { margin-left: auto; }
.daytoggle {
  border: 1.4px solid var(--line-strong); background: #fff; border-radius: 8px;
  padding: 6px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted);
}
.daytoggle.on { border-color: var(--navy); background: var(--navy); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tag { display: inline-block; background: var(--indigo-tint); color: var(--indigo); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }

/* ---- Login gate ---- */
.login-gate { position: fixed; inset: 0; background: var(--soft); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 28px; width: 100%; max-width: 360px; }
.login-card h2 { font-size: 20px; }
.login-logo { height: 26px; margin-bottom: 18px; display: block; }

/* ---- Admin tabs ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 2px solid var(--line); }
.tabs button {
  border: none; background: none; font: inherit; font-weight: 600; font-size: 15px;
  color: var(--muted); padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--navy); border-bottom-color: var(--bright); }
.tabs button .pill { display:inline-block; background: var(--bright-tint); color: var(--bright); border-radius:999px; font-size:12px; padding:1px 8px; margin-left:6px; font-weight:700; }

/* ---- CRM filters + status ---- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filters select { min-width: 170px; }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-new { background: #fdf0e0; color: #b7791f; }
.st-contacted { background: var(--bright-tint); color: var(--bright); }
.st-confirmed { background: var(--ok-bg); color: var(--ok); }
select.status-select { padding: 6px 8px; border-radius: 8px; font-size: 13px; width: auto; }
input.note-input { padding: 7px 9px; font-size: 13px; border-radius: 8px; min-width: 150px; }

.crm-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,16,40,.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.modal {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; padding: 24px; max-height: 90vh; overflow: auto;
}
.modal h2 { font-size: 20px; margin-bottom: 4px; }

.outbox-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.outbox-item .to { font-weight: 600; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-5px); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .checkgrid { grid-template-columns: 1fr; }
  .masthead h1 { font-size: 25px; }
}
