/* Modern rectangular blue tab styles for .tab and .filter-btn */

/* Unified tab/button style: dark background, white text by default; white background, dark text when active */
.tab, .filter-btn {
  display: inline-block;
  padding: 12px 24px;
  background: #1a2b3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Avenir Pro', sans-serif;
  font-weight: 600;
  margin-right: 8px;
  margin-bottom: 8px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(26,43,60,0.08);
  outline: none;
}
.tab:hover, .filter-btn:hover {
  background: #223344;
  color: #fff;
}
.tab.active, .filter-btn.active {
  background: #fff;
  color: #1a2b3c;
  box-shadow: 0 4px 12px rgba(26,43,60,0.12);
  border: 2px solid #1a2b3c;
}
@media (max-width: 768px) {
  .tab, .filter-btn {
    padding: 8px 12px;
    font-size: 13px;
    margin-right: 6px;
    margin-bottom: 8px;
  }
  
  /* Hide map view button on mobile */
  #viewClientsMapBtn {
    display: none !important;
  }
  
  /* Consistent top padding for all pages on mobile */
  .main-content {
    padding-top: 130px !important;
  }
}

:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --accent: #1a2b3c;
  --muted: #6b7280;
  --success: #15803d;
  --danger: #dc2626;
  font-family: "Avenir Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #ffffff;
  font-family: "Avenir Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
}

/* Sidebar Styles - Unified for all client portal pages */
.sidebar {
  width: 220px;
  background: #1a2b3c;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 24px 0;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 8px rgba(26,43,60,0.04);
  transition: width 0.2s;
  scrollbar-width: thin;
  scrollbar-color: #223344 #1a2b3c;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: #1a2b3c;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #223344;
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #2a4050;
}
.sidebar-logo {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 0 0;
}
.sidebar-logo svg {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}
.sidebar-logo-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: center;
  padding: 0 16px;
  line-height: 1.3;
}
.sidebar-divider {
  width: 80%;
  height: 1px;
  background: #d1d5db;
  margin: 0 0 18px 0;
}
.sidebar-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.sidebar-menu a {
  width: 80%;
  display: block;
  padding: 10px 0;
  text-align: left;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  border-radius: 6px;
  font-weight: 500;
  padding-left: 16px;
  transition: background 0.2s, color 0.2s;
}
.sidebar-menu a.active, .sidebar-menu a:hover {
  background: #223344;
}

/* Main content area for dashboard pages */
.main-content {
  flex: 1;
  padding: 140px 0 0 0;
  margin-left: 220px;
}
.page-header {
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  background: #f6f8fa;
  padding: 40px 24px 32px 24px;
  z-index: 100;
  border-bottom: 1px solid #e5e7eb;
}
h2 {
  color: #1a2b3c;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  padding: 0;
  text-align: left;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
}

/* Mobile Navigation Bar */
.mobile-nav-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #1a2b3c;
  z-index: 1001;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mobile-nav-bar .nav-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  border-radius: 6px;
  transition: background 0.2s;
}

.mobile-nav-bar .nav-icon:hover {
  background: rgba(255,255,255,0.1);
}

.mobile-nav-bar .nav-icon svg {
  width: 24px;
  height: 24px;
}

/* Responsive Sidebar for Mobile */
@media (max-width: 768px) {
  .mobile-nav-bar {
    display: flex !important;
  }
  
  .dashboard-layout {
    flex-direction: column;
  }
  
  .sidebar,
  .sidebar-injected {
    position: fixed !important;
    left: -280px !important;
    top: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    flex-direction: column !important;
    padding: 24px 16px !important;
    transition: left 0.3s ease !important;
    z-index: 1001 !important;
    box-shadow: 2px 0 16px rgba(0,0,0,0.3);
  }
  
  .sidebar.mobile-open,
  .sidebar-injected.mobile-open {
    left: 0 !important;
  }
  
  .sidebar-logo {
    flex-direction: column;
    padding: 0 0 24px 0;
  }
  
  .sidebar-logo-title {
    margin: 8px 0 0 0;
    font-size: 16px;
  }
  
  .sidebar-divider {
    display: block;
  }
  
  .sidebar-menu {
    flex-direction: column;
    width: 100%;
  }
  
  .sidebar-menu a {
    width: 80%;
    margin: 0 auto 8px auto;
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .main-content {
    margin-left: 0;
    padding: 140px 16px 16px 16px;
    width: 100%;
    overflow-x: hidden;
  }
  
  .page-header {
    left: 0;
    top: 60px;
    padding: 20px 16px 16px 16px;
    position: fixed;
    z-index: 900;
    background: #f6f8fa;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .page-header h2 {
    font-size: 20px;
    text-align: center;
    margin: 0;
  }
  
  /* Mobile overlay when menu is open */
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }
  
  .mobile-menu-overlay.active {
    display: block;
  }
  
  /* Make tables responsive */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
  }
  
  /* Make cards stack on mobile */
  .info-card, .card {
    margin: 0 0 16px 0;
    padding: 16px;
  }
  
  /* Smaller fonts on mobile */
  body, .main-content, .main-content * {
    font-size: 14px;
  }
  
  h1 { font-size: 22px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  h4 { font-size: 16px; }
  
  /* Button adjustments */
  .btn, .primary, button {
    padding: 10px 16px;
    font-size: 14px;
    width: 100%;
    margin-bottom: 8px;
  }
  
  /* Form adjustments */
  input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    width: 100%;
  }
  
  /* Modal adjustments */
  .modal-content {
    width: 95%;
    max-width: 95vw;
    padding: 20px;
    max-height: 85vh;
  }
}

/* Font family enforcement for sidebar and main content */
.sidebar, .sidebar-logo, .sidebar-logo-title, .sidebar-menu, .sidebar-menu a, h2 {
  font-family: "Avenir Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif !important;
}
.main-content, .main-content *, h1, h2, h3, h4, h5, h6, body {
  font-family: "Avenir Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif !important;
}

/* Back button styling */
.back-button {
  color: #1a2b3c;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}
.back-button:hover {
  color: #2d3e50;
  text-decoration: underline;
}

/* --- Existing styles for login, cards, etc. below --- */
.container{max-width:420px;width:100%}
.card{background:var(--card);padding:28px;border-radius:12px;box-shadow:0 6px 20px rgba(15,23,42,0.08)}
.brand{margin:0 0 18px 0;font-size:20px;color:var(--accent);text-align:center}
.brand-sub{display:block;font-size:12px;color:var(--muted);font-weight:600}
.field{margin-bottom:14px}
label{display:block;font-weight:600;margin-bottom:6px;color:#111827}
input[type="email"],input[type="password"],input[type="text"]{width:100%;padding:10px 12px;border:1px solid #e6e9ee;border-radius:8px;font-size:14px}
.pw-row{display:flex;gap:8px}
.pw-row .toggle{padding:8px 10px;background:#f3f4f6;border:1px solid #e6e9ee;border-radius:8px;font-weight:600;cursor:pointer}
.forgot{margin-top:8px}
.forgot a{font-size:13px;color:var(--accent);text-decoration:none;font-weight:700}
.forgot a:hover{text-decoration:underline}
.hint{font-size:12px;color:var(--muted);margin-top:6px}
.pw-req{margin:8px 0 0 18px;padding:0;font-size:13px;color:var(--muted)}
.pw-req li{margin:6px 0}
.pw-req li.ok{color:var(--success);font-weight:600}
.error{color:var(--danger);font-size:13px;margin-top:6px}
.actions{margin-top:18px}
.primary{background:var(--accent);color:white;padding:10px 14px;border-radius:8px;border:0;font-weight:700;cursor:pointer;width:100%}
.result{margin-top:12px;font-size:14px}
.result.success{color:var(--success)}
.result.fail{color:var(--danger)}
.terms-row{display:flex;align-items:flex-start;gap:10px;margin-bottom:14px}
.round-checkbox{display:flex;align-items:center;cursor:pointer}
.round-checkbox input{display:none}
.round{display:inline-block;width:18px;height:18px;border:2px solid var(--accent);border-radius:50%;background:white;flex-shrink:0}
.round-checkbox input:checked ~ .round{background:var(--accent);box-shadow:inset 0 0 0 3px white}
.terms-row label{font-weight:400;font-size:12px;margin:0;color:#374151}
.terms-row a{color:var(--accent);text-decoration:none}
.terms-row a:hover{text-decoration:underline}
@media (max-width:480px){.card{padding:18px}}

/* Shared postcode-lookup widget (client-portal/address-lookup.js) - one look
   across every address entry point in the app instead of a different ad-hoc
   autocomplete (or none) per page. */
.address-lookup-results{margin-top:8px;border:1px solid #d1d5db;border-radius:6px;max-height:220px;overflow-y:auto;background:#fff;box-shadow:0 4px 6px rgba(0,0,0,0.08)}
.address-lookup-item{padding:10px 12px;font-size:14px;cursor:pointer;border-bottom:1px solid #e5e7eb}
.address-lookup-item:last-child{border-bottom:none}
.address-lookup-item:hover{background:#f3f4f6}
.address-lookup-empty{padding:10px 12px;font-size:13px;color:#6b7280}
