:root {
  --primary: #0066cc;
  --primary-dark: #004d99;
  --sidebar-bg: #1a1f36;
  --sidebar-hover: #2a3050;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #333333;
  --muted: #6b7280;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: #ffffff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar .brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .brand .logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #00b4db, #0083b0);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar .brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #9aa0b5;
}

.sidebar .nav {
  flex: 1;
  padding: 15px 0;
  overflow-y: auto;
}

.sidebar .nav-title {
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  color: #7d8296;
  letter-spacing: 1px;
}

.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #c6cad8;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar .nav a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar .nav a.active {
  background: var(--sidebar-hover);
  color: #ffffff;
  border-left-color: var(--primary);
}

.sidebar .nav a .fa {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar .sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: #9aa0b5;
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--card);
  padding: 15px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar .menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
}

.topbar .page-title { font-size: 20px; font-weight: 600; }
.topbar .page-title small { font-size: 13px; color: var(--muted); font-weight: 400; }

.topbar .topbar-right { display: flex; align-items: center; gap: 15px; }

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .user-info .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  background: var(--primary);
}

.content {
  padding: 25px;
  flex: 1;
}

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

.card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card .card-header h3 { font-size: 17px; font-weight: 600; }

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  margin-bottom: 20px;
}

.stat-card .stat-icon {
  width: 45px;
  height: 45px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  color: #fff;
}

.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: var(--muted); }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
table th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; background: #fafafa; }
table tr:hover { background: #fafafa; }
table .actions { display: flex; gap: 8px; }

/* ===== BADGES & BUTTONS ===== */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { opacity: 0.88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: #374151; }
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 15px; }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: 7px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  padding: 25px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal .modal-header h3 { font-size: 18px; }
.modal .close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }

/* ===== MISC ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}
.empty-state .fa { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 13px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 20px; }

.progress { height: 8px; background: #e9ecef; border-radius: 20px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--primary); border-radius: 20px; }

/* Status colors */
.status-pending { background: #e2e8f0; color: #475569; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-on_the_way { background: #ffedd5; color: #c2410c; }
.status-arrived { background: #fef3c7; color: #92400e; }
.status-cleaning { background: #f3e8ff; color: #6b21a8; }
.status-completed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); }
.login-card { background: #fff; border-radius: 15px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card .logo { text-align: center; margin-bottom: 25px; }
.login-card .logo .icon { width: 64px; height: 64px; margin: 0 auto 12px; background: linear-gradient(135deg,#00b4db,#0083b0); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; }
.login-card h1 { font-size: 24px; text-align: center; margin-bottom: 5px; }
.login-card .subtitle { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 25px; }

/* Tabs */
.nav-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 5px; overflow-x: auto; }
.nav-tabs a { padding: 10px 18px; text-decoration: none; color: var(--muted); font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.nav-tabs a:hover { color: var(--primary); }
.nav-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { background: #fff; border-radius: 8px; padding: 14px 18px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); margin-bottom: 10px; display: flex; align-items: center; gap: 10px; min-width: 250px; border-left: 4px solid var(--info); animation: slideIn 0.3s; }
.toast-success { border-left-color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Search box */
.search-box { position: relative; flex: 1; max-width: 300px; }
.search-box .fa { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 35px; }

/* Media gallery */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.media-item { position: relative; border-radius: 8px; overflow: hidden; background: #eee; aspect-ratio: 4/3; }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item .overlay { position: absolute; top: 8px; right: 8px; }
.media-item .badge-media { background: rgba(0,0,0,0.7); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 11px; }

/* Location tracking */
.map-container { height: 500px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.tracking-list { max-height: 500px; overflow-y: auto; }

/* Language selector */
.lang-selector { display: inline-flex; }
.lang-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn:first-child { border-radius: 6px 0 0 6px; }
.lang-btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lang-btn:hover { border-color: var(--primary); }

/* Login lang selector */
.langs-block { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.langs-block .lang-btn { flex: 1; text-align: center; padding: 8px; border-radius: 7px; }

/* Responsive */
@media (max-width: 992px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row-3, .form-row-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .search-box { max-width: 100%; }
}
