/* index.css - Modern Enterprise SaaS Styling for Top 2 Bottom Facility Solutions */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary & Slate Color Tokens */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #059669;
  
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  
  --border-color: #e2e8f0;
  --border-dark: #334155;
  
  /* Status Colors */
  --badge-success-bg: #d1fae5;
  --badge-success-text: #065f46;
  --badge-warning-bg: #fef3c7;
  --badge-warning-text: #92400e;
  --badge-danger-bg: #ffe4e6;
  --badge-danger-text: #9f1239;
  --badge-primary-bg: #e0f2fe;
  --badge-primary-text: #075985;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Shell */
#app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  transition: width 0.2s ease;
}

.brand-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-dark);
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #10b981, #047857);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: white;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.nav-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 700;
  padding: 12px 12px 6px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: white;
}

.nav-item.active {
  background-color: var(--bg-sidebar-active);
  color: white;
  font-weight: 600;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

/* Priority Flow Tour Launcher Banner */
.tour-banner {
  margin: 12px;
  padding: 14px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  color: white;
}

.tour-banner h4 {
  font-size: 13px;
  font-weight: 700;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.tour-banner p {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 10px;
}

/* Main Workspace */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Bar */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  width: 340px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.search-bar:focus-within {
  background-color: white;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

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

/* Role Switcher Pill */
.role-switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.role-switcher-btn:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
}

.role-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.role-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.role-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.role-badge-small {
  font-size: 10px;
  color: var(--primary-600);
  font-weight: 600;
}

/* Page Content Viewport */
.content-viewport {
  padding: 28px;
  flex: 1;
}

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

.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Button UI Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary-600);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-700);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-secondary {
  background-color: white;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

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

/* Cards & Layout Containers */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 4px 0;
  letter-spacing: -0.5px;
}

.kpi-trend {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: #059669; }
.trend-down { color: #e11d48; }

/* Status Chips / Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.badge-success { background-color: var(--badge-success-bg); color: var(--badge-success-text); }
.badge-warning { background-color: var(--badge-warning-bg); color: var(--badge-warning-text); }
.badge-danger { background-color: var(--badge-danger-bg); color: var(--badge-danger-text); }
.badge-primary { background-color: var(--badge-primary-bg); color: var(--badge-primary-text); }

/* Table Styling */
.table-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background-color: #f8fafc;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-main);
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr.hover-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.custom-table tr.hover-row:hover {
  background-color: #f1f5f9;
}

/* Grid Layouts */
.grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: white;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

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

/* Territory Map Canvas Component */
.map-container {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.state-box {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.state-box:hover {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-sm);
}

.state-box h5 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.state-box p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Kanban Board Styling */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-column {
  flex: 1;
  min-width: 260px;
  background-color: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 14px;
}

.kanban-header {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-card {
  background-color: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  border-color: var(--primary-500);
}

/* Sign-In Experience */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.2fr 0.95fr;
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.18), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #111827 52%, #1e293b 100%);
}

.auth-hero {
  padding: 64px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.auth-title {
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: -1.4px;
  max-width: 720px;
  margin-bottom: 18px;
}

.auth-subtitle {
  max-width: 640px;
  color: #cbd5e1;
  font-size: 16px;
  margin-bottom: 28px;
}

.auth-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-role-card {
  background: rgba(15, 23, 42, 0.54);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 164px;
  backdrop-filter: blur(8px);
}

.auth-role-head {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-role-head strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.auth-role-head p {
  color: #cbd5e1;
  font-size: 12px;
}

.auth-role-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
}

.auth-panel {
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.auth-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: white;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.account-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.account-user-card {
  width: 100%;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.account-user-card:hover {
  border-color: var(--primary-500);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.account-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.account-user-card strong,
.user-list-identity strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
}

.account-user-card small,
.user-list-identity p {
  font-size: 11px;
  color: #64748b;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.user-list-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-list-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr auto;
  gap: 16px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.user-list-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 1100px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    padding: 40px 28px 24px 28px;
  }

  .auth-panel {
    padding: 0 28px 28px 28px;
  }
}

@media (max-width: 900px) {
  .grid-2col,
  .form-grid,
  .auth-role-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
  }

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

  #app {
    flex-direction: column;
  }

  .page-header,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    height: auto;
  }

  .search-bar {
    width: 100%;
  }

  .user-list-row {
    grid-template-columns: 1fr;
  }
}
