/* ============================================================
   TYRE AND TUBE HYPER ERP - Application Stylesheet
   Mobile-First, Bootstrap 5 Base
   ============================================================ */

:root {
  --tath-dark:       #0f0f1a;
  --tath-darker:     #07070f;
  --tath-navy:       #1a1a2e;
  --tath-navy-mid:   #16213e;
  --tath-blue:       #0f3460;
  --tath-accent:     #e94560;
  --tath-accent2:    #f5a623;
  --tath-success:    #28c76f;
  --tath-info:       #00cfe8;
  --tath-surface:    #1e1e30;
  --tath-surface2:   #252540;
  --tath-border:     rgba(255,255,255,0.08);
  --tath-text:       #e0e0f0;
  --tath-muted:      #8888aa;
  --tath-sidebar-w:  260px;
  --tath-navbar-h:   58px;
  --radius:          12px;
  --radius-sm:       8px;
  --shadow:          0 4px 20px rgba(0,0,0,0.35);
  --shadow-sm:       0 2px 8px rgba(0,0,0,0.25);
  --transition:      0.25s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--tath-dark);
  color: var(--tath-text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .display-heading {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.3px;
}

a { color: var(--tath-accent); text-decoration: none; }
a:hover { color: #ff6b7a; }

.fw-600 { font-weight: 600; }

/* ===== NAVBAR ===== */
.tath-navbar {
  background: linear-gradient(135deg, var(--tath-darker) 0%, var(--tath-navy) 100%);
  border-bottom: 1px solid var(--tath-border);
  height: var(--tath-navbar-h);
  z-index: 1040;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.tath-navbar .btn-link { text-decoration: none; }

.brand-icon {
  width: 36px; height: 36px;
  background: var(--tath-accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
}

.brand-name {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 0.85rem;
  letter-spacing: 1.5px; line-height: 1;
  color: #fff;
}
.brand-sub {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500; font-size: 0.65rem;
  letter-spacing: 2px; color: var(--tath-accent);
}

.user-avatar-sm {
  width: 30px; height: 30px;
  background: var(--tath-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.badge-xs { font-size: 0.55rem; padding: 2px 4px; }

/* ===== SIDEBAR ===== */
.tath-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--tath-sidebar-w);
  background: linear-gradient(180deg, var(--tath-darker) 0%, var(--tath-navy) 100%);
  border-right: 1px solid var(--tath-border);
  z-index: 1050;
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.tath-sidebar.open { transform: translateX(0); }

@media (min-width: 992px) {
  .tath-sidebar.pinned {
    transform: translateX(0);
  }
  .main-content.sidebar-pinned {
    margin-left: var(--tath-sidebar-w);
  }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1045;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

@media (min-width: 992px) {
  .sidebar-overlay { display: none !important; }
}

.sidebar-brand {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.75rem;
  border-bottom: 1px solid var(--tath-border);
  margin-top: 0;
  min-height: var(--tath-navbar-h);
}

.brand-icon-lg {
  width: 40px; height: 40px;
  background: var(--tath-accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; flex-shrink: 0;
}

.brand-name-lg {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 0.85rem;
  letter-spacing: 1.5px; color: #fff; line-height: 1.2;
}
.brand-badge {
  font-size: 0.6rem; color: var(--tath-accent);
  letter-spacing: 1px; text-transform: uppercase;
}

/* Nav sections */
.sidebar-nav { padding: 0.75rem 0; flex: 1; }

.nav-section { margin-bottom: 0.25rem; }

.nav-section-label {
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 1.5px; color: var(--tath-muted);
  padding: 0.75rem 1.25rem 0.25rem;
  text-transform: uppercase;
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: var(--tath-muted);
  border-radius: 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  font-size: 0.875rem; font-weight: 500;
  position: relative;
}

.sidebar-nav .nav-link:hover {
  color: var(--tath-text);
  background: rgba(255,255,255,0.04);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(233,69,96,0.12);
  border-left-color: var(--tath-accent);
}

.sidebar-nav .nav-link i {
  font-size: 1rem; width: 20px; flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--tath-accent);
  color: #fff; font-size: 0.6rem; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
}
.nav-badge-warning { background: var(--tath-accent2); }

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--tath-border);
  display: flex; justify-content: space-between;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  min-height: 100vh;
  padding-top: var(--tath-navbar-h);
  transition: margin-left var(--transition);
}

.page-content { padding: 1.25rem; }

/* Page Header */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 1.6rem;
  color: #fff; line-height: 1.1;
  margin: 0;
}
.page-header-sub {
  color: var(--tath-muted); font-size: 0.8rem; margin-top: 2px;
}

/* ===== CARDS ===== */
.tath-card {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tath-card .card-header {
  background: var(--tath-surface2);
  border-bottom: 1px solid var(--tath-border);
  padding: 0.875rem 1.25rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 1rem;
  letter-spacing: 0.5px; color: #fff;
}

.tath-card .card-body { padding: 1.25rem; }

/* Stat Cards */
.stat-card {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.stat-icon.red    { background: rgba(233,69,96,0.15); color: var(--tath-accent); }
.stat-icon.blue   { background: rgba(0,207,232,0.15); color: var(--tath-info); }
.stat-icon.green  { background: rgba(40,199,111,0.15); color: var(--tath-success); }
.stat-icon.orange { background: rgba(245,166,35,0.15); color: var(--tath-accent2); }
.stat-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.75rem; font-weight: 700; color: #fff; line-height: 1;
}
.stat-label {
  font-size: 0.75rem; color: var(--tath-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-change {
  font-size: 0.7rem; margin-top: 2px;
}
.stat-change.up   { color: var(--tath-success); }
.stat-change.down { color: var(--tath-accent); }

/* ===== INFO ROWS (instead of tables) ===== */
.info-row {
  display: flex; flex-wrap: wrap;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--tath-border);
  gap: 0.5rem;
  align-items: center;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  min-width: 120px; color: var(--tath-muted);
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.3px; flex-shrink: 0;
}
.info-value { font-weight: 500; }

/* List items (card-based rows) */
.list-item {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.625rem;
  transition: border-color var(--transition);
}
.list-item:hover { border-color: rgba(233,69,96,0.4); }
.list-item-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.list-item-title {
  font-weight: 600; font-size: 0.95rem; color: #fff;
}
.list-item-sub {
  font-size: 0.78rem; color: var(--tath-muted);
  margin-top: 2px;
}
.list-item-meta {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin-top: 0.625rem;
}
.list-item-meta-item {
  font-size: 0.78rem; color: var(--tath-muted);
  display: flex; align-items: center; gap: 0.3rem;
}

/* ===== FORMS ===== */
.form-control, .form-select {
  background: var(--tath-surface2);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius-sm);
  color: var(--tath-text);
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  background: var(--tath-surface2);
  border-color: var(--tath-accent);
  color: var(--tath-text);
  box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
  outline: none;
}
.form-control::placeholder { color: var(--tath-muted); }
.form-label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--tath-muted); margin-bottom: 0.35rem;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.form-select option {
  background: var(--tath-surface2); color: var(--tath-text);
}
.form-check-input {
  background-color: var(--tath-surface2);
  border-color: var(--tath-border);
}
.form-check-input:checked {
  background-color: var(--tath-accent);
  border-color: var(--tath-accent);
}

/* Input groups */
.input-group-text {
  background: var(--tath-surface2);
  border-color: var(--tath-border);
  color: var(--tath-muted);
}

/* ===== BUTTONS ===== */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 0.875rem; }
.btn-sm { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

.btn-primary {
  background: var(--tath-accent);
  border-color: var(--tath-accent);
  color: #fff;
}
.btn-primary:hover {
  background: #d63a52; border-color: #d63a52; color: #fff;
}

.btn-outline-primary {
  border-color: var(--tath-accent);
  color: var(--tath-accent);
}
.btn-outline-primary:hover {
  background: var(--tath-accent); color: #fff;
}

.btn-secondary {
  background: var(--tath-surface2);
  border-color: var(--tath-border);
  color: var(--tath-text);
}
.btn-secondary:hover {
  background: var(--tath-surface); color: #fff;
}

.btn-success  { background: var(--tath-success);  border-color: var(--tath-success); }
.btn-warning  { background: var(--tath-accent2);  border-color: var(--tath-accent2); color: #fff; }
.btn-info     { background: var(--tath-info);     border-color: var(--tath-info); }
.btn-danger   { background: var(--tath-accent);   border-color: var(--tath-accent); }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0; display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* FAB - Floating Action Button */
.fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 56px; height: 56px;
  border-radius: 50%; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(233,69,96,0.5);
  z-index: 1000; border: none;
  background: var(--tath-accent); color: #fff;
  transition: transform var(--transition), box-shadow var(--transition);
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(233,69,96,0.6);
}

/* ===== BADGES ===== */
.badge {
  font-weight: 600; font-size: 0.7rem;
  padding: 0.3em 0.6em; border-radius: 6px;
}

/* ===== DROPDOWNS ===== */
.tath-dropdown {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.tath-dropdown .dropdown-item {
  color: var(--tath-text); font-size: 0.875rem;
  padding: 0.5rem 1rem;
}
.tath-dropdown .dropdown-item:hover {
  background: var(--tath-surface2); color: #fff;
}
.tath-dropdown .dropdown-header {
  color: var(--tath-muted); font-size: 0.78rem;
  padding: 0.75rem 1rem;
}
.tath-dropdown hr.dropdown-divider { border-color: var(--tath-border); }
.tath-dropdown .dropdown-item.text-danger { color: var(--tath-accent) !important; }

/* ===== MODAL ===== */
.modal-content {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius);
  color: var(--tath-text);
}
.modal-header {
  background: var(--tath-surface2);
  border-bottom: 1px solid var(--tath-border);
  padding: 1rem 1.25rem;
}
.modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 1.1rem; color: #fff;
}
.modal-footer {
  border-top: 1px solid var(--tath-border);
  padding: 0.875rem 1.25rem;
}
.btn-close { filter: invert(1) grayscale(1); }

/* ===== ALERTS ===== */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.875rem;
}
.alert-success  { background: rgba(40,199,111,0.15); color: var(--tath-success); }
.alert-danger   { background: rgba(233,69,96,0.15);  color: #ff6b7a; }
.alert-warning  { background: rgba(245,166,35,0.15); color: var(--tath-accent2); }
.alert-info     { background: rgba(0,207,232,0.15);  color: var(--tath-info); }

/* ===== TABS ===== */
.nav-tabs {
  border-bottom: 1px solid var(--tath-border);
  gap: 0.25rem;
  flex-wrap: nowrap; overflow-x: auto;
}
.nav-tabs .nav-link {
  color: var(--tath-muted); background: none;
  border: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 0.625rem 1rem;
  font-size: 0.825rem; font-weight: 600;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}
.nav-tabs .nav-link:hover { color: var(--tath-text); }
.nav-tabs .nav-link.active {
  color: var(--tath-accent);
  border-bottom-color: var(--tath-accent);
}
.tab-content { padding-top: 1.25rem; }

/* ===== PROGRESS ===== */
.progress {
  background: var(--tath-surface2);
  border-radius: 99px; height: 6px;
}
.progress-bar { background: var(--tath-accent); border-radius: 99px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--tath-dark); }
::-webkit-scrollbar-thumb { background: var(--tath-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--tath-muted); }

/* ===== AUTH PAGES ===== */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--tath-darker) 0%, var(--tath-navy) 60%, #1a0a1e 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; margin-bottom: 2rem;
}
.auth-logo-icon {
  width: 52px; height: 52px;
  background: var(--tath-accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff;
}
.auth-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700; font-size: 1.4rem; color: #fff;
}
.auth-sub { color: var(--tath-accent); font-size: 0.65rem; letter-spacing: 2px; }

/* ===== SIGNATURE PAD ===== */
#signaturePad {
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  touch-action: none;
  display: block;
  width: 100%; height: 200px;
}

/* ===== JOB CARD STATUS PIPELINE ===== */
.job-pipeline {
  display: flex; flex-wrap: nowrap;
  overflow-x: auto; gap: 0.5rem;
  padding-bottom: 0.5rem;
}
.pipeline-step {
  flex-shrink: 0; text-align: center;
  font-size: 0.7rem; font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  background: var(--tath-surface2);
  color: var(--tath-muted);
  border: 1px solid var(--tath-border);
}
.pipeline-step.done  { background: rgba(40,199,111,0.15); color: var(--tath-success); border-color: var(--tath-success); }
.pipeline-step.current { background: rgba(233,69,96,0.15); color: var(--tath-accent); border-color: var(--tath-accent); }

/* ===== VEHICLE CARD ===== */
.vehicle-card {
  background: var(--tath-surface);
  border: 1px solid var(--tath-border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  display: flex; align-items: center; gap: 0.875rem;
  cursor: pointer; transition: border-color var(--transition);
}
.vehicle-card:hover, .vehicle-card.selected {
  border-color: var(--tath-accent);
}
.vehicle-reg {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem; font-weight: 700;
  color: #fff; letter-spacing: 1px;
}

/* ===== PHOTO UPLOAD ZONE ===== */
.photo-drop-zone {
  border: 2px dashed var(--tath-border);
  border-radius: var(--radius);
  padding: 2rem; text-align: center;
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
  color: var(--tath-muted);
}
.photo-drop-zone:hover, .photo-drop-zone.dragover {
  border-color: var(--tath-accent);
  background: rgba(233,69,96,0.05);
}

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
}
.search-bar .bi-search {
  position: absolute; left: 0.875rem; top: 50%;
  transform: translateY(-50%);
  color: var(--tath-muted); font-size: 0.9rem;
}
.search-bar input {
  padding-left: 2.25rem;
}

/* ===== RISK RATING ===== */
.risk-low      { color: var(--tath-success); }
.risk-medium   { color: var(--tath-accent2); }
.risk-high     { color: var(--tath-accent); }
.risk-critical { color: #ff0000; font-weight: 700; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute; left: 0.65rem; top: 0; bottom: 0;
  width: 1px; background: var(--tath-border);
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot {
  position: absolute; left: -1.65rem; top: 0.2rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--tath-accent);
  border: 2px solid var(--tath-dark);
}
.timeline-dot.success { background: var(--tath-success); }
.timeline-dot.info    { background: var(--tath-info); }
.timeline-time { font-size: 0.72rem; color: var(--tath-muted); margin-bottom: 0.2rem; }
.timeline-content { font-size: 0.875rem; }

/* ===== PAYFAST ===== */
.payfast-btn {
  background: #007aff;
  color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; width: 100%;
  justify-content: center;
  transition: background var(--transition);
}
.payfast-btn:hover { background: #0062cc; }

/* ===== PRINT ===== */
@media print {
  .tath-navbar, .tath-sidebar, .sidebar-overlay,
  .fab, .btn, .nav-tabs { display: none !important; }
  .main-content { padding: 0 !important; margin: 0 !important; }
  .tath-card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; color: #000; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 575px) {
  .page-content { padding: 0.875rem; }
  .stat-card { padding: 0.875rem; }
  .stat-value { font-size: 1.4rem; }
  .tath-card .card-body { padding: 0.875rem; }
  .auth-card { padding: 1.5rem; }
}

/* Loading spinner */
.tath-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; flex-direction: column; gap: 1rem;
  color: var(--tath-muted);
}
.tath-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--tath-border);
  border-top-color: var(--tath-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  padding: 3rem; text-align: center; color: var(--tath-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }
.empty-state h6 { color: var(--tath-text); }

/* Divider */
.tath-divider {
  border: none;
  border-top: 1px solid var(--tath-border);
  margin: 1.25rem 0;
}
