/* =========================
   Estimate – Service Pages
   ========================= */

/* Page wrapper */
.estimate-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3.5rem 2rem 4rem;
}

/* -------------------------
   Service Header
   ------------------------- */

.service-header {
  max-width: 640px;
  margin-bottom: 3rem;
}

.service-header h1 {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.service-intro {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* -------------------------
   Base Package Section
   ------------------------- */

.base-package {
  display: block;
  margin-bottom: 2.5rem;
}

.base-package h2 {
  margin: 0 0 0.25rem 0;
}

/* Accordion header — full-width orange bar on desktop */
.base-package .accordion-toggle {
  display: block;
  width: 100%;
  background: var(--fox-orange);
  color: var(--white);
  border: none;
  padding: 0.95rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
}

.base-package .accordion-toggle::after {
  content: "▾";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  transition: transform 0.18s ease;
}

.base-package .accordion-toggle[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(180deg);
}

.package-description {
  background: transparent;
  padding: 0.5rem 0 0;
}

/* Accordion panel animation */
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms ease;
}

/* Grid for included / good-to-know columns */
.package-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .package-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Mobile: stack estimate rows as cards */
@media (max-width: 768px) {
  /* Only target strategy estimate tables */
  .estimate-table.estimate-table--strategy table,
  .estimate-table.estimate-table--strategy thead,
  .estimate-table.estimate-table--strategy tbody,
  .estimate-table.estimate-table--strategy tr,
  .estimate-table.estimate-table--strategy th,
  .estimate-table.estimate-table--strategy td {
    display: block;
    width: 100%;
  }

  /* hide column headers on mobile */
  .estimate-table.estimate-table--strategy thead { display: none; }

  /* make each logical row a stacked card */
  .estimate-table.estimate-table--strategy tbody { padding: 0; }

  .estimate-table.estimate-table--strategy tr.estimate-item {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .estimate-table.estimate-table--strategy tr.estimate-item td {
    padding: 0;
    border: none;
    display: block;
  }

  /* Title and short description (first column) */
  .estimate-table.estimate-table--strategy .estimate-item td:first-child {
    order: 1;
  }
  .estimate-table.estimate-table--strategy .estimate-item td:first-child strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
  }
  .estimate-table.estimate-table--strategy .estimate-item td:first-child .row-note {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
  }

  /* Base/Add-on label (second column) */
  .estimate-table.estimate-table--strategy .estimate-item td:nth-child(2) {
    order: 2;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
  }

  /* Amount (last column) - show prominently */
  .estimate-table.estimate-table--strategy .estimate-item td:nth-child(5) {
    order: 3;
    text-align: right;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
  }

  /* Hide unit price column on mobile (we show only final amount). Keep qty (checkbox) visible but move it to bottom. */
  .estimate-table.estimate-table--strategy .estimate-item td:nth-child(4) {
    display: none;
  }

  /* For add-ons, move checkbox/controls to bottom */
  .estimate-table.estimate-table--strategy .estimate-item td:nth-child(3) {
    order: 99; /* keep at bottom if visible */
  }

  /* Ensure inputs/checkbox labels are visible and full width when shown */
  .estimate-table.estimate-table--strategy .estimate-item label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Small adjustments to keep table visuals tidy on mobile */
  .estimate-table.estimate-table--strategy { margin-top: 1.5rem; }
}

/* Two-column variant for specific pages (strategy-direction) */
.base-package--two-col .package-grid {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
  /* Ensure two-col variant stacks on small screens */
  .base-package--two-col .package-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.package-description h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0.85rem 0 0.4rem;
}

.package-description ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* 1. Description cell as vertical stack */
.estimate-table td:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Totals rows should use normal table-cell behavior so colspan aligns columns correctly */
.estimate-table .totals-row td:first-child {
  display: table-cell;
}

/* 2. Group controls visually */
.addon-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* 3. Shrink inputs and selects in the estimate table */
.estimate-table input,
.estimate-table select {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  box-sizing: border-box;
}

/* 4. remove button style (calm) */
.remove-row-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.remove-row-btn:hover {
  color: var(--fox-orange);
}

.package-description li {
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

.package-description ul.muted li {
  color: var(--text-muted);
}

/* -------------------------
   Estimate Table
   ------------------------- */

.estimate-table {
  margin-top: 2.5rem;
}

.estimate-table h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 20px var(--shadow-soft);
}

thead {
  background: rgba(0, 0, 0, 0.04);
}

th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.9rem 1rem;
}

td {
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  vertical-align: top;
  text-align: left;
}

/* Right-align numeric columns (Unit Price, Amount) */
.estimate-table table th:nth-child(5),
.estimate-table table th:nth-child(6),
.estimate-table table td:nth-child(5),
.estimate-table table td:nth-child(6) {
  text-align: right;
}

.align-right {
  text-align: right;
}

/* Constrain input and select widths */
.estimate-table input[type="number"] {
  width: 64px;
  max-width: 100%;
  box-sizing: border-box;
}

.estimate-table select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.estimate-table input[type="text"].addon-asset-type {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Base row styling */
.base-row {
  background: rgba(180, 86, 40, 0.05);
}

.base-row strong {
  font-weight: 600;
  color: var(--text-primary);
}

.row-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* -------------------------
   Estimate Actions
   ------------------------- */

.estimate-actions {
  margin-top: 1rem;
}

.btn-secondary {
  background: transparent;
  border: 1px dashed var(--border-default);
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

/* -------------------------
   Footer Note + CTA
   ------------------------- */

.estimate-footer-note {
  margin-top: 3rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.estimate-footer-note p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  flex: 1 1 auto;
  max-width: 72ch;
  margin-right: 1rem;
}

.estimate-footer-note .footer-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 auto;
  max-width: 72ch;
  margin-right: 1rem;
}

/* Reuse base button but make the footer CTA prominent */
.estimate-footer-note .btn-enter {
  font-size: 0.85rem;
  padding: 10px 20px;
  margin-left: auto;
  background: var(--fox-orange);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(180, 86, 40, 0.12);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.estimate-footer-note .btn-enter:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(180, 86, 40, 0.14);
  opacity: 0.98;
}

.estimate-footer-note .btn-enter:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 165, 80, 0.12), 0 10px 22px rgba(180, 86, 40, 0.14);
}

@media (max-width: 768px) {
  .estimate-footer-note {
    flex-direction: column;
    align-items: stretch;
  }

  .estimate-footer-note p {
    margin-bottom: 0.75rem;
    max-width: 100%;
    margin-right: 0;
  }

  .estimate-footer-note .btn-enter {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }
}

/* -------------------------
   Maintenance note styling
   Keep visual parity with table rows (left text + right-aligned amount)
   ------------------------- */
.estimate-footnote {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  background: transparent;
}

.estimate-footnote .maintenance-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.estimate-footnote .maintenance-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.estimate-footnote .maintenance-right {
  min-width: 160px;
}

.estimate-footnote .maintenance-helpers {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* -------------------------
   Mobile Layout: Estimate Table
   ------------------------- */

@media (max-width: 768px) {
  .estimate-page {
    padding: 2.5rem 1.25rem 3rem;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    font-size: 0.85rem;
  }

  th {
    padding: 0.7rem;
  }

  td {
    padding: 0.8rem;
  }

  /* Reset column widths on small screens */
  .estimate-table table th,
  .estimate-table table td {
    width: auto;
  }

  /* Convert table rows into stacked cards */
  .estimate-table table {
    display: block;
    table-layout: auto;
  }

  .estimate-table thead {
    display: none;
  }

  .estimate-table tbody {
    display: block;
  }

  .estimate-table tr {
    display: block;
    gap: 0.75rem;
    padding: 1rem;
    /* remove horizontal divider lines on mobile and show card spacing */
    border-bottom: none;
    margin-bottom: 1rem;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(19, 19, 19, 0.04);
  }

  .estimate-table td {
    display: block;
    padding: 0.25rem 0.5rem;
    border-top: none;
  }

  /* For normal rows (not totals) on mobile: Description spans full width on top;
     Category and Type sit side-by-side in a 2-column row (labels shown via ::before),
     Qty/Unit/Amount sit on the following row. */
  .estimate-table tr:not(.totals-row) {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
    gap: 0.5rem;
    padding: 1rem;
  }

  .estimate-table tr:not(.totals-row) td:nth-child(1) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  /* Category and Type become a 2x2 visual block: each has its label (::before)
     and value below; place them side-by-side using the first two columns. */
  .estimate-table tr:not(.totals-row) td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .estimate-table tr:not(.totals-row) td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  /* Qty / Unit / Amount remain on the next row */
  .estimate-table tr:not(.totals-row) td:nth-child(4) {
    grid-column: 1;
    grid-row: 3;
  }

  .estimate-table tr:not(.totals-row) td:nth-child(5) {
    grid-column: 2;
    grid-row: 3;
  }

  .estimate-table tr:not(.totals-row) td:nth-child(6) {
    grid-column: 3;
    grid-row: 3;
  }

  /* Slightly smaller label for the compact grid columns */
  .estimate-table tr:not(.totals-row) td:nth-child(4)::before,
  .estimate-table tr:not(.totals-row) td:nth-child(5)::before,
  .estimate-table tr:not(.totals-row) td:nth-child(6)::before {
    font-size: 0.675rem;
    margin-bottom: 0.125rem;
    color: var(--text-muted);
    display: block;
  }

  /* Place the remove button top-right without overlapping important content */
  .estimate-table tr:not(.totals-row) td:nth-child(7) {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    display: block;
    padding: 0;
  }

  .estimate-table td:nth-child(1)::before { content: "Description"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(2)::before { content: "Category"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(3)::before { content: "Type"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(4)::before { content: "Qty"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(5)::before { content: "Unit Price"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(6)::before { content: "Amount"; display: block; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.25rem; }
  .estimate-table td:nth-child(7)::before { content: ""; display: block; margin-bottom: 0.25rem; }

  .estimate-table input,
  .estimate-table select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .estimate-table input[type="number"] {
    width: 100%;
    max-width: 100%;
  }

  .estimate-table td:nth-child(5),
  .estimate-table td:nth-child(6) {
    text-align: left;
  }

  .estimate-table td:last-child {
    justify-self: end;
    align-self: start;
    display: block;
    padding: 0;
  }

  .remove-row-btn {
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    margin: 0;
  }

  .estimate-table .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: none;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(19, 19, 19, 0.04);
    margin-bottom: 1rem;
  }

  .estimate-table .totals-row td {
    padding: 0;
  }

  .estimate-table .totals-row td:first-child {
    flex: 1 1 auto;
    font-weight: 600;
    color: var(--text-primary);
  }

  .estimate-table .totals-row td:nth-child(2) {
    flex: 0 0 auto;
    text-align: right;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
  }

  /* hide any trailing empty cell used for spacing in desktop HTML */
  .estimate-table .totals-row td:nth-child(3) {
    display: none;
  }
  /* Hide redundant labels for totals rows on mobile (Description/Category/Type) */
  .estimate-table .totals-row td:nth-child(1)::before,
  .estimate-table .totals-row td:nth-child(2)::before,
  .estimate-table .totals-row td:nth-child(3)::before {
    display: none;
    content: none;
  }
}

/* =========================
   Add Service Picker
   ========================= */

.add-service-picker {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 4px 12px var(--shadow-soft);

  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.add-service-picker select {
  flex: 1 1 220px;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--white);
  font-size: 0.9rem;
}

.add-service-picker select:focus {
  outline: none;
  border-color: var(--fox-orange);
}

.add-service-picker .btn-secondary {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.add-service-picker .btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.add-service-picker .btn-ghost:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Make Add (primary) match Cancel (secondary) inside the picker */
.add-service-picker .btn-primary {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Mobile tightening */
@media (max-width: 600px) {
  .add-service-picker {
    flex-direction: column;
    align-items: stretch;
  }

  .add-service-picker select,
  .add-service-picker .btn-secondary,
  .add-service-picker .btn-ghost {
    width: 100%;
  }
}

.add-service-picker[hidden] {
  display: none;
}

/* -------------------------
   Video Editing Inputs
   ------------------------- */
.duration-input {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.duration-input .unit-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-estimate-inputs {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: 0 6px 20px var(--shadow-soft);
}

.video-estimate-inputs h3 {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.video-estimate-inputs .field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem 1.5rem;
}

.video-estimate-inputs .field-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.video-estimate-inputs .field-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.video-estimate-inputs input[type="date"] {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-secondary);
}

.video-estimate-inputs .choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.35rem 0.75rem;
}

.video-estimate-inputs .choice-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.video-estimate-inputs .choice-item input {
  margin: 0;
}

@media (max-width: 640px) {
  .video-estimate-inputs {
    padding: 1.25rem;
  }

  .video-estimate-inputs .field-grid {
    grid-template-columns: 1fr;
  }
}

.add-service-picker {
  animation: pickerFade 0.15s ease-out;
}

@keyframes pickerFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

