/* ============================================
   DDD Pest Control Management - Main Stylesheet
   ============================================ */

/* --- CSS Variables --- */
:root {
  --navy: #1a1f36;
  --navy-light: #252b48;
  --navy-lighter: #2f3555;
  --navy-dark: #12162a;
  --orange: #FD7E14;
  --orange-light: #ffad60;
  --green: #198754;
  --green-light: #20c997;
  --blue: #0D6EFD;
  --teal: #0dcaf0;
  --red: #DC3545;
  --pink: #e84393;
  --yellow: #FFC107;
  --bg-light: #f0f2f5;
  --bg-white: #ffffff;
  --text-primary: #1a1f36;
  --text-secondary: #6c757d;
  --text-light: #adb5bd;
  --text-white: #ffffff;
  --sidebar-width: 260px;
  --navbar-height: 60px;
  --border-radius: 12px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --transition: all 0.3s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--orange);
}

/* --- Custom Buttons --- */
.btn-orange,
a.btn-orange,
button.btn-orange,
.btn.btn-orange {
  --bs-btn-bg: #FD7E14;
  --bs-btn-border-color: #FD7E14;
  --bs-btn-hover-bg: #e06b0b;
  --bs-btn-hover-border-color: #e06b0b;
  --bs-btn-active-bg: #c45e09;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
  background: linear-gradient(135deg, #FD7E14, #ffad60) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(253, 126, 20, 0.3);
  transition: all 0.3s ease;
}
.btn-orange:hover, .btn-orange:focus,
a.btn-orange:hover, button.btn-orange:hover,
.btn.btn-orange:hover, .btn.btn-orange:focus {
  background: linear-gradient(135deg, #e06b0b, #FD7E14) !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(253, 126, 20, 0.4);
}
.btn-orange:active, .btn.btn-orange:active {
  transform: translateY(0);
  background: #c45e09 !important;
}
.btn-outline-orange {
  color: #FD7E14 !important;
  border: 1px solid #FD7E14 !important;
  background: transparent !important;
}
.btn-outline-orange:hover {
  background: #FD7E14 !important;
  color: #fff !important;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-light) var(--bg-light);
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy);
  color: var(--text-white);
  z-index: 1040;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  height: var(--navbar-height);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sidebar-brand img {
  height: 36px;
  margin-right: 12px;
}

.sidebar-brand h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
}

.sidebar-brand span {
  color: var(--orange);
}

.sidebar-menu {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
}

.sidebar-menu .menu-header {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  opacity: 0.5;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  gap: 12px;
}

.sidebar-menu li a:hover {
  color: var(--text-white);
  background: rgba(255,255,255,0.05);
}

.sidebar-menu li a i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-menu li.active > a {
  color: var(--text-white);
  background: rgba(253,126,20,0.1);
  border-left-color: var(--orange);
}

.sidebar-menu li.active > a i {
  color: var(--orange);
}

/* Submenu */
.sidebar-menu .submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
  background: rgba(0,0,0,0.15);
}

.sidebar-menu .submenu.show {
  display: block;
}

.sidebar-menu .submenu li a {
  padding: 8px 20px 8px 56px;
  font-size: 13px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1050;
  background: var(--navy);
  color: var(--text-white);
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1035;
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: var(--transition);
}

.content-wrapper {
  padding: 24px;
}

/* ============================================
   Top Navbar
   ============================================ */
.top-navbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--navbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-left h5 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.navbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.navbar-breadcrumb a {
  color: var(--text-secondary);
}

.navbar-breadcrumb a:hover {
  color: var(--orange);
}

.navbar-breadcrumb .separator {
  color: var(--text-light);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Notification bell */
.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-light);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
}

.notification-bell:hover {
  background: rgba(253,126,20,0.1);
  color: var(--orange);
}

.notification-bell .badge-count {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* User info */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: var(--transition);
}

.user-info:hover {
  background: var(--bg-light);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-details .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-details .user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ============================================
   Dashboard Stat Cards
   ============================================ */
.stat-card {
  border-radius: var(--border-radius);
  padding: 20px 24px;
  color: var(--text-white);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  opacity: 0.9;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 500;
}

.stat-card .stat-change {
  font-size: 12px;
  margin-top: 8px;
  opacity: 0.9;
}

.stat-card-navy {
  background: linear-gradient(135deg, var(--navy) 0%, #2d4a8a 100%);
}

.stat-card-green {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
}

.stat-card-orange {
  background: linear-gradient(135deg, var(--orange) 0%, var(--yellow) 100%);
}

.stat-card-red {
  background: linear-gradient(135deg, var(--red) 0%, var(--pink) 100%);
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-white);
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h5,
.card-header h6 {
  margin: 0;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

.card-footer {
  background: transparent;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 16px 24px;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
}

.table {
  width: 100%;
  margin-bottom: 0;
}

.table thead th {
  background: var(--navy);
  color: var(--text-white);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border: none;
  white-space: nowrap;
}

.table thead th:first-child {
  border-radius: var(--border-radius) 0 0 0;
}

.table thead th:last-child {
  border-radius: 0 var(--border-radius) 0 0;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
}

.table tbody tr:hover {
  background: rgba(253,126,20,0.03);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0,0,0,0.015);
}

.table-striped tbody tr:nth-of-type(odd):hover {
  background: rgba(253,126,20,0.03);
}

/* Sortable table headers */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.table thead th.sortable:hover {
  background: var(--navy-light);
}

.table thead th.sortable::after {
  content: '\f0dc';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: 6px;
  opacity: 0.4;
  font-size: 10px;
}

.table thead th.sortable.asc::after {
  content: '\f0de';
  opacity: 1;
}

.table thead th.sortable.desc::after {
  content: '\f0dd';
  opacity: 1;
}

/* ============================================
   Status Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-programat {
  background: rgba(13,110,253,0.12);
  color: var(--blue);
}

.badge-in_drum {
  background: rgba(204,160,0,0.12);
  color: #b38f00;
}

.badge-ajuns {
  background: rgba(13,202,240,0.12);
  color: #0aa2c0;
}

.badge-in_desfasurare {
  background: rgba(204,160,0,0.15);
  color: #b38f00;
  animation: pulseStatus 2s infinite;
}

.badge-finalizat {
  background: rgba(25,135,84,0.12);
  color: var(--green);
}

.badge-anulat {
  background: rgba(220,53,69,0.12);
  color: var(--red);
}

/* ============================================
   Forms
   ============================================ */
.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid #dee2e6;
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
  color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(253,126,20,0.15);
}

.form-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-text {
  font-size: 12px;
  color: var(--text-secondary);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.input-group-text {
  border-radius: 8px;
  background: var(--bg-light);
  border: 1px solid #dee2e6;
  color: var(--text-secondary);
}

/* Checkbox & radio custom */
.form-check-input:checked {
  background-color: var(--orange);
  border-color: var(--orange);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(253,126,20,0.15);
  border-color: var(--orange);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #e56b00;
  border-color: #e56b00;
  box-shadow: 0 4px 12px rgba(253,126,20,0.35);
}

.btn-success {
  background: var(--green);
  border-color: var(--green);
}

.btn-success:hover,
.btn-success:focus {
  background: #146c43;
  border-color: #146c43;
  box-shadow: 0 4px 12px rgba(25,135,84,0.35);
}

.btn-navy {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.btn-navy:hover,
.btn-navy:focus {
  background: var(--navy-light);
  border-color: var(--navy-light);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,31,54,0.35);
}

.btn-outline-primary {
  color: var(--orange);
  border-color: var(--orange);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* ============================================
   Calendar Styles
   ============================================ */
.calendar-container {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--navy);
  color: var(--text-white);
}

.calendar-header h4 {
  margin: 0;
  font-weight: 600;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--text-white);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav button:hover {
  background: rgba(255,255,255,0.25);
}

.calendar-view-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 3px;
}

.calendar-view-switcher button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-view-switcher button.active {
  background: var(--orange);
  color: #fff;
}

.calendar-filters {
  display: flex;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-light);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}

.calendar-filters select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  font-size: 13px;
  min-width: 150px;
}

.btn-cal-filter, .btn-cal-reset {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
}
.btn-cal-filter {
  background: #FD7E14;
  color: #fff;
}
.btn-cal-filter:hover { background: #e06b0a; }
.btn-cal-reset {
  background: transparent;
  border: 1px solid #6c757d;
  color: #6c757d;
}
.btn-cal-reset:hover { background: rgba(108,117,125,0.1); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-grid .day-header {
  padding: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-light);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.calendar-grid .day-cell {
  min-height: 120px;
  padding: 8px;
  border-right: 1px solid rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  cursor: pointer;
  transition: var(--transition);
}

.calendar-grid .day-cell:hover {
  background: rgba(253,126,20,0.03);
}

.calendar-grid .day-cell.today {
  background: rgba(253,126,20,0.06);
}

.calendar-grid .day-cell.other-month {
  opacity: 0.4;
}

.day-cell .day-number {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.day-cell.today .day-number {
  background: var(--orange);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-event {
  padding: 3px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}

.calendar-event:hover {
  opacity: 0.8;
  transform: scale(1.02);
}

.calendar-event.status-preprogramat {
  background: rgba(139,149,165,0.10);
  color: #6c757d;
  border-left: 3px dashed #9aa0a6;
}

.calendar-event.status-programat {
  background: rgba(13,110,253,0.18);
  color: #0d6efd;
  border-left: 4px solid #0d6efd;
  font-weight: 600;
}

.calendar-event.status-in_drum {
  background: rgba(204,160,0,0.15);
  color: #b38f00;
  border-left: 4px solid #ccaa00;
  font-weight: 600;
}

.calendar-event.status-in_desfasurare {
  background: rgba(204,160,0,0.22);
  color: #b38f00;
  border-left: 4px solid #ccaa00;
  font-weight: 600;
  animation: pulseStatus 2s infinite;
}

.calendar-event.status-finalizat {
  background: rgba(25,135,84,0.18);
  color: #198754;
  border-left: 4px solid #198754;
  font-weight: 600;
}

.calendar-event.status-anulat {
  background: rgba(220,53,69,0.10);
  color: #dc3545;
  border-left: 3px solid #dc3545;
  text-decoration: line-through;
}

/* Week view */
.calendar-week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
}

.calendar-week-grid .time-slot {
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  border-right: 1px solid rgba(0,0,0,0.06);
  height: 60px;
}

.calendar-week-grid .week-cell {
  border-right: 1px solid rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  min-height: 60px;
  position: relative;
  padding: 2px;
}

/* Day view */
.calendar-day-grid {
  display: grid;
  grid-template-columns: 60px 1fr;
}

.calendar-day-grid .time-slot {
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  border-right: 1px solid rgba(0,0,0,0.06);
  height: 60px;
}

.calendar-day-grid .day-slot {
  border-bottom: 1px solid rgba(0,0,0,0.04);
  min-height: 60px;
  position: relative;
  padding: 4px 8px;
}

/* ============================================
   Map Container
   ============================================ */
.map-container {
  width: 100%;
  height: calc(100vh - var(--navbar-height));
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.map-container .leaflet-container {
  width: 100%;
  height: 100%;
}

.map-sidebar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  width: 300px;
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow-y: auto;
}

/* Custom map markers */
.team-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.client-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
}

.marker-popup {
  min-width: 200px;
}

.marker-popup h6 {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--navy);
}

.marker-popup p {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   PWA Mobile Interface
   ============================================ */
.pwa-container {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.pwa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
}

.pwa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pwa-btn-primary {
  background: var(--orange);
  color: #fff;
}

.pwa-btn-primary:active {
  transform: scale(0.97);
  background: #e56b00;
}

.pwa-btn-success {
  background: var(--green);
  color: #fff;
}

.pwa-btn-success:active {
  transform: scale(0.97);
}

.pwa-btn-danger {
  background: var(--red);
  color: #fff;
}

.pwa-btn-outline {
  background: transparent;
  border: 2px solid var(--navy);
  color: var(--navy);
}

/* Client card list for PWA */
.client-card {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.client-card:active {
  transform: scale(0.98);
  background: var(--bg-light);
}

.client-card .client-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(253,126,20,0.1);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.client-card .client-info {
  flex: 1;
  min-width: 0;
}

.client-card .client-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card .client-address {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card .client-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================
   Signature Pad
   ============================================ */
.signature-container {
  background: var(--bg-white);
  border: 2px dashed #dee2e6;
  border-radius: var(--border-radius);
  padding: 12px;
  text-align: center;
}

.signature-container.has-signature {
  border-style: solid;
  border-color: var(--green);
}

.signature-canvas {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  background: #fafafa;
}

.signature-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.signature-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ============================================
   Loading Spinner Overlay
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-light);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Inline spinner for buttons */
.btn .spinner-sm {
  border-top-color: #fff;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-white);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.3s ease;
  pointer-events: auto;
  border-left: 4px solid;
}

.toast.toast-success {
  border-left-color: var(--green);
}

.toast.toast-error {
  border-left-color: var(--red);
}

.toast.toast-warning {
  border-left-color: var(--yellow);
}

.toast.toast-info {
  border-left-color: var(--blue);
}

.toast .toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast.toast-success .toast-icon { color: var(--green); }
.toast.toast-error .toast-icon { color: var(--red); }
.toast.toast-warning .toast-icon { color: var(--yellow); }
.toast.toast-info .toast-icon { color: var(--blue); }

.toast .toast-body {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.toast.hiding {
  animation: slideOutRight 0.3s ease forwards;
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 18px 24px;
  background: var(--navy);
  color: var(--text-white);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-header .btn-close {
  filter: brightness(0) invert(1);
}

.modal-title {
  font-weight: 700;
  font-size: 16px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 16px 24px;
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Large modal for PV */
.modal-pv .modal-dialog {
  max-width: 800px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  gap: 4px;
}

.page-link {
  border-radius: 8px;
  border: none;
  color: var(--text-primary);
  padding: 8px 14px;
  font-weight: 500;
  font-size: 13px;
}

.page-link:hover {
  background: rgba(253,126,20,0.1);
  color: var(--orange);
}

.page-item.active .page-link {
  background: var(--orange);
  color: #fff;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

@keyframes pulseStatus {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

.slide-in {
  animation: slideIn 0.4s ease;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-orange { color: var(--orange) !important; }
.text-navy { color: var(--navy) !important; }
.text-green { color: var(--green) !important; }
.bg-orange { background-color: var(--orange) !important; }
.bg-navy { background-color: var(--navy) !important; }

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Print Styles for A4 PV
   ============================================ */
@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .top-navbar,
  .sidebar-toggle,
  .sidebar-overlay,
  .toast-container,
  .loading-overlay,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-wrapper {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .pv-document {
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
  }

  .pv-header {
    border-bottom: 2px solid #000;
    padding-bottom: 12pt;
    margin-bottom: 12pt;
  }

  .pv-header .company-logo {
    max-height: 60px;
  }

  .pv-title {
    font-size: 18pt;
    font-weight: bold;
    text-align: center;
    margin: 12pt 0;
  }

  .pv-section {
    margin-bottom: 10pt;
    page-break-inside: avoid;
  }

  .pv-section h6 {
    font-size: 11pt;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 8pt;
  }

  .pv-table {
    width: 100%;
    border-collapse: collapse;
  }

  .pv-table th,
  .pv-table td {
    border: 1px solid #999;
    padding: 4pt 8pt;
    font-size: 10pt;
  }

  .pv-table th {
    background: #eee !important;
    font-weight: bold;
  }

  .pv-signature {
    margin-top: 20pt;
    display: flex;
    justify-content: space-between;
  }

  .pv-signature-box {
    width: 45%;
    text-align: center;
  }

  .pv-signature-box img {
    max-height: 80px;
    margin-bottom: 4pt;
  }

  .pv-signature-line {
    border-top: 1px solid #000;
    padding-top: 4pt;
    font-size: 10pt;
  }

  .pv-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 8pt;
    color: #666;
    text-align: center;
    border-top: 1px solid #ccc;
    padding-top: 4pt;
  }

  a[href]::after {
    content: none;
  }

  .badge {
    border: 1px solid currentColor;
  }
}

/* ============================================
   Responsive Breakpoints (mobile-first)
   ============================================ */

/* Small devices (phones, up to 576px) */
@media (max-width: 575.98px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 16px;
  }

  .top-navbar {
    padding: 0 16px;
    padding-left: 56px;
  }

  .user-details {
    display: none;
  }

  .stat-card .stat-value {
    font-size: 22px;
  }

  .calendar-grid .day-cell {
    min-height: 80px;
    padding: 4px;
  }

  .calendar-event {
    font-size: 10px;
    padding: 2px 4px;
  }

  .table-container {
    margin: 0 -16px;
    border-radius: 0;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .map-sidebar {
    width: calc(100% - 20px);
    max-height: 200px;
    top: auto;
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .modal-body {
    padding: 16px;
  }
}

/* Medium devices (tablets, 576px to 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .top-navbar {
    padding-left: 56px;
  }

  .content-wrapper {
    padding: 20px;
  }

  .calendar-grid .day-cell {
    min-height: 100px;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .sidebar-overlay {
    display: none !important;
  }
}

/* Extra large screens */
@media (min-width: 1400px) {
  .content-wrapper {
    padding: 32px;
  }
}
