/* ============================================================
   MyBiogenic Customer Portal — Arctic Light
   Fonts: Inter (display) + DM Sans (body)
   Palette: Blue-Teal/Green/Amber/Rust on Cool Grey-White
   Matched to Driver App light2/ design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --logo-filter-lg: none;
  --bg-page:      #f8fafb;
  --bg-surface:   #ffffff;
  --bg-surface-hover: #f4f7f9;
  --bg-surface-strong: #edf1f4;
  --bg-inset:     #e4e9ee;

  /* Accent — Blue-Teal */
  --accent:       #0369a1;
  --accent-hover: #025e90;
  --accent-light: #e8f4fb;
  --accent-mid:   #a8d4ec;
  --accent-glow:  rgba(3, 105, 161, 0.10);

  /* Status */
  --status-good:    #059669;
  --status-good-bg: #ecfdf5;
  --status-warn:    #c2410c;
  --status-warn-bg: #fff4ed;
  --status-bad:     #be123c;
  --status-bad-bg:  #ffe4e8;
  --status-info:    #0369a1;
  --status-info-bg: #e8f4fb;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --text-dim:       #b5bcc6;
  --text-inverse:   #ffffff;

  /* Borders */
  --border:        rgba(15, 23, 42, 0.06);
  --border-strong: rgba(15, 23, 42, 0.10);
  --border-heavy:  rgba(15, 23, 42, 0.16);

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md:   0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:   0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-teal: 0 4px 14px rgba(3, 105, 161, 0.18);
  --shadow-green: 0 4px 14px rgba(5, 150, 105, 0.18);
  --shadow-amber: 0 4px 14px rgba(194, 65, 12, 0.18);

  /* Radii */
  --radius-sm:   10px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   24px;
  --radius-pill: 100px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    400ms;

  /* Layout */
  --nav-height: 56px;
}

/* --- Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.55;
  min-height: 100vh;
}

/* Background textures (matching driver app) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; border: none; outline: none; background: none; color: var(--text-primary); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; color: var(--text-primary); line-height: 1.2; }

/* --- Cards --- */
.card {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: all 0.25s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 700; }

.card-body { padding: var(--space-5); }

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-surface-strong);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px 26px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: var(--shadow-teal);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--text-inverse);
  box-shadow: 0 6px 20px rgba(3, 105, 161, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-surface-strong); border-color: var(--border-heavy); }

.btn-ghost { background: transparent; color: var(--text-muted); border: none; padding: 10px 20px; }
.btn-ghost:hover { background: var(--bg-surface-strong); color: var(--text-primary); }

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

/* --- Form Elements --- */
.form-group { display: flex; flex-direction: column; gap: var(--space-1); }

.form-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-input, .form-select, .form-textarea {
  padding: 13px 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 2px rgba(0,0,0,0.02);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input, .form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  line-height: 1.5;
}
.badge-good { background: var(--status-good-bg); color: var(--status-good); }
.badge-bad  { background: var(--status-bad-bg);  color: var(--status-bad); }
.badge-warn { background: var(--status-warn-bg); color: var(--status-warn); }
.badge-info { background: var(--status-info-bg); color: var(--status-info); }
.badge-muted { background: var(--bg-surface-strong); color: var(--text-secondary); border: 1px solid var(--border); }

.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* LOB badges */
.lob-medwaste { background: var(--accent-light); color: var(--accent); }
.lob-medwaste::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.lob-shredding { background: var(--status-warn-bg); color: var(--status-warn); }
.lob-shredding::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--status-warn); }

/* --- Topbar --- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(248, 250, 251, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.topbar-brand { display: flex; align-items: center; margin-right: var(--space-7); flex-shrink: 0; }
.topbar-brand img { height: 28px; width: auto; }

.topbar-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.topbar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  text-decoration: none;
}
.topbar-nav a:hover { color: var(--text-primary); background: var(--bg-surface-strong); }
.topbar-nav a.active { color: var(--accent); background: var(--accent-light); }
.topbar-nav a svg { width: 15px; height: 15px; stroke: currentColor; }

.topbar-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; line-height: 1; transition: color 0.2s, background 0.2s; }
.theme-toggle svg { display: block; }
.theme-toggle:hover { color: var(--accent); background: rgba(3, 105, 161, 0.08); }
.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease;
}
.topbar-user:hover { background: var(--bg-surface-strong); }
.topbar-user { position: relative; }
.topbar-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: var(--space-1) 0;
  z-index: 100;
}
.topbar-user-menu.open { display: block; }
.topbar-user-menu-item {
  display: block;
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
}
.topbar-user-menu-item:hover { background: var(--bg-surface-strong); color: var(--text-primary); }

.topbar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  font-family: var(--font-display);
}
.topbar-user-name { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { font-size: 11px; color: var(--text-secondary); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.animate-fade-in { animation: fadeIn var(--dur-base) var(--ease-out) both; }
.animate-slide-up { animation: slideUp 0.5s var(--ease-out) both; }

.stagger > :nth-child(1) { animation-delay: 0.04s; }
.stagger > :nth-child(2) { animation-delay: 0.08s; }
.stagger > :nth-child(3) { animation-delay: 0.12s; }
.stagger > :nth-child(4) { animation-delay: 0.16s; }
.stagger > :nth-child(5) { animation-delay: 0.20s; }
.stagger > :nth-child(6) { animation-delay: 0.24s; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.08); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.14); }

/* --- Load More — pagination bar for long lists --- */
.load-more-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.load-more-bar .load-more-count { font-weight: 500; }
.load-more-bar button {
  padding: var(--space-1) var(--space-4);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--accent);
  border: 1.5px solid rgba(3, 105, 161, 0.2);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.load-more-bar button:hover {
  background: rgba(3, 105, 161, 0.06);
  border-color: var(--accent);
}
.load-more-bar .load-more-sep {
  color: var(--text-muted);
  font-size: 11px;
}

/* --- Empty State — reusable component for no-data scenarios --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-5);
  text-align: center;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.empty-state-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
}
.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-family: var(--font-display);
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}
.empty-state-action {
  margin-top: var(--space-4);
}
.empty-state-action a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-inverse);
  text-decoration: none;
  transition: all 0.25s var(--ease-out);
  box-shadow: var(--shadow-teal);
}
.empty-state-action a:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(3, 105, 161, 0.25);
}
.empty-state-action a svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* --- Responsive --- */
/* --- Mobile hamburger toggle --- */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.mobile-menu-btn:hover { color: var(--accent); background: rgba(3, 105, 161, 0.08); }
.mobile-menu-btn svg { display: block; }

/* --- Mobile nav overlay --- */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 999;
  padding: var(--space-4);
  overflow-y: auto;
}
.mobile-nav.open { display: flex; flex-direction: column; gap: var(--space-1); }
.mobile-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-display);
  border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease-out);
}
.mobile-nav a:hover { background: var(--bg-surface-strong); color: var(--text-primary); }
.mobile-nav a.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.mobile-nav a svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

@media (max-width: 768px) {
  .topbar-nav { display: none; }
  .topbar-user-name, .topbar-user-role { display: none; }
  .mobile-menu-btn { display: flex; }
  .topbar-brand { margin-right: auto; }
}

/* --- Portal additions --- */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

/* ============================
   Shared Page Layout
   ============================ */
body { display: flex; flex-direction: column; }

.app-layout {
  flex: 1;
  padding-top: var(--nav-height);
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
  position: relative;
  z-index: 1;
}

.loc-panel {
  width: 264px;
  min-width: 264px;
  align-self: flex-start;
  position: sticky;
  top: calc(var(--nav-height) + 16px);
  margin-top: var(--space-6);
  margin-bottom: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - var(--nav-height) - 32px);
  box-shadow: var(--shadow-card);
}

.loc-panel-head {
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.loc-panel-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 2px; font-family: var(--font-display); }
.loc-panel-account { font-size: 14px; font-weight: 700; color: var(--text-primary); font-family: var(--font-display); }
.loc-panel-count { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.loc-list { flex: 1; overflow-y: auto; padding: var(--space-2) 0; }
.loc-list::-webkit-scrollbar { width: 3px; }
.loc-list::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }

.loc-card {
  display: block;
  position: relative;
  margin: 0 var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
}
.loc-card + .loc-card { margin-top: 2px; }
.loc-card:hover { background: var(--bg-surface-strong); color: inherit; }
.loc-card.active { background: var(--accent-light); border-color: var(--accent-mid); }
.loc-card.active::before { content: ''; position: absolute; left: -2px; top: 10px; bottom: 10px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }
.loc-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; margin-bottom: 1px; }
.loc-card-address { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

.loc-panel-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.loc-panel-footer svg { width: 12px; height: 12px; stroke: var(--text-muted); flex-shrink: 0; }

.main-content {
  flex: 1;
  min-width: 0;
  max-width: 1080px;
  padding: var(--space-6) 0 var(--space-10);
}

.page-header { margin-bottom: var(--space-5); }
.page-header h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.page-header p strong { color: var(--accent); font-weight: 600; }

@media (max-width: 900px) {
  .app-layout { flex-direction: column; align-items: stretch; gap: var(--space-3); padding-left: var(--space-3); padding-right: var(--space-3); }
  .loc-panel { width: 100%; min-width: unset; position: relative; top: auto; margin-top: var(--space-3); max-height: 300px; }
  .main-content { padding: var(--space-4) 0 var(--space-6); }
}
