/**
 * BKB Local Commander — Modern SaaS Design System
 * Inspired by BrightLocal, Stripe, and Linear
 */

:root {
  --bg-app: #0b0f19;
  --bg-sidebar: #111827;
  --bg-card: #141e33;
  --bg-card-subtle: #0f172a;
  --bg-card-hover: #1e293b;
  --border: #1f2937;
  --border-light: #334155;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;
  --brand-primary: #f97316;
  --brand-primary-hover: #ea580c;
  --google-blue: #3b82f6;
  --success-green: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning-amber: #f59e0b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --sidebar-w: 260px;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── App Layout Frame ─────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Modern Left Sidebar ──────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-row {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.brand-icon-box {
  width: 32px;
  height: 32px;
  background: var(--brand-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  color: #fff;
}

.brand-text-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand-text-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Business Switcher Selector Pill */
.sidebar-biz-selector {
  margin: 1rem 1rem 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-biz-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

.sidebar-biz-dropdown {
  background: transparent;
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  width: 100%;
}

.sidebar-biz-dropdown option {
  background: var(--bg-sidebar);
  color: #fff;
}

/* Sidebar Nav Items */
.sidebar-nav {
  padding: 0.75rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.nav-link.active {
  background: rgba(249, 115, 22, 0.12);
  color: var(--brand-primary);
  font-weight: 700;
}

.nav-link-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.nav-badge-pill {
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}

/* Sidebar Footer / User Profile */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: #374151;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.user-info-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* ── Main Workspace ───────────────────────────────────────── */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.topbar-sync-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--success-green);
  font-family: var(--font-mono);
  background: var(--success-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--success-green);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: #e2e8f0;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #64748b;
  color: #fff;
}

.btn-primary {
  background: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  color: #fff;
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
}

/* ── Content Viewport ─────────────────────────────────────── */
.content-viewport {
  padding: 2rem;
  max-width: 1250px;
  width: 100%;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ── Modern Metrics Cards ─────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card-modern {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.metric-card-modern:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.metric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.metric-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-card-icon {
  color: var(--text-muted);
}

.metric-card-num {
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.metric-card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--success-green);
  background: var(--success-bg);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

/* ── Review Cards in Modern Inbox ─────────────────────────── */
.review-inbox-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.review-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.reviewer-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reviewer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: #1e293b;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #f8fafc;
}

.reviewer-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff;
}

.reviewer-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.star-rating {
  color: #fbbf24;
  font-size: 0.95rem;
  letter-spacing: 2px;
}

.review-body-text {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* Copilot Tone Selector */
.copilot-response-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1rem;
}

/* ── Clean Data Tables ────────────────────────────────────── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-header-bar {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.clean-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.clean-table th {
  padding: 0.85rem 1.5rem;
  background: #0f172a;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.clean-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: #e2e8f0;
}

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

.clean-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.rank-badge-emerald {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  background: var(--success-bg);
  color: var(--success-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ── Mobile Bottom Navigation Bar ─────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.mobile-nav-item.active {
  color: var(--brand-primary);
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

/* ── Responsive Viewports ─────────────────────────────────── */
@media (max-width: 900px) {
  .app-sidebar {
    display: none;
  }
  .app-main {
    margin-left: 0;
    margin-bottom: 60px;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .topbar {
    padding: 0 1rem;
  }
  .content-viewport {
    padding: 1.25rem 1rem;
  }
}
