/* rates.css — table/poster/editor styling for the rate-list pages.
   Layout (.page-hero, .page-section, .page-wrap, .cta-band) comes from
   pages.css; this file only styles the price table, poster, and jump/search
   controls to match the dark theme (#151515 cards, #67df33 accents). */

/* --- Highlights / Full List toggle -------------------------------------- */
.rates-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: #151515;
  border: 1px solid #252525;
  border-radius: 999px;
}

.rates-view-toggle button {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #9a9a9a;
  cursor: pointer;
}

.rates-view-toggle button[aria-selected="true"] {
  background: #67df33;
  color: #071006;
}

/* --- Pricing disclaimer ------------------------------------------------ */
.rates-disclaimer {
  background: rgba(103, 223, 51, 0.08);
  border: 1px solid rgba(103, 223, 51, 0.28);
  color: #d6d6d6;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 22px;
}

.rates-disclaimer strong {
  color: #67df33;
}

/* --- Jump-to-section + search controls ------------------------------- */
:root {
  --site-header-height: 0px;
  --rates-tools-height: 0px;
}

/* pages.css sets .page-section { overflow: hidden }, which breaks
   position: sticky for any descendant — the rate pages need sticky tools/
   table headers, so this scoping class opts back into normal overflow. */
.rates-section {
  overflow: visible;
}

.rates-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
  position: sticky;
  top: var(--site-header-height);
  z-index: 20;
  background: #0f0f0f;
  padding: 12px 0;
}

.rates-tools select,
.rates-tools input[type="search"] {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(103, 223, 51, 0.42);
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
}

.rates-tools select {
  min-width: 220px;
}

.rates-tools input[type="search"] {
  flex: 1;
  min-width: 200px;
  font-weight: 400;
}

.rates-tools select:focus,
.rates-tools input[type="search"]:focus {
  outline: none;
  border-color: #67df33;
}

.rates-tools option {
  background: #151515;
  color: #fff;
}

/* --- Table card -------------------------------------------------------- */
.rates-table-wrap {
  background: #151515;
  border: 1px solid #252525;
  border-radius: 10px;
}

table.rates {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.rates thead th {
  position: sticky;
  top: var(--rates-tools-height, 0px);
  background: #111;
  color: #67df33;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid #252525;
  z-index: 1;
}

table.rates thead th.num {
  text-align: right;
}

/* Shows the section currently scrolled to the top, pinned just below the
   column header row — updated by wireCurrentSectionBar() in rates-render.js. */
.current-section-bar {
  position: sticky;
  top: calc(var(--rates-tools-height, 0px) + var(--rates-thead-height, 0px));
  z-index: 2;
  background: #67df33;
  color: #071006;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.85rem;
  padding: 10px 16px;
}

.current-section-bar[hidden] {
  display: none;
}

table.rates tbody tr.section-row {
  scroll-margin-top: calc(var(--rates-scroll-offset, 0px) + 8px);
}

table.rates tbody tr.section-row td {
  background: #67df33;
  color: #071006;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.85rem;
  padding: 10px 16px;
}

table.rates tbody tr.svc {
  border-bottom: 1px solid #212121;
}

table.rates tbody tr.svc:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

table.rates tbody tr.svc:hover {
  background: rgba(103, 223, 51, 0.06);
}

table.rates td {
  padding: 12px 16px;
  color: #e8e8e8;
  vertical-align: top;
}

table.rates td.service {
  color: #fff;
  font-weight: 600;
}

table.rates td.service.staff-only {
  font-style: italic;
  color: #d6d6d6;
  font-weight: 400;
}

table.rates .note {
  display: block;
  margin-top: 2px;
  color: #9a9a9a;
  font-size: 0.82rem;
  font-weight: 400;
}

table.rates td.notes {
  color: #9a9a9a;
  font-size: 0.88rem;
}

table.rates td.num {
  text-align: right;
  color: #67df33;
  font-weight: 700;
  white-space: nowrap;
}

table.rates td.num.na {
  color: #6a6a6a;
  font-weight: 400;
}

table.rates td.num.call {
  color: #fff;
  font-weight: 700;
}

table.rates td.allveh {
  text-align: center;
  color: #67df33;
  font-weight: 700;
}

table.rates td.allveh .allveh-label {
  display: block;
  margin-top: 2px;
  color: #9a9a9a;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
}

.error-box {
  background: rgba(211, 47, 47, 0.12);
  border: 1px solid rgba(211, 47, 47, 0.4);
  color: #ff8a80;
  padding: 18px;
  border-radius: 10px;
  font-weight: 600;
}

/* --- Mobile card layout -------------------------------------------------
   Below 700px there's no room for 5 table columns, so each service becomes
   a tappable row: the service name (+ inline price if it's flat/one-price),
   and for rows with distinct per-vehicle prices, a chevron that expands to
   reveal Sedan/SUV/Minivan/Pickup stacked underneath. No horizontal scroll,
   so the sticky toolbar/table-header above keep working (see wrap comment
   in rates-tools). Desktop (>=700px) is untouched, real <table> layout. */
@media (max-width: 699px) {
  table.rates,
  table.rates thead,
  table.rates tbody {
    display: block;
    width: 100%;
  }

  table.rates thead {
    display: none;
  }

  /* Each section already gets its own visible green header row inline in the
     mobile card layout, so the sticky duplicate-name bar is redundant here. */
  .current-section-bar {
    display: none !important;
  }

  table.rates tbody tr.section-row {
    display: block;
  }

  table.rates tbody tr.svc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    cursor: default;
  }

  table.rates tbody tr.expandable {
    cursor: pointer;
  }

  table.rates tbody tr.expandable::after {
    content: "▾";
    order: 3;
    margin-left: auto;
    color: #67df33;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
  }

  table.rates tbody tr.expandable.expanded::after {
    transform: rotate(180deg);
  }

  table.rates td {
    padding: 0;
    border: none;
  }

  table.rates td.service {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Flat rows ("all vehicles" price) show their single price inline next to
     the name — never expandable, so always visible. */
  table.rates td.allveh {
    order: 2;
    flex: 0 0 auto;
    margin-left: 12px;
    text-align: right;
  }

  table.rates td.allveh .allveh-label {
    display: none;
  }

  /* Per-vehicle price cells are hidden until the row is tapped open. */
  table.rates tr.expandable td.num {
    display: none;
    order: 4;
    flex: 1 1 100%;
    justify-content: space-between;
    padding: 8px 0 0 0;
    text-align: left;
    border-top: 1px dashed #212121;
    margin-top: 8px;
  }

  table.rates tr.expandable.expanded td.num {
    display: flex;
  }

  table.rates tr.expandable td.num::before {
    content: attr(data-label);
    color: #9a9a9a;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
  }

  table.rates td.notes {
    order: 5;
    flex: 1 1 100%;
    padding-top: 6px;
  }

  table.rates .note {
    display: inline;
    margin-left: 4px;
  }
}

/* --- Poster (customer highlights) -------------------------------------- */
.poster-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 760px) {
  .poster-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.poster-section {
  background: #151515;
  border: 1px solid #252525;
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 22px;
}

.poster-section h2 {
  margin: 0 0 14px;
  color: #67df33;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #252525;
  padding-bottom: 10px;
}

.poster-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #212121;
}

.poster-item:last-child {
  border-bottom: none;
}

.poster-item .name {
  color: #eee;
  font-weight: 600;
}

.poster-item .price {
  color: #67df33;
  font-weight: 800;
  white-space: nowrap;
}

.poster-item .price .from {
  color: #9a9a9a;
  font-weight: 400;
  font-size: 0.78rem;
  text-transform: uppercase;
  margin-right: 4px;
}

/* --- Staff editor (re-skinned to dark theme) --------------------------- */
:root {
  --toolbar-height: 60px;
  --table-head-height: 38px;
}

.editor-toolbar {
  background: #151515;
  border: 1px solid #252525;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  position: sticky;
  top: var(--site-header-height, 0px);
  z-index: 100;
}

.editor-toolbar .spacer {
  flex: 1;
}

.editor-toolbar button {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 6px;
  border: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
}

.editor-toolbar button:hover:not(:disabled) {
  filter: brightness(1.1);
}

.editor-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: transparent;
  color: #67df33;
  border-color: #67df33 !important;
}

.btn-green {
  background: #67df33;
  color: #071006;
}

.btn-danger-text {
  background: none;
  color: #ff8a80;
  border: none;
  padding: 4px 6px;
  font-size: 15px;
  text-transform: none;
  font-weight: 400;
}

.btn-danger-text:hover {
  background: rgba(211, 47, 47, 0.15);
  border-radius: 4px;
}

.editor-toolbar input[type="text"].search {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(103, 223, 51, 0.42);
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-size: 0.85rem;
  width: 220px;
}

.editor-status {
  font-size: 0.82rem;
  color: #67df33;
  font-weight: 700;
  min-height: 16px;
}

.editor-status.error {
  color: #ff8a80;
}

.editor-status.working {
  color: #9a9a9a;
}

/* No overflow here on purpose: table.edit's own min-width (1180px) can
   exceed the viewport on narrower screens, and the whole page scrolls
   horizontally to reveal it rather than this box scrolling internally --
   that's what keeps position: sticky (toolbar, column headers) working
   against the page instead of getting trapped in a nested scroll box. */
.edit-wrap {
  background: #151515;
  border: 1px solid #252525;
  border-radius: 10px;
}

table.edit {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1180px;
}

table.edit thead th {
  position: sticky;
  top: var(--toolbar-height);
  background: #111;
  color: #67df33;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 8px;
  z-index: 80;
  white-space: nowrap;
  border-bottom: 1px solid #252525;
}

table.edit tbody tr.service-row:nth-of-type(even) {
  background: rgba(255, 255, 255, 0.02);
}

table.edit tbody tr.service-row:hover {
  background: rgba(103, 223, 51, 0.06);
}

table.edit td {
  padding: 4px 6px;
  border-bottom: 1px solid #212121;
  vertical-align: middle;
}

.section-group-row td {
  position: sticky;
  top: calc(var(--toolbar-height) + var(--table-head-height));
  z-index: 50;
  padding: 9px 10px;
  background: #67df33;
  color: #071006;
}

.section-group-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-group-title {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.25px;
}

.section-controls {
  display: flex;
  gap: 6px;
}

.section-controls button {
  padding: 4px 8px;
  font-size: 0.72rem;
  background: rgba(7, 16, 6, 0.15);
  color: #071006;
  border: 1px solid rgba(7, 16, 6, 0.35);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
}

td input[type="text"] {
  width: 100%;
  border: 1px solid #252525;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  font-size: 0.85rem;
  border-radius: 5px;
  font-family: inherit;
  color: #fff;
}

td input[type="text"]:focus {
  outline: none;
  border-color: #67df33;
  background: rgba(255, 255, 255, 0.06);
}

td.price input {
  color: #67df33;
  font-weight: 700;
  width: 70px;
}

td.price input.invalid {
  background: rgba(211, 47, 47, 0.15);
  border: 1.5px solid #ff5252;
  color: #ff8a80;
}

.cell {
  position: relative;
}

.cell textarea {
  display: block;
  width: 100%;
  min-height: 30px;
  resize: none;
  overflow: hidden;
  border: 1px solid #252525;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
  font-family: inherit;
  color: #fff;
  border-radius: 5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell textarea:focus,
.cell textarea.expanded {
  outline: none;
  border-color: #67df33;
  background: rgba(255, 255, 255, 0.06);
}

.cell textarea.expanded {
  position: absolute;
  top: 0;
  left: 0;
  width: max(280px, 180%);
  max-width: 420px;
  min-height: 100%;
  z-index: 120;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.section-select {
  width: 100%;
  border: 1px solid #252525;
  background: #111;
  padding: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}

.cell input[type="text"].newsection {
  width: 100%;
  border: 1px solid #67df33;
  border-radius: 5px;
  padding: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

td.checkbox-cell {
  text-align: center;
}

td.checkbox-cell input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

td.order-cell {
  text-align: center;
  white-space: nowrap;
}

.order-btn {
  padding: 4px 7px;
  margin: 0 1px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #252525;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}

td.delete-cell {
  text-align: center;
}

.row-count {
  font-size: 0.82rem;
  color: #9a9a9a;
  margin: 12px 2px 0;
}

.editor-legend {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: #9a9a9a;
  margin: 10px 2px 0;
  flex-wrap: wrap;
}

.editor-legend b {
  color: #d6d6d6;
}

.editor-notice {
  background: rgba(103, 223, 51, 0.1);
  border: 1px solid rgba(103, 223, 51, 0.3);
  color: #d8f5c9;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.loading {
  color: #9a9a9a;
  padding: 40px 0;
  text-align: center;
}
