/* ==========================================================================
   v2.css — Unified Shell Architecture Styles
   Choozin Farm Customer Platform (Customer Core Map + Intelligence Dashboard)
   ========================================================================== */

/* Universal Layout Container */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--font, 'Plus Jakarta Sans', 'Prompt', sans-serif);
  background-color: var(--bg-primary, #090d16);
  color: var(--text-primary, #f8fafc);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. Unified Top Navigation Bar
   ========================================================================== */
.v2-topbar {
  height: 56px;
  background: var(--bg-card, #0f172a);
  border-bottom: 1px solid var(--border, #334155);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  gap: 12px;
}

/* Brand Section */
.v2-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.v2-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--accent, #fab72b);
  object-fit: contain;
  background: var(--bg-primary, #090d16);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.v2-brand-logo:hover {
  transform: scale(1.05);
}

.v2-brand-divider {
  width: 1px;
  height: 22px;
  background: var(--border, #334155);
  opacity: 0.6;
}

.header-info-popover {
  width: 295px !important;
}

.header-info-popover .v2-status-pill {
  font-size: 10.5px;
  padding: 2px 8px;
}

/* Navigation Tabs */
.v2-nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.v2-nav-tabs::-webkit-scrollbar {
  display: none;
}

.v2-nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.v2-nav-tab:hover {
  color: var(--text-primary, #f8fafc);
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

.v2-nav-tab.active {
  color: #ffffff;
  background: var(--accent, #3b82f6);
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

:root[data-theme="dark"] .v2-nav-tab.active {
  background: #2563eb;
  border-color: #3b82f6;
}

/* Right-Side Actions */
.v2-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Latency Status Pill */
.v2-status-pill {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   2. Main Viewport & Page Scrolling Mechanics
   ========================================================================== */
.v2-viewport {
  height: calc(100vh - 56px);
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* General Page Section Rules */
.v2-viewport .page {
  display: none;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.v2-viewport .page.active {
  display: block;
  animation: fadein 0.18s ease-out;
}

/* Map Tab is special: Fullscreen layout with sliding sidebar */
.v2-viewport #page-map.page.active {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* All Analytics Tabs: Independent smooth vertical scrolling */
.v2-viewport #page-overview.page.active,
.v2-viewport #page-atrisk.page.active,
.v2-viewport #page-top.page.active,
.v2-viewport #page-yearcompare.page.active,
.v2-viewport #page-lookup.page.active,
.v2-viewport #page-czhistory.page.active {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 40px 24px;
}

.v2-viewport .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0;
}

/* Sticky Search Card adjustment for sub-scroll containers */
.v2-viewport .sticky-lookup-card {
  top: 0px !important;
}

/* ==========================================================================
   3. Map Detail Drawer Enhancement: Link to Customer 360
   ========================================================================== */
.btn-action-intelligence {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #3b82f6;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  margin-top: 10px;
}

.btn-action-intelligence:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-action-intelligence:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .v2-brand-title span:nth-child(2),
  .v2-brand-title span:nth-child(3) {
    display: none;
  }
  .v2-badge-unified {
    display: none;
  }
  .v2-nav-tab {
    padding: 6px 9px;
    font-size: 12px;
  }
}
