/* Drori Cars — custom layer on top of Bootstrap 5. */

:root {
  --dc-navy: #12405f;
  --dc-navy-dark: #0d3049;
  --dc-teal: #0d5f5a;
  --dc-gold: #e8b04b;
  --dc-ink: #1c2a35;
  --dc-muted: #6b7b88;
  --dc-line: #dfe6ec;
  --dc-bg: #f4f7f9;
  --dc-panel: #ffffff;
  --dc-radius: 14px;
  --dc-shadow: 0 1px 2px rgba(18, 64, 95, .06), 0 6px 18px rgba(18, 64, 95, .07);

  --bs-primary: var(--dc-navy);
}

body {
  background: var(--dc-bg);
  color: var(--dc-ink);
  font-family: "Segoe UI", Rubik, Heebo, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page { flex: 1 0 auto; padding-block: 1.5rem 3rem; }

a { color: var(--dc-navy); }

.muted { color: var(--dc-muted); }
.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--dc-navy);
  color: #fff;
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { inset-inline-start: 0; }

:focus-visible { outline: 3px solid var(--dc-gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- header */

.site-header {
  background: linear-gradient(100deg, var(--dc-navy) 0%, var(--dc-navy-dark) 55%, var(--dc-teal) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(13, 48, 73, .18);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.brand img { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1; direction: ltr; }
.brand-text strong { font-size: 1.05rem; letter-spacing: .16em; }
.brand-text small { font-size: .68rem; letter-spacing: .34em; color: var(--dc-gold); }

.site-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.nav-spacer { flex: 1 1 auto; }

.site-nav a,
.nav-logout {
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  padding: .4rem .7rem;
  border-radius: 8px;
  font-size: .95rem;
  background: none;
  border: 0;
}
.site-nav a:hover,
.nav-logout:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.site-nav a.active { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }

.nav-lang { font-size: .85rem !important; opacity: .85; }
.nav-user { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.nav-logout { border: 1px solid rgba(255, 255, 255, .35); }

.dot {
  width: .68rem;
  height: .68rem;
  border-radius: 50%;
  display: inline-block;
  margin-inline-end: .35rem;
  vertical-align: -1px;
}

.nav-toggle {
  display: none;
  margin-inline-start: auto;
  background: none;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 8px;
  padding: .45rem .6rem;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  margin: 4px 0;
}

/* ---------------------------------------------------------------- flashes */

.flashes { margin-bottom: 1rem; }
.flashes .alert { border: 0; border-inline-start: 4px solid currentColor; border-radius: 10px; }

/* ---------------------------------------------------------------- panels */

.panel {
  background: var(--dc-panel);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow);
  padding: 1.25rem;
}
.panel.narrow { max-width: 620px; }

.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--dc-muted); margin-bottom: .5rem; }

.form-label { font-weight: 600; font-size: .92rem; }
.form-control:focus { border-color: var(--dc-navy); box-shadow: 0 0 0 .2rem rgba(18, 64, 95, .15); }

.btn-primary {
  --bs-btn-bg: var(--dc-navy);
  --bs-btn-border-color: var(--dc-navy);
  --bs-btn-hover-bg: var(--dc-navy-dark);
  --bs-btn-hover-border-color: var(--dc-navy-dark);
  --bs-btn-active-bg: var(--dc-navy-dark);
  --bs-btn-active-border-color: var(--dc-navy-dark);
}

.form-actions { display: flex; gap: .5rem; margin-top: 1.5rem; }
.delete-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--dc-line); }

/* ---------------------------------------------------------------- status cards */

.status-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.status-card {
  background: var(--dc-panel);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow);
  padding: .85rem 1rem;
  flex: 1 1 240px;
  min-width: 220px;
}
.status-card.is-main { border-color: rgba(18, 64, 95, .35); }

.status-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }

.car-chip {
  display: inline-block;
  font-weight: 700;
  font-size: .9rem;
  padding: .15rem .6rem;
  border-radius: 999px;
  color: #fff;
  background: var(--c, var(--dc-navy));
}

.badge-main { color: var(--dc-gold); font-size: .95rem; }

.status-line { font-weight: 600; font-size: .95rem; }
.status-line.free { color: #1c7a4a; }
.status-line.busy { color: #a8432c; }
.status-line.blocked { color: var(--dc-muted); }
.status-next { font-size: .82rem; color: var(--dc-muted); margin-top: .2rem; }

.status-cta {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 1.4rem;
  background: var(--dc-navy);
  color: #fff;
  border-radius: var(--dc-radius);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--dc-shadow);
}
.status-cta:hover { background: var(--dc-navy-dark); color: #fff; }

/* ---------------------------------------------------------------- week grid */

.week-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.week-nav { display: flex; gap: .35rem; }
.week-title { font-size: 1.1rem; font-weight: 700; margin: 0; }

.legend { display: flex; gap: .9rem; flex-wrap: wrap; margin-inline-start: auto; font-size: .82rem; color: var(--dc-muted); }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.swatch-blocked {
  background: repeating-linear-gradient(45deg, #c9d3db 0 3px, #eef2f5 3px 6px);
  border: 1px solid #c9d3db;
}

.week-scroll {
  /* Scrolls in both axes inside its own box, so jumping to the current hour
     never moves the page itself. */
  overflow: auto;
  max-height: min(74vh, 900px);
  min-height: 320px;
  overscroll-behavior: contain;
  background: var(--dc-panel);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow);
}

.week-grid {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(130px, 1fr));
  min-width: 980px;
}

.hour-col, .day-col { display: flex; flex-direction: column; }
.day-col { border-inline-start: 1px solid var(--dc-line); }
.day-col.is-today { background: rgba(232, 176, 75, .07); }

.col-head {
  height: 68px;
  padding: .4rem .35rem .3rem;
  border-bottom: 1px solid var(--dc-line);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Stay visible while the grid scrolls. Needs an opaque background or the
     bookings show through. */
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--dc-panel);
}
.is-today .col-head { background: #fdf4e4; }
.day-name { font-weight: 700; font-size: .88rem; line-height: 1.1; }
.day-date { font-size: .72rem; color: var(--dc-muted); }
.is-today .day-name { color: var(--dc-navy); }

.lane-tags { display: flex; gap: 2px; padding-inline: 2px; }
.lane-tag {
  flex: 1 1 0;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  background: var(--c);
  border-radius: 4px 4px 0 0;
  padding: 1px 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-body { position: relative; height: var(--day-h); }

.hour-label {
  position: absolute;
  inset-inline-end: 6px;
  font-size: .68rem;
  color: var(--dc-muted);
  margin-top: 1px;
  direction: ltr;
}

.hour-line {
  position: absolute;
  inset-inline: 0;
  border-top: 1px solid #eef2f5;
}
.hour-line.major { border-top-color: var(--dc-line); }

.lanes { position: absolute; inset: 0; display: flex; gap: 2px; padding-inline: 2px; }
.lane { position: relative; flex: 1 1 0; }

.blocked-block {
  position: absolute;
  inset-inline: 0;
  background: repeating-linear-gradient(45deg, #d5dee5 0 4px, #eef2f5 4px 8px);
  border: 1px solid #cbd6de;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.blocked-block span {
  font-size: .62rem;
  color: #5c6b77;
  font-weight: 600;
  text-align: center;
  padding: 2px;
  line-height: 1.15;
}

.ev {
  position: absolute;
  inset-inline: 0;
  background: var(--c, var(--dc-navy));
  color: #fff;
  border-radius: 6px;
  padding: 2px 4px;
  overflow: hidden;
  text-decoration: none;
  font-size: .68rem;
  line-height: 1.15;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  display: block;
  z-index: 2;
}
.ev:hover { color: #fff; filter: brightness(1.1); z-index: 3; }
.ev.is-mine { box-shadow: 0 0 0 2px var(--dc-gold); }
.ev.is-now { animation: dc-pulse 2.4s ease-in-out infinite; }

.ev-who { display: block; font-weight: 700; }
.ev-time { display: block; opacity: .92; direction: ltr; }
.ev-note { display: block; opacity: .85; font-style: italic; }

@keyframes dc-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(232, 176, 75, .9); }
  50% { box-shadow: 0 0 0 5px rgba(232, 176, 75, .35); }
}
@media (prefers-reduced-motion: reduce) {
  .ev.is-now { animation: none; box-shadow: 0 0 0 2px var(--dc-gold); }
}

.now-line {
  position: absolute;
  inset-inline: 0;
  border-top: 2px solid #d34d3c;
  z-index: 4;
  pointer-events: none;
}
.now-line span {
  position: absolute;
  inset-inline-start: 0;
  top: -8px;
  background: #d34d3c;
  color: #fff;
  font-size: .58rem;
  padding: 0 4px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- lists */

.list-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-header .page-title { margin: 0; }
.scope-switch { display: flex; gap: .35rem; margin-inline-start: auto; }

.booking-table { background: var(--dc-panel); }
.booking-table th { font-size: .82rem; color: var(--dc-muted); text-transform: uppercase; letter-spacing: .04em; }
.booking-table .row-now { background: rgba(232, 176, 75, .12); }

.badge-now {
  background: var(--dc-gold);
  color: #4a3410;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .05rem .5rem;
  margin-inline-start: .35rem;
}

.badge-admin {
  background: var(--dc-teal);
  color: #fff;
  font-size: .68rem;
  border-radius: 999px;
  padding: .05rem .5rem;
  margin-inline-start: .35rem;
}

.status-pill { font-size: .78rem; border-radius: 999px; padding: .12rem .6rem; font-weight: 600; }
.status-pill.ok { background: #e2f3e9; color: #1c7a4a; }
.status-pill.wait { background: #fdf1dc; color: #8a6118; }
.status-pill.locked { background: #fbe3df; color: #a8432c; }

/* ---------------------------------------------------------------- car picker */

.car-picker { border: 0; padding: 0; margin: 0; }
.car-picker legend { float: none; }
.car-picker-note { font-size: .84rem; color: var(--dc-muted); margin-bottom: .6rem; }

.car-choices { display: flex; flex-direction: column; }

.car-swatch {
  width: .85rem;
  height: .85rem;
  border-radius: 4px;
  background: var(--c, var(--dc-navy));
  display: inline-block;
  margin-inline-end: .45rem;
  vertical-align: -1px;
}

.car-role {
  font-size: .74rem;
  font-weight: 600;
  color: var(--dc-muted);
  margin-inline-start: .4rem;
}

.car-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  border: 1px solid var(--dc-line);
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: .5rem;
  cursor: pointer;
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.car-option:hover { border-color: var(--dc-navy); }
.car-option input { margin-top: .2rem; accent-color: var(--dc-navy); }
.car-option:has(input:checked) {
  border-color: var(--c, var(--dc-navy));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--c, var(--dc-navy)) 25%, transparent);
}
.car-option-body { display: flex; flex-direction: column; }
.car-option-name { font-weight: 700; }
.car-option-hint { font-size: .8rem; color: var(--dc-muted); }

.quick-durations { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .75rem; font-size: .85rem; }

/* ---------------------------------------------------------------- invite box */

.invite-box {
  background: #fff8e9;
  border: 1px solid var(--dc-gold);
  border-radius: var(--dc-radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.invite-label { font-weight: 700; margin-bottom: .4rem; }
.invite-link {
  display: block;
  background: #fff;
  border: 1px solid var(--dc-line);
  border-radius: 8px;
  padding: .5rem .7rem;
  word-break: break-all;
  font-size: .85rem;
  color: var(--dc-navy);
}

/* ---------------------------------------------------------------- auth */

.auth-page { background: linear-gradient(140deg, #10394f 0%, #12405f 45%, #0d5f5a 100%); }
.auth-page .page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.auth-page .site-footer { background: transparent; color: rgba(255, 255, 255, .6); border: 0; }

.auth-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.auth-logo { display: block; margin: 0 auto .5rem; max-width: 100%; height: auto; }
.auth-sub { text-align: center; color: var(--dc-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-langs { text-align: center; margin-top: 1.25rem; font-size: .85rem; }

.auth-page .flashes { max-width: 400px; margin-inline: auto; }

/* ---------------------------------------------------------------- misc */

.error-page { text-align: center; padding-block: 3rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--dc-line); line-height: 1; }

.site-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--dc-line);
  color: var(--dc-muted);
  font-size: .82rem;
  padding: 1rem 0;
  text-align: center;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: .75rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a, .nav-logout { width: 100%; text-align: start; }
  .nav-spacer { display: none; }
  .legend { margin-inline-start: 0; }
  .week-title { order: -1; width: 100%; }
}

@media (max-width: 620px) {
  /* Narrower day columns and a shorter day so the week needs less scrolling. */
  .week-grid { grid-template-columns: 42px repeat(7, minmax(86px, 1fr)); min-width: 650px; }
  .col-body { height: calc(var(--day-h) * .72); }
  .hour-label { font-size: .6rem; inset-inline-end: 4px; }
  .lane-tag { font-size: .52rem; letter-spacing: -.02em; }
  .day-name { font-size: .78rem; }
  .ev { font-size: .6rem; padding: 1px 2px; }
  .ev-note { display: none; }
  .blocked-block span { font-size: .55rem; }
  .status-cta { padding: .9rem 1.4rem; justify-content: center; }
}
