/* ===============================
   THEME VARIABLES — Industrial Blue
================================= */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;600;700;800&family=Lexend:wght@400;500;700&display=swap');

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1d3557;
  --muted: #4a6080;

  --border: #d8dde6;
  --border2: #c8cfd9;

  --primary: #1d3557;
  --primary-hover: #162843;

  --accent: #e63946;
  --accent-hover: #c1121f;

  --danger: #e63946;
  --danger-hover: #c1121f;

  --btn-bg: #eaecf0;
  --btn-bg-hover: #d8dde6;

  --shadow: 0 2px 12px rgba(29, 53, 87, 0.10);

  --heading-font: 'Raleway', sans-serif;
  --body-font: 'Lexend', sans-serif;
}

/* ===============================
   BASE
================================= */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--text);
}

h1 {
  margin: 18px 0 12px 0;
  font-size: 26px;
  font-weight: 800;
  font-family: var(--heading-font);
  color: var(--primary);
}

h2 {
  margin: 14px 0 10px 0;
  font-size: 18px;
  font-weight: 800;
  font-family: var(--heading-font);
  color: var(--primary);
}

p { margin: 0 0 10px 0; }

/* Page container */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px 18px 18px;
}

.wrap, .container, main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
}

/* ===============================
   BOOKING FORM WRAP
================================= */
.formWrap {
  max-width: 520px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.formWrap h1 {
  text-align: center;
  margin-top: 0;
  color: var(--primary);
}

/* ===============================
   DATE INPUT — full click area
================================= */
input[type="date"] {
  cursor: pointer;
  width: 100%;
  position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ===============================
   APP NAV
================================= */
#topNav {
  margin: 0 auto;
  max-width: 100%;
  padding: 0;
}

.appNav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  height: 56px;
  background: var(--primary);
  box-shadow: 0 2px 12px rgba(29,53,87,0.18);
}

.appNavLeft,
.appNavRight {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.appNavBrand {
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  font-family: var(--heading-font);
  color: #ffffff;
  padding: 6px 12px 6px 0;
  margin-right: 4px;
  border-right: 2px solid rgba(255,255,255,0.2);
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: opacity 0.2s;
}

.appNavBrand:hover { opacity: 0.85; }

.appNavLink {
  text-decoration: none;
  font-weight: 600;
  font-family: var(--body-font);
  font-size: 12.5px;
  color: rgba(255,255,255,0.88);
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.appNavLink:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.appNavSignedIn {
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  font-family: var(--body-font);
}

/* ===============================
   VERIFICATION BANNER
================================= */
.verificationBannerInner {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  color: #92400e;
  font-size: 14px;
  margin-bottom: 12px;
}

/* ===============================
   NO OPTIMAL PANEL
================================= */
.noOptimalCard {
  background: #fff;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.noOptimalTitle {
  font-weight: 800;
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 4px;
  font-family: var(--heading-font);
}

.noOptimalSubtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ===============================
   LANGUAGE TOGGLE
================================= */
.langToggle {
  display: flex;
  gap: 4px;
}

.langBtn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  font-family: var(--body-font);
  transition: background 0.2s;
}

.langBtn:hover { background: rgba(255,255,255,0.2); }

.langBtnActive {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===============================
   HAMBURGER / MOBILE MENU
================================= */
.hamburgerBtn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #ffffff;
  padding: 4px 8px;
}

.mobileMenu {
  display: none;
  flex-direction: column;
  background: var(--primary);
  border-right: 1px solid rgba(255,255,255,0.1);
  padding: 20px 16px;
  gap: 10px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 240px;
  z-index: 999;
  box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.mobileMenu.mobileMenuOpen {
  display: flex;
  transform: translateX(0);
}

.mobileMenuLink {
  text-decoration: none;
  font-weight: 600;
  font-family: var(--body-font);
  color: rgba(255,255,255,0.9);
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobileMenuLink:hover { background: rgba(255,255,255,0.12); }

@media (max-width: 768px) {
  .appNavLeft { display: flex; }
  .appNavLeft .appNavLink { display: none; }
  .hamburgerBtn { display: inline-block; }
  .appNavSignedIn { display: none; }
}

/* ===============================
   CARDS
================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 12px 0;
}

/* ===============================
   TABLES
================================= */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

th {
  text-align: left;
  padding: 10px;
  background: #e8ecf1;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--primary);
  font-family: var(--heading-font);
  font-weight: 700;
}

td {
  padding: 10px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
  font-family: var(--body-font);
  font-size: 14px;
}

tr:hover { background: #f5f7fa; }

.right { text-align: right; }

/* ===============================
   FORMS
================================= */
label {
  font-weight: 600;
  font-size: 13px;
  font-family: var(--body-font);
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  font-size: 14px;
  font-family: var(--body-font);
  background: #f8f9fb;
  color: var(--text);
  transition: border 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,53,87,0.12);
  background: #ffffff;
}

textarea { min-height: 90px; resize: vertical; }

/* ===============================
   BUTTONS
================================= */
.btn {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--btn-bg);
  color: var(--primary);
  font-weight: 700;
  font-family: var(--heading-font);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.btn:hover:not(:disabled) { background: var(--btn-bg-hover); }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btnPrimary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btnPrimary:hover:not(:disabled) { background: var(--accent-hover); }

.btnDanger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btnDanger:hover:not(:disabled) { background: var(--danger-hover); }

.btnMuted {
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.5);
  color: #ffffff;
  font-family: var(--body-font);
}

.btnMuted:hover:not(:disabled) { background: rgba(255,255,255,0.35); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===============================
   UTILS
================================= */
.row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.row > div {
  min-width: 220px;
  flex: 1;
}

.muted { font-size: 12px; color: var(--muted); }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--body-font);
  border: 1px solid #dadce0;
  background: #f2f4f7;
}

.tagEstimate { background: #fff8e1; border-color: #fbbc04; color: #7a5800; }
.tagCompleted { background: #e6f4ea; border-color: #34a853; color: #1e6e3a; }
.tagCancelled { background: #fce8e6; border-color: #e63946; color: #c1121f; }

/* ===============================
   LOGO CIRCLE (contractor avatars)
================================= */
.logoCircle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  font-family: var(--heading-font);
  flex-shrink: 0;
}

/* ===============================
   FULLCALENDAR — prevent table style bleed
================================= */
.fc thead { background: transparent !important; }
.fc th { background: #fff !important; color: var(--primary) !important; font-family: var(--heading-font) !important; }
.fc tr:hover { background: transparent !important; }
.fc table { background: transparent !important; box-shadow: none !important; border-radius: 0 !important; }


/* ===============================
   MOBILE RESPONSIVE
   Added for PWA readiness
================================= */

/* --- General layout --- */
@media (max-width: 768px) {
  .wrap, .container, main, .page {
    padding: 12px;
  }

  h1 { font-size: 20px; margin: 12px 0 10px 0; }
  h2 { font-size: 16px; }

  .card { padding: 12px; margin: 8px 0; }

  /* Row stacks vertically on mobile */
  .row { flex-direction: column; gap: 10px; }
  .row > div { min-width: 100%; flex: unset; }

  /* Bigger touch targets for buttons */
  .btn {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
  }

  /* Bigger inputs for thumbs — 16px prevents iOS auto-zoom on focus */
  input, select, textarea {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
  }
}

/* --- Booking form --- */
@media (max-width: 768px) {
  .formWrap {
    padding: 18px 14px;
    border-radius: 10px;
    margin: 0;
  }
}

/* --- Tables scroll horizontally on mobile --- */
@media (max-width: 768px) {
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    font-size: 13px;
  }

  .card table thead,
  .card table tbody,
  .card table tfoot {
    display: table;
    width: 100%;
  }

  th, td { padding: 8px 10px; }

  /* Actions buttons wrap on mobile */
  .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
  }

  .actions .btn {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 36px;
  }
}

/* --- Quote builder --- */
@media (max-width: 768px) {
  .qb-wrap { padding: 0 0 32px 0; }

  .qb-customer {
    grid-template-columns: 1fr !important;
    gap: 14px;
    padding: 14px;
  }

  .qb-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .qb-items-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .qb-totals { padding: 12px 14px; }
  .qb-totals-row { gap: 16px; }

  .qb-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .qb-actions { flex-direction: column; }
  .qb-actions .btn { width: 100%; text-align: center; }
}

/* --- Stats bar (dispatch queue + quotes page) --- */
@media (max-width: 768px) {
  .stats-bar { flex-direction: column; }
  .stat-card { min-width: unset; }
}

/* --- Tags --- */
@media (max-width: 768px) {
  .tag { font-size: 11px; padding: 3px 8px; }
}

/* --- Dark overlay when mobile menu is open --- */
.mobileMenuOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 998;
}

.mobileMenuOverlay.active { display: block; }