/* ═══════════════════════════════════════════════════
   Houlihan & Co – QA System  |  app.css
   ═══════════════════════════════════════════════════ */

:root {
  --hq-navy:       #0f2044;
  --hq-navy-mid:   #1e3a6e;
  --hq-navy-light: #2e5298;
  --hq-accent:     #e8edf5;
  --hq-border:     #d0d8e8;
  --hq-text:       #1a2340;
  --hq-muted:      #6c7a96;
}

/* ── Base ──────────────────────────────────────────── */
body {
  background: #f4f6fb;
  color: var(--hq-text);
  font-size: 0.9rem;
}

a { color: var(--hq-navy-light); text-decoration: none; }
a:hover { color: var(--hq-navy); text-decoration: underline; }

/* ── Navbar ────────────────────────────────────────── */
.hq-navbar {
  background: var(--hq-navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  min-height: 56px;
}
.hq-brand-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
  margin-left: 4px;
  border-left: 1px solid rgba(255,255,255,.3);
  padding-left: 8px;
}
.hq-navbar .nav-link { color: rgba(255,255,255,.8); font-size: .88rem; }
.hq-navbar .nav-link:hover,
.hq-navbar .nav-link.active { color: #fff; }

/* ── Breadcrumb ────────────────────────────────────── */
.hq-breadcrumb {
  background: var(--hq-accent);
  border-bottom: 1px solid var(--hq-border);
  font-size: .82rem;
}
.hq-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--hq-muted); }

/* ── Main content ──────────────────────────────────── */
.hq-main { padding: 1.25rem 1rem 3rem; }

/* ── Footer ────────────────────────────────────────── */
.hq-footer {
  background: var(--hq-navy);
  padding: .6rem 0;
  margin-top: auto;
  color: rgba(255,255,255,.5);
  font-size: .78rem;
}

/* ── Buttons ───────────────────────────────────────── */
.hq-btn-primary {
  background: var(--hq-navy);
  border-color: var(--hq-navy);
  color: #fff;
}
.hq-btn-primary:hover, .hq-btn-primary:focus {
  background: var(--hq-navy-mid);
  border-color: var(--hq-navy-mid);
  color: #fff;
}

/* ── Cards ─────────────────────────────────────────── */
.card {
  border: 1px solid var(--hq-border);
  border-radius: .5rem;
  box-shadow: 0 1px 4px rgba(15,32,68,.07);
}
.hq-card-header {
  background: var(--hq-navy);
  color: #fff;
  border-bottom: none;
  border-radius: .5rem .5rem 0 0 !important;
  padding: .75rem 1rem;
}
.hq-card-header .btn-outline-light { border-color: rgba(255,255,255,.5); }
.hq-card-header-light {
  background: var(--hq-accent);
  border-bottom: 1px solid var(--hq-border);
  padding: .5rem 1rem;
}

/* ── Modal ─────────────────────────────────────────── */
.hq-modal-header {
  background: var(--hq-navy);
  color: #fff;
  border-radius: .375rem .375rem 0 0;
}

/* ── Text colours ──────────────────────────────────── */
.hq-text-navy { color: var(--hq-navy); }

/* ── Page header ───────────────────────────────────── */
.hq-page-header { padding: .5rem 0 1rem; }
.hq-page-header h2 { color: var(--hq-navy); font-size: 1.6rem; }

/* ── Login page ────────────────────────────────────── */
.hq-login-body {
  background: linear-gradient(135deg, #0f2044 0%, #1e3a6e 60%, #2e5298 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hq-login-wrap { width: 100%; max-width: 420px; padding: 1rem; }
.hq-login-card { border: none; border-radius: 1rem; }
.hq-login-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--hq-navy);
  color: #fff; font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

/* ── Dashboard stats ───────────────────────────────── */
.hq-stat-card {
  border-left: 4px solid var(--hq-navy);
  transition: transform .15s;
}
.hq-stat-card:hover { transform: translateY(-2px); }
.hq-stat-icon { font-size: 1.6rem; margin-bottom: .3rem; }
.hq-stat-num  { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--hq-navy); }
.hq-stat-label{ font-size: .78rem; color: var(--hq-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Site list row ─────────────────────────────────── */
.hq-site-row { transition: background .1s; }
.hq-site-row:hover { background: var(--hq-accent); }

/* ── Plot cards ────────────────────────────────────── */
.hq-plot-card { border-left: 3px solid var(--hq-navy-light); }
.hq-plot-btn {
  background: var(--hq-accent);
  border: 1px solid var(--hq-border);
  color: var(--hq-navy);
  font-size: .75rem;
  padding: .2rem .45rem;
  line-height: 1.3;
  border-radius: .25rem;
  transition: background .1s;
}
.hq-plot-btn:hover { background: var(--hq-navy); color: #fff; border-color: var(--hq-navy); }

/* ── Form type card ────────────────────────────────── */
.hq-form-type-card { border-top: 3px solid var(--hq-navy-light); }
.hq-qir-badge {
  background: var(--hq-navy);
  color: #fff;
  font-size: .75rem;
  border-radius: .25rem;
  padding: .2rem .45rem;
}

/* ── Form edit page ────────────────────────────────── */
.hq-save-bar {
  background: #fff;
  border: 1px solid var(--hq-border);
  border-radius: .5rem;
  padding: .6rem 1rem;
  position: sticky;
  top: 56px;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(15,32,68,.08);
}

/* ── Checklist (div-based, replaces table layout) ────── */
.hq-checklist {
  border: 1px solid var(--hq-border);
  border-radius: .375rem;
  font-size: .83rem;
}

/* Column header row */
.hq-cl-head {
  display: flex;
  background: #f0f3fa;
  border-bottom: 2px solid var(--hq-border);
  border-radius: .375rem .375rem 0 0;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--hq-muted);
  white-space: nowrap;
}

/* Item row */
.hq-cl-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--hq-border);
  background: #fff;
}
.hq-cl-row:last-child { border-bottom: none; border-radius: 0 0 .375rem .375rem; }
.hq-cl-row:hover { background: #fafbff; }

/* Cells shared styles */
.hq-cl-head > div,
.hq-cl-row  > div {
  padding: .45rem .55rem;
  border-right: 1px solid var(--hq-border);
  display: flex;
  align-items: center;
}
.hq-cl-head > div:last-child,
.hq-cl-row  > div:last-child { border-right: none; }

/* Item number column */
.hq-cl-item-no {
  width: 60px;
  flex-shrink: 0;
  justify-content: center;
  font-weight: 700;
  color: var(--hq-muted);
}

/* Description column */
.hq-cl-desc {
  flex: 2;
  min-width: 0;
}

/* Generic field column */
.hq-cl-col {
  flex: 1;
  min-width: 0;
}

/* Photos column */
.hq-cl-photos {
  width: 82px;
  flex-shrink: 0;
  justify-content: center;
}

/* Fixed-width column types */
.hq-cl-col--checkbox    { width: 76px;  flex: none; justify-content: center; }
.hq-cl-col--date        { width: 130px; flex: none; }
.hq-cl-col--user_select { width: 155px; flex: none; }
.hq-cl-col--number      { width: 88px;  flex: none; }
.hq-cl-col--yes_no      { width: 88px;  flex: none; }
.hq-cl-col--text.hq-cl-col { width: 108px; flex: none; }

/* Controls fill their column */
.hq-cl-col .form-control,
.hq-cl-col .form-select { width: 100%; font-size: .8rem; }
.hq-cl-col textarea.form-control { min-height: 48px; resize: vertical; }
.hq-cl-photos .hq-upload-btn { width: 100%; }

/* ── Form builder ──────────────────────────────────── */
.hq-builder-table { font-size: .85rem; }
.hq-builder-table th { font-size: .78rem; white-space: nowrap; background: #f0f3fa; }
.hq-nav-active { background: var(--hq-navy) !important; color: #fff !important; }
.hq-nav-active .text-muted { color: rgba(255,255,255,.6) !important; }
.hq-nav-active .badge { background: rgba(255,255,255,.2) !important; }

/* ── Upload thumbnails ─────────────────────────────── */
.hq-upload-thumb-col { }
.hq-thumb-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: .375rem; border: 1px solid var(--hq-border);
}
.hq-thumb-pdf {
  width: 100%; aspect-ratio: 1;
  background: #f8f0ff; border: 1px solid #d9b8f5; border-radius: .375rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #6f42c1;
}

/* ── Signatures ────────────────────────────────────── */
.hq-sig-card { border-color: var(--hq-border); }
.hq-sig-canvas-wrap {
  border: 2px dashed var(--hq-border);
  border-radius: .375rem;
  background: #fdfdff;
}
.hq-sig-canvas {
  width: 100%; height: 130px; display: block;
  border-radius: .25rem;
  touch-action: none; cursor: crosshair;
}
.hq-sig-img { max-height: 80px; border: 1px solid var(--hq-border); border-radius: .25rem; }

/* ── Queries ───────────────────────────────────────── */
.hq-query-closed { background: #f0fff4; }

/* ── Mobile: checklist cards ─────────────────────────── */
@media (max-width: 767px) {
  .hq-main { padding: .6rem .4rem 4rem; }
  .hq-save-bar { top: 0; border-radius: 0; flex-wrap: wrap; gap: .4rem !important; padding: .5rem .75rem; }

  /* Outer container loses its border — rows become individual cards */
  .hq-checklist { border: none; border-radius: 0; background: transparent; }

  /* Header row hidden on mobile */
  .hq-cl-head { display: none; }

  /* Each item row = a card */
  .hq-cl-row {
    flex-direction: column;
    border: 1px solid var(--hq-border);
    border-radius: .5rem;
    margin-bottom: .85rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15,32,68,.07);
  }
  .hq-cl-row:last-child { border-radius: .5rem; border-bottom: 1px solid var(--hq-border); }
  .hq-cl-row:hover { background: #fff; }

  /* All cells: full width, reset border */
  .hq-cl-head > div,
  .hq-cl-row  > div {
    width: 100% !important;
    flex: none !important;
    border-right: none;
    border-bottom: 1px solid #eef1f8;
    min-height: 44px;
    padding: .5rem .85rem;
  }
  .hq-cl-row > div:last-child { border-bottom: none; }

  /* Item number = navy card header */
  .hq-cl-item-no {
    background: var(--hq-navy);
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    min-height: 36px !important;
    justify-content: flex-start;
    border-radius: .5rem .5rem 0 0;
  }

  /* Description = accent block */
  .hq-cl-desc {
    background: var(--hq-accent);
    font-weight: 500;
    font-size: .92rem;
    border-bottom: 2px solid var(--hq-border) !important;
    align-items: flex-start;
  }

  /* Field columns: show label on left, control on right */
  .hq-cl-col,
  .hq-cl-photos,
  .hq-cl-desc[data-label] {
    display: flex;
    align-items: center;
    gap: .5rem;
  }
  .hq-cl-col::before,
  .hq-cl-photos::before,
  .hq-cl-desc[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: .7rem;
    color: var(--hq-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 105px;
    flex-shrink: 0;
  }
  /* Plain-text description (no input): block layout */
  .hq-cl-desc:not([data-label]) {
    display: block;
  }

  /* Controls stretch to remaining space */
  .hq-cl-col .form-control,
  .hq-cl-col .form-select,
  .hq-cl-col .form-check,
  .hq-cl-desc[data-label] .form-control,
  .hq-cl-photos .hq-upload-btn { flex: 1; min-width: 0; font-size: .95rem; height: 44px; }
  .hq-cl-col textarea.form-control,
  .hq-cl-desc[data-label] textarea.form-control { height: auto; min-height: 70px; }
  .hq-cl-col .form-check {
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
  }
  .hq-cl-col .form-check-input { width: 2.5em; height: 1.4em; margin: 0; flex-shrink: 0; }
}

/* ── Touch-friendly controls on tablets ──────────────── */
@media (max-width: 991px) {
  .hq-cl-col .form-select-sm,
  .hq-cl-col .form-control-sm { font-size: .875rem; }
  .hq-sig-canvas { height: 150px; }
}

/* ── Offline badge animation ───────────────────────── */
#offlineBadge { animation: pulse 1.5s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── btn-xs utility ─────────────────────────────────── */
.btn-xs {
  padding: .15rem .35rem;
  font-size: .75rem;
  border-radius: .2rem;
  line-height: 1.4;
}
