/* ═══════════════════════════════════════════════════════
   The Hamilton — Command Centre Shared Styles
   MSL Property Group
   ═══════════════════════════════════════════════════════ */

:root {
  --navy: #1D2F4E;
  --navy-700: #2D4565;
  --navy-500: #4A6282;
  --navy-300: #7A92A9;
  --navy-200: #B8C5D1;
  --navy-100: #E8ECF0;
  --gold: #DBBA5C;
  --gold-dark: #8B7340;
  --gold-light: #E5C97A;
  --gold-pale: #F5E6C4;
  --gold-tint: #FBF6EA;
  --rose: #C4A0A8;
  --charcoal: #1F1F1F;
  --grey-700: #374151;
  --grey-500: #6B7280;
  --grey-400: #9CA3AF;
  --grey-300: #D1D5DB;
  --grey-200: #E5E7EB;
  --white: #FFFFFF;
  --warm-white: #FAFAF8;
  --cream: #F8F8F6;
  --stone: #F4F4F2;
  --ivory: #FAF9F7;
  --sold-green: #2D6A4F;
  --for-sale-gold: #DBBA5C;
  --nfs-grey: #4A6282;
  --pending-blue: #3B82F6;
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--navy);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === HEADER === */
.header {
  background: linear-gradient(135deg, #0D1B2E 0%, var(--navy) 50%, #1a2a44 100%);
  border-bottom: 1px solid rgba(219,186,92,0.2);
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 1px;
}

.header-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--white);
}

.header-subtitle {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--gold);
  margin-top: 2px;
}

.header-meta {
  text-align: right;
  font-size: 11px;
  color: var(--grey-400);
  letter-spacing: 0.5px;
}

.header-meta span { color: var(--gold); }

/* === NAV TABS === */
.nav-tabs {
  display: flex;
  gap: 0;
  background: rgba(13,27,46,0.95);
  border-bottom: 1px solid rgba(219,186,92,0.12);
  padding: 0 40px;
}

.nav-tab {
  padding: 16px 32px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--grey-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

.nav-tab:hover { color: var(--white); }

.nav-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.nav-tab .tab-count {
  font-size: 9px;
  background: rgba(219,186,92,0.15);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  font-weight: 500;
}

/* === DASHBOARD PANELS === */
.dashboard-panel {
  display: none;
  padding: 32px 40px;
  animation: fadeIn 0.4s ease;
}

.dashboard-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === SUMMARY CARDS === */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: linear-gradient(145deg, rgba(45,69,101,0.4) 0%, rgba(29,47,78,0.6) 100%);
  border: 1px solid rgba(219,186,92,0.12);
  border-radius: 8px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold);
  opacity: 0.6;
}

.summary-card .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--grey-400);
  margin-bottom: 8px;
}

.summary-card .value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--white);
  line-height: 1;
}

.summary-card .sub {
  font-size: 11px;
  color: var(--gold-light);
  margin-top: 6px;
}

/* === BUILDING GRID === */
.building-container {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.building-grid-wrapper {
  flex: 1;
  min-width: 0;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.level-label {
  width: 70px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--grey-400);
  flex-shrink: 0;
}

.level-label.penthouse { color: var(--gold); }

.units-row {
  display: flex;
  gap: 4px;
  flex: 1;
}

.unit-cell {
  flex: 1;
  min-width: 0;
  aspect-ratio: 1.6;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  font-size: 11px;
  border: 1px solid transparent;
}

.unit-cell:hover {
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.unit-cell .lot-num {
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}

.unit-cell .unit-config {
  font-size: 8px;
  opacity: 0.8;
  margin-top: 2px;
}

/* Status colors */
.unit-cell.sold {
  background: linear-gradient(145deg, rgba(45,106,79,0.5) 0%, rgba(45,106,79,0.25) 100%);
  border-color: rgba(45,106,79,0.4);
  color: #86EFAC;
}

.unit-cell.for-sale {
  background: linear-gradient(145deg, rgba(219,186,92,0.35) 0%, rgba(219,186,92,0.15) 100%);
  border-color: var(--gold);
  color: var(--gold);
  animation: pulseGold 2.5s ease-in-out infinite;
}

@keyframes pulseGold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(219,186,92,0); }
  50% { box-shadow: 0 0 16px 2px rgba(219,186,92,0.25); }
}

.unit-cell.not-for-sale {
  background: rgba(74,98,130,0.2);
  border-color: rgba(74,98,130,0.3);
  color: var(--navy-300);
  opacity: 0.5;
}

.unit-cell.nts {
  background: rgba(196,160,168,0.2);
  border-color: rgba(196,160,168,0.3);
  color: var(--rose);
}

.unit-cell.pending {
  background: rgba(59,130,246,0.2);
  border-color: rgba(59,130,246,0.3);
  color: #93C5FD;
}

.unit-cell.bc {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #FCA5A5;
}

/* === UNIT DETAIL POPUP === */
.unit-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(160deg, #1a2a44 0%, #0D1B2E 100%);
  border: 1px solid rgba(219,186,92,0.3);
  border-radius: 12px;
  padding: 32px;
  z-index: 1000;
  min-width: 360px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.6);
}

.unit-popup.visible { display: block; }

.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  backdrop-filter: blur(4px);
}

.popup-overlay.visible { display: block; }

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

.popup-lot {
  font-family: 'Cormorant Garamond', serif;
  font-size: 36px;
  font-weight: 600;
  color: var(--white);
}

.popup-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: none;
  color: var(--grey-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.popup-close:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.popup-field .pf-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--grey-400);
  margin-bottom: 4px;
}

.popup-field .pf-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--white);
}

.popup-field .pf-value.gold { color: var(--gold); }
.popup-field .pf-value.green { color: #86EFAC; }

.popup-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: rgba(219,186,92,0.15);
  margin: 4px 0;
}

.popup-status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.popup-status-badge.sold { background: rgba(45,106,79,0.3); color: #86EFAC; border: 1px solid rgba(45,106,79,0.5); }
.popup-status-badge.for-sale { background: rgba(219,186,92,0.2); color: var(--gold); border: 1px solid rgba(219,186,92,0.4); }
.popup-status-badge.nfs { background: rgba(74,98,130,0.2); color: var(--navy-300); border: 1px solid rgba(74,98,130,0.4); }

/* === LEGEND === */
.legend {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--grey-400);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.sold { background: rgba(45,106,79,0.6); border: 1px solid rgba(45,106,79,0.8); }
.legend-dot.for-sale { background: rgba(219,186,92,0.4); border: 1px solid var(--gold); }
.legend-dot.nfs { background: rgba(74,98,130,0.3); border: 1px solid rgba(74,98,130,0.5); }
.legend-dot.nts { background: rgba(196,160,168,0.3); border: 1px solid rgba(196,160,168,0.5); }
.legend-dot.pending { background: rgba(59,130,246,0.3); border: 1px solid rgba(59,130,246,0.5); }
.legend-dot.bc { background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4); }

/* === CHART CONTAINERS === */
.chart-section {
  background: linear-gradient(145deg, rgba(45,69,101,0.2) 0%, rgba(29,47,78,0.3) 100%);
  border: 1px solid rgba(219,186,92,0.08);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}

.chart-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 4px;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--grey-400);
  margin-bottom: 20px;
  letter-spacing: 0.3px;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
}

.chart-canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

/* === SIDEBAR STATS === */
.sidebar-stats {
  width: 280px;
  flex-shrink: 0;
}

.stat-block {
  background: linear-gradient(145deg, rgba(45,69,101,0.3) 0%, rgba(29,47,78,0.4) 100%);
  border: 1px solid rgba(219,186,92,0.1);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 12px;
}

.stat-block .sb-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--grey-400);
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stat-row:last-child { border-bottom: none; }

.stat-row .sr-label {
  font-size: 12px;
  color: var(--grey-300);
}

.stat-row .sr-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.stat-row .sr-value.gold { color: var(--gold); }

/* === FUNNEL CHART === */
.funnel-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
}

.funnel-stage {
  text-align: center;
  position: relative;
}

.funnel-bar {
  margin: 0 auto 8px;
  border-radius: 6px;
  transition: all 0.3s;
}

.funnel-stage .fs-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--white);
}

.funnel-stage .fs-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--grey-400);
  margin-top: 4px;
}

.funnel-arrow {
  color: var(--gold);
  font-size: 20px;
  opacity: 0.5;
}

/* === TABLE STYLES === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--grey-400);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(219,186,92,0.15);
  font-weight: 600;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--grey-200);
}

.data-table tr:hover td {
  background: rgba(219,186,92,0.04);
}

/* === GRID LAYOUTS === */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .building-container { flex-direction: column; }
  .sidebar-stats { width: 100%; }
  .two-col, .three-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header { padding: 16px 20px; }
  .nav-tabs { padding: 0 20px; }
  .dashboard-panel { padding: 20px; }
  .nav-tab { padding: 12px 16px; font-size: 10px; letter-spacing: 1px; }
}

/* === SECTION HEADERS === */
.section-header {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(219,186,92,0.15);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(29,47,78,0.5); }
::-webkit-scrollbar-thumb { background: var(--navy-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.unit-cell.contracted {
  background: rgba(59,130,246,0.2);
  border-color: rgba(59,130,246,0.3);
  color: #93C5FD;
}


.unit-cell.empty-slot {
  visibility: hidden;
}

/* === UNIT DETAIL POPUP === */

.popup-status-badge.contracted { background: rgba(59,130,246,0.2); color: #93C5FD; border: 1px solid rgba(59,130,246,0.4); }

/* === LEGEND === */

.legend-dot.contracted { background: rgba(59,130,246,0.3); border: 1px solid rgba(59,130,246,0.5); }

/* === CHART CONTAINERS === */

.unit-cell.inactive {
  background: rgba(74,98,130,0.15);
  border-color: rgba(122,146,169,0.25);
  color: var(--navy-300);
  opacity: 0.65;
}


.popup-status-badge.inactive { background: rgba(122,146,169,0.2); color: var(--navy-300); border: 1px solid rgba(122,146,169,0.4); }

/* === LEGEND === */

.legend-dot.inactive { background: rgba(122,146,169,0.25); border: 1px solid rgba(122,146,169,0.4); }

/* === CHART CONTAINERS === */
/* ── UNDER CONTRACT status ── */
.unit-cell.under-contract {
  background: rgba(251, 146, 60, 0.15);
  border-color: #FB923C;
  cursor: pointer;
}
.unit-cell.under-contract .lot-num {
  color: #FB923C;
}
.legend-dot.under-contract {
  background: #FB923C;
}
.popup-status-badge.under-contract {
  background: rgba(251, 146, 60, 0.15);
  color: #FB923C;
  border: 1px solid rgba(251, 146, 60, 0.4);
}
