/* UniFix Engineer App – Technician mobile app
   Professional, modern, tech-inspired. Data/fields unchanged; design only.
   Palette: Gray (primary), Green (action/completion), White, Dark Gray, Yellow (warnings), Red (urgent), Light Gray (bg).
   Typography: Montserrat/Roboto headings, Lato body. Minimalist icons.
   Fonts loaded in includes/header_script.php.
*/
:root {
  /* Primary & action */
  --primary: #374151;
  --primary-hover: #1F2937;
  --accent: #9CA3AF;
  --accent-hover: #6B7280;
  --success: #059669;
  --success-hover: #047857;
  /* Alerts */
  --warning: #eab308;
  --warning-bg: #fef9c3;
  --error: #dc2626;
  --error-bg: #fee2e2;
  /* Neutrals */
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --border: #D1D5DB;
  /* UI */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --font-heading: 'Montserrat', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Lato', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  margin: 0;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .eng-card h2, .dash-card h3 {
  font-family: var(--font-heading);
  font-weight: 600;
}

/* ----- Header ----- */
.eng-header-wrap { position: relative; }

.eng-header {
  position: sticky;
  top: 0;
  z-index: 99;
  background: var(--primary);
  padding: 12px 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
}
.eng-header-left { flex-shrink: 0; }
.eng-header-center { flex: 1; min-width: 0; }
.eng-header-right { flex-shrink: 0; }

.eng-header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.125rem;
  text-decoration: none;
  transition: background 0.2s;
}
.eng-header-back:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }

.eng-header .nav-toggle {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  transition: background 0.2s;
}
.eng-header .nav-toggle:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }

.eng-header .search-wrap { width: 100%; }
.eng-header .search-wrap .form-control {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
  font-family: var(--font-body);
}
.eng-header .search-wrap .btn-search {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-heading);
  padding: 8px 14px;
  transition: background 0.2s;
}
.eng-header .search-wrap .btn-search:hover { background: var(--success-hover); color: #fff; }

/* Nav dropdown */
.eng-nav-dropdown .card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.eng-nav-dropdown .card-body { padding: 0.5rem 0; }
.eng-nav-dropdown .dropdown-item {
  padding: 10px 1rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  display: flex;
  align-items: center;
  transition: background 0.15s;
}
.eng-nav-dropdown .dropdown-item:hover { background: var(--bg); color: var(--primary); }
.eng-nav-dropdown .dropdown-item i { opacity: 0.85; margin-right: 0.5rem; }
.eng-nav-dropdown .dropdown-item.text-danger:hover { color: var(--error); }
.eng-nav-dropdown .small.text-muted { font-family: var(--font-body); }
.eng-nav-dropdown .fw-bold { font-family: var(--font-heading); }

/* ----- Flash messages ----- */
.eng-flash-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.eng-flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font-body);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: eng-flash-in 0.3s ease-out;
}
@keyframes eng-flash-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
.eng-flash--success { background: linear-gradient(135deg, var(--success), var(--success-hover)); color: #fff; }
.eng-flash--error   { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.eng-flash--warning { background: linear-gradient(135deg, var(--warning), #ca8a04); color: #1f2937; }
.eng-flash i { flex-shrink: 0; font-size: 1.25rem; }
.eng-flash-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ----- Main content ----- */
.eng-main { padding: 16px; max-width: 960px; margin: 0 auto; }
@media (min-width: 768px) { .eng-main { padding: 20px 24px; } }

/* ----- Back bar ----- */
.eng-back-bar {
  background: var(--primary-hover);
  padding: 10px 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
}
.eng-back-link {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.eng-back-link:hover { color: rgba(255, 255, 255, 0.9); }

/* ----- Cards ----- */
.eng-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.eng-card h2 {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

/* ----- Dashboard grid ----- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 768px) {
  .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
  .dashboard-grid { grid-template-columns: repeat(6, 1fr); }
}
.dash-card {
  border-radius: var(--radius);
  padding: 18px 14px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  display: block;
  transition: transform 0.2s, box-shadow 0.2s;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: #fff; }
.dash-card h3 { margin: 0; font-size: 1.5rem; font-weight: 700; font-family: var(--font-heading); }
.dash-card p { margin: 6px 0 0; font-size: 0.8125rem; opacity: 0.95; font-family: var(--font-body); }
.dash-card .fa { position: absolute; right: 12px; bottom: 10px; font-size: 1.75rem; opacity: 0.35; }
.dash-pending   { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); }
.dash-completed { background: linear-gradient(135deg, var(--success), var(--success-hover)); }
.dash-cancelled { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.dash-defective { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.dash-intransit { background: linear-gradient(135deg, #0284c7, #0369a1); }
.dash-stock     { background: linear-gradient(135deg, #0d9488, #0f766e); }

/* ----- Tabs ----- */
.tabs-bar { background: var(--primary); padding: 0 16px 12px; }
.tabs-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs-wrap::-webkit-scrollbar { display: none; }
.tabs { display: flex; gap: 8px; padding-bottom: 4px; min-width: max-content; }
.tab-btn {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.tab-btn:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }
.tab-btn.active { background: #fff; color: var(--primary); }
.panel { display: none; }
.panel.active { display: block; }

/* ----- Job cards ----- */
.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.job-card .badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-heading);
  text-transform: uppercase;
}
.job-card .id { font-size: 1rem; font-weight: 700; font-family: var(--font-heading); margin-bottom: 4px; }
.job-card .meta { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 2px; font-family: var(--font-body); }
.job-card .customer { font-size: 0.9375rem; font-weight: 600; margin-top: 6px; font-family: var(--font-body); }
.job-card .address { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; word-break: break-word; }
.job-card .phone { font-size: 0.8125rem; font-weight: 600; color: var(--primary); margin-top: 4px; }
.job-card .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.job-card .btn-details { background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-weight: 600; }
.job-card .btn-update { background: var(--warning); color: #1f2937; border-radius: var(--radius-sm); font-weight: 600; }
.job-card .btn-complete { background: var(--success); color: #fff; border-radius: var(--radius-sm); font-weight: 600; }
.job-card .btn-cancel { background: var(--error); color: #fff; border-radius: var(--radius-sm); font-weight: 600; }
.badge-today { background: #d1fae5; color: #065f46; }
.badge-tomorrow { background: #ccfbf1; color: #0f766e; }
.badge-future { background: #e0f2fe; color: #155e75; }
.badge-rescheduled { background: #ffedd5; color: #c2410c; }
.badge-inprocess { background: #fee2e2; color: #b91c1c; }
.badge-intimated { background: #ede9fe; color: #5b21b6; }
.badge-approval { background: var(--warning-bg); color: #92400e; }
.badge-pending { background: var(--warning-bg); color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }

/* ----- Details grid ----- */
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
}
@media (min-width: 768px) { .details-grid { grid-template-columns: repeat(4, 1fr); } }
.detail-row { margin-bottom: 0; min-width: 0; }
.detail-row.full { grid-column: 1 / -1; }
.detail-label { font-size: 0.75rem; color: var(--text-muted); display: block; margin-bottom: 2px; font-family: var(--font-body); }
.detail-value { font-size: 0.9375rem; font-weight: 500; word-break: break-word; font-family: var(--font-body); }
.detail-value.phone { color: var(--primary); font-weight: 600; }
.form-error { font-size: 0.8125rem; color: var(--error); margin-top: 4px; }

/* ----- Buttons & forms (Bootstrap overrides) ----- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border); }
.btn-outline-secondary:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-body);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-label { font-family: var(--font-body); font-weight: 500; color: var(--text); }

/* ----- Profile (shared) ----- */
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin: 0 auto 12px;
}
.profile-name { font-size: 1.25rem; font-weight: 700; font-family: var(--font-heading); text-align: center; margin-bottom: 4px; }
.profile-role { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-bottom: 20px; font-family: var(--font-body); }

/* ----- Settings list ----- */
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 500;
  transition: color 0.2s;
}
.settings-item:last-child { border-bottom: 0; }
.settings-item:hover { color: var(--primary); }
.settings-item i { color: var(--text-muted); margin-right: 12px; width: 24px; text-align: center; }

/* ----- Advance search ----- */
.advance-search-page { max-width: 480px; margin: 0 auto; }
.or-div { text-align: center; margin: 12px 0; color: var(--text-muted); font-size: 0.8125rem; font-weight: 600; font-family: var(--font-body); }
.btn-search-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--success), var(--success-hover));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-heading);
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s;
}
.btn-search-submit:hover { color: #fff; opacity: 0.95; }
#form-err { color: var(--error); font-size: 0.875rem; margin-top: 8px; display: none; font-family: var(--font-body); }

/* ----- Login (standalone page) ----- */
body.eng-login-page {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.06) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(5, 150, 105, 0.06) 0, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
}
.login-container { width: 100%; max-width: 400px; }
#msg { display: none; font-size: 0.9rem; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; text-align: center; font-family: var(--font-body); }
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-card h1 { font-size: 1.4rem; font-weight: 700; font-family: var(--font-heading); color: var(--primary); text-align: center; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 22px; font-family: var(--font-body); }
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; font-family: var(--font-body); }
.login-card .form-group .form-control {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-body);
}
.login-card .form-group .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.btn-login {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-heading);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.btn-login:hover { background: var(--primary-hover); color: #fff; }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; }
.login-card .forgot-link { color: var(--primary); font-weight: 600; }
#msg.error { background: var(--error-bg); color: var(--error); }
#msg.success { background: #d1fae5; color: #047857; }
.loader {
  display: none;
  width: 22px; height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.demo-btns { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.demo-btns .btn-sm { font-size: 0.75rem; padding: 6px 10px; border-radius: var(--radius-sm); }

/* ----- Forgot / Reset password (auth centering) ----- */
body.eng-auth-page {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.06) 0, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
}
.forgot-container, .reset-container { width: 100%; max-width: 400px; }
.forgot-card, .reset-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.forgot-card h1, .reset-card h1 { font-size: 1.4rem; font-weight: 700; font-family: var(--font-heading); color: var(--primary); text-align: center; margin-bottom: 6px; }
.forgot-card .sub, .reset-card .sub { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 22px; font-family: var(--font-body); }
.forgot-card .form-group, .reset-card .form-group { margin-bottom: 16px; }
.forgot-card .form-group label, .reset-card .form-group label { font-family: var(--font-body); font-weight: 600; color: var(--text); }
.btn-send, .btn-reset {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-heading);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.btn-send:hover, .btn-reset:hover { background: var(--primary-hover); color: #fff; }
.btn-send:disabled, .btn-reset:disabled { opacity: 0.7; cursor: not-allowed; }
.forgot-card #msg, .reset-card #msg { font-family: var(--font-body); }
.otp-type-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.otp-type-tabs .btn { flex: 1; border-radius: var(--radius-sm); }
.back-link { display: block; text-align: center; margin-top: 16px; color: var(--primary); font-weight: 600; text-decoration: none; font-family: var(--font-body); }
.back-link:hover { color: var(--primary-hover); }

/* ----- Complete booking steps ----- */
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-indicator { display: flex; gap: 8px; margin-bottom: 20px; }
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  font-family: var(--font-heading);
}
.step-dot.done { background: var(--success); color: #fff; }
.step-dot.active { background: var(--primary); color: #fff; }
.img-preview { max-width: 120px; max-height: 120px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 6px; }
.summary-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-family: var(--font-body); }
.summary-row:last-child { border-bottom: 0; }

/* ----- Booking info card (update/cancel) ----- */
.booking-info-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.booking-info-card .row { margin-bottom: 8px; }
.booking-info-card .row:last-child { margin-bottom: 0; }
.booking-info-card .detail-label, .booking-info-card .detail-value { font-family: var(--font-body); }
.modal-lg .table td, .modal-lg .table th { vertical-align: middle; }
.gfq_sn { font-weight: 700; text-align: center; font-family: var(--font-body); }

/* ----- Booking details / tables ----- */
.actions .btn { margin-right: 8px; margin-bottom: 8px; }
.table th { background: var(--primary); color: #fff; font-family: var(--font-heading); font-weight: 600; }
.table { font-family: var(--font-body); }

/* ----- Footer ----- */
.eng-footer {
  text-align: center;
  padding: 16px;
  color: #fff;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  background: var(--primary);
  margin-top: auto;
}

/* ----- Page titles ----- */
.eng-main .h5, .eng-main h1, .eng-main h2.h5 {
  font-family: var(--font-heading);
  color: var(--text);
  font-weight: 600;
}
.text-muted { color: var(--text-muted) !important; }

/* ----- Global Loader Overlay ----- */
.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.global-loader.show { display: flex; }
.global-loader .loader {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.global-loader .text { color: var(--text); font-weight: 500; }
