/* CheesePro PWA - Main Stylesheet */
:root {
  --primary: #1a5276;
  --primary-light: #2471a3;
  --primary-dark: #154360;
  --accent: #f39c12;
  --accent-light: #f5b041;
  --success: #1e8449;
  --danger: #c0392b;
  --warning: #d68910;
  --info: #1a6fa8;
  --sidebar-width: 260px;
  --navbar-height: 60px;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f0f4f8; overflow-x: hidden; }

/* ── LOGIN ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-bg {
  min-height: 100vh; width: 100%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 500px; height: 500px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.login-bg::after {
  content: ''; position: absolute; bottom: -30%; left: -10%;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-card {
  background: white; border-radius: 20px; padding: 2.5rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon {
  width: 70px; height: 70px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem; color: white; margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(26,82,118,0.3);
}
.login-logo h1 { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin: 0; }
.login-logo p { color: #6c757d; margin: 0; font-size: 0.9rem; }
.login-footer { text-align: center; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #eee; }

/* ── LAYOUT ── */
.sidebar {
  position: fixed; left: 0; top: 0; width: var(--sidebar-width); height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex; flex-direction: column; z-index: 1000;
  transition: transform 0.3s ease; overflow: hidden;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem; flex-shrink: 0;
}
.small-icon { width: 36px; height: 36px; font-size: 1rem; }
.sidebar-user {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem; background: rgba(255,255,255,0.08); margin: 0.5rem;
  border-radius: 10px;
}
.user-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: white; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.nav-section { padding: 0.5rem 1rem; margin-top: 0.5rem; }
.nav-section-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.4); font-weight: 600; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem;
  color: rgba(255,255,255,0.75); text-decoration: none; border-radius: 10px; margin: 2px 0.5rem;
  transition: all 0.2s; font-size: 0.9rem; font-weight: 500;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,0.15); color: white;
}
.sidebar-link.active { background: rgba(255,255,255,0.2); color: white; font-weight: 600; }
.sidebar-link i { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-link .badge { margin-left: auto; }
.sidebar-bottom { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }

.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin 0.3s; }
.top-navbar {
  height: var(--navbar-height); background: white; border-bottom: 1px solid #e9ecef;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.top-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
}
.page-wrapper { padding: 1.5rem; }

/* ── CARDS ── */
.stat-card {
  background: white; border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); border: 1px solid #e9ecef; transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 56px; height: 56px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center; font-size: 1.5rem;
}
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: #1a1a2e; }
.stat-label { font-size: 0.8rem; color: #6c757d; margin-top: 0.25rem; font-weight: 500; }
.stat-change { font-size: 0.75rem; margin-top: 0.5rem; }

.card-section { background: white; border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid #e9ecef; }
.card-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-section-title { font-weight: 700; color: #1a1a2e; margin: 0; }

/* ── STATUS BADGES ── */
.status-badge {
  padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem;
  font-weight: 600; text-transform: capitalize; display: inline-flex; align-items: center; gap: 0.3rem;
}
.status-new        { background: #e3f2fd; color: #1565c0; }
.status-approved   { background: #e8f5e9; color: #2e7d32; }
.status-production { background: #fff3e0; color: #e65100; }
.status-packing    { background: #fce4ec; color: #c62828; }
.status-dispatch   { background: #f3e5f5; color: #6a1b9a; }
.status-in_transit { background: #e0f2f1; color: #00695c; }
.status-delivered  { background: #e8f5e9; color: #1b5e20; }
.status-cancelled  { background: #fafafa; color: #757575; }

.priority-low    { background: #e8f5e9; color: #2e7d32; }
.priority-medium { background: #fff3e0; color: #e65100; }
.priority-high   { background: #fce4ec; color: #c62828; }
.priority-urgent { background: #ff1744; color: white; }

/* ── TABLE ── */
.data-table { font-size: 0.875rem; }
.data-table th { font-weight: 600; background: #f8f9fa; border-top: none; color: #495057; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { vertical-align: middle; }
.data-table tr:hover td { background: #f8f9fa; }

/* ── FORMS ── */
.form-card { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.form-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid #e9ecef; }

/* ── ORDER STATUS STEPPER ── */
.order-stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding-bottom: 0.5rem; }
.step-item { display: flex; flex-direction: column; align-items: center; min-width: 80px; position: relative; }
.step-item:not(:last-child)::after {
  content: ''; position: absolute; top: 16px; left: 50%; width: 100%;
  height: 2px; background: #dee2e6; z-index: 0;
}
.step-item.done::after { background: var(--success); }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid #dee2e6;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; background: white; color: #adb5bd; z-index: 1; font-weight: 600;
}
.step-item.active .step-circle { border-color: var(--primary); background: var(--primary); color: white; }
.step-item.done .step-circle { border-color: var(--success); background: var(--success); color: white; }
.step-label { font-size: 0.65rem; margin-top: 4px; color: #6c757d; text-align: center; }
.step-item.active .step-label { color: var(--primary); font-weight: 600; }
.step-item.done .step-label { color: var(--success); }

/* ── MAP ── */
#mapContainer { border-radius: var(--radius); overflow: hidden; }
.driver-marker { background: var(--primary); color: white; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 2px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.3); font-size: 1rem; }
.driver-label { background: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* ── NOTIFICATIONS ── */
.notif-item { display: flex; gap: 1rem; padding: 1rem; border-bottom: 1px solid #f0f0f0; transition: background 0.2s; cursor: pointer; }
.notif-item:hover { background: #f8f9fa; }
.notif-item.unread { background: #f0f7ff; }
.notif-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-body .title { font-weight: 600; font-size: 0.875rem; }
.notif-body .msg { font-size: 0.8rem; color: #6c757d; }
.notif-body .time { font-size: 0.72rem; color: #adb5bd; margin-top: 2px; }

/* ── INSTALL BANNER ── */
.install-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid #dee2e6;
  padding: 1rem 1.5rem; z-index: 2000; box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

/* ── RESPONSIVE ── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

@media (max-width: 576px) {
  .page-wrapper { padding: 1rem; }
  .stat-value { font-size: 1.6rem; }
  .login-card { padding: 2rem 1.5rem; }
}

/* ── LOADING ── */
.loading-overlay { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; color: #6c757d; gap: 1rem; }
.spinner-grow-sm { width: 1.5rem; height: 1.5rem; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 3rem; color: #adb5bd; }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; }
.empty-state h6 { color: #6c757d; }

/* ── ORDER ITEMS ── */
.order-item-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: #f8f9fa; border-radius: 10px; margin-bottom: 0.5rem; }
.order-item-row .product-badge { background: var(--primary); color: white; border-radius: 8px; padding: 0.4rem 0.75rem; font-size: 0.8rem; font-weight: 600; }

/* ── VEHICLE CARDS ── */
.vehicle-card { background: white; border-radius: var(--radius); padding: 1.25rem; border: 1px solid #e9ecef; box-shadow: var(--shadow); }
.vehicle-status { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.vehicle-status.online, .vehicle-status.moving { background: #2ecc71; }
.vehicle-status.offline { background: #bdc3c7; }
.vehicle-status.stopped { background: #e74c3c; }
.vehicle-status.idle { background: #f39c12; }

/* Color palette helpers */
.bg-primary-soft { background: rgba(26,82,118,0.1); }
.bg-success-soft { background: rgba(30,132,73,0.1); }
.bg-warning-soft { background: rgba(243,156,18,0.1); }
.bg-danger-soft  { background: rgba(192,57,43,0.1); }
.bg-info-soft    { background: rgba(26,111,168,0.1); }

.text-primary { color: var(--primary) !important; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }

/* Transition */
.page-fade { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
