/* ================================================================
   Sidebar Redesign — CSS
   Deal Score, Smart Sections, Action Dock, Comparison Rail,
   Quick Glance
   ================================================================ */

/* Reduce bottom padding since dock is sticky at the bottom of scroll */
.sidebar.has-dock {
  padding-bottom: 8px !important;
}

/* ── Deal Score Badge ──────────────────────────────────────────── */

.deal-score-container {
  display: none;
  padding: 16px;
  border-bottom: 1px solid #21262d;
  background: #161b22;
  border-radius: 8px;
  border: 1px solid #21262d;
  margin: 4px 6px;
}

.deal-score-main {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.2s;
  padding: 4px;
  border-radius: 8px;
}

.deal-score-main:hover {
  background: rgba(255, 255, 255, 0.03);
}

.deal-score-ring-wrap {
  flex-shrink: 0;
}

.deal-score-ring .deal-score-fill {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.deal-score-info {
  flex: 1;
  min-width: 0;
}

.deal-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #484f58;
  font-weight: 600;
}

.deal-score-verdict {
  font-size: 1.15em;
  font-weight: 700;
  margin: 3px 0;
}

.deal-score-hint {
  font-size: 0.82em;
  color: var(--faint);
  line-height: 1.4;
}

.deal-score-expand-hint {
  font-size: 0.78em;
  color: #00d4aa;
  margin-top: 4px;
  opacity: 0.8;
}

/* Breakdown */
.deal-score-breakdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 4px;
}

.deal-score-breakdown.expanded {
  max-height: 300px;
  padding: 10px 4px 4px;
}

.ds-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.82em;
}

.ds-breakdown-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9em;
}

.ds-breakdown-bar-wrap {
  flex: 1;
  height: 6px;
  background: #21262d;
  border-radius: 3px;
  overflow: hidden;
}

.ds-breakdown-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.ds-breakdown-val {
  width: 42px;
  text-align: right;
  font-size: 0.85em;
  color: var(--faint);
  font-weight: 500;
}

/* ── Smart Accordion Sections ─────────────────────────────────── */

.smart-accordion {
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}

.smart-accordion.expanded {
  border-left: 3px solid #00d4aa;
}

.smart-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  position: relative;
}

.smart-accordion-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.smart-accordion-header.always-open {
  cursor: default;
}

.smart-accordion-header.always-open:hover {
  background: transparent;
}

.sah-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sah-icon {
  font-size: 1em;
  width: 24px;
  text-align: center;
  color: #3d6b4f;
}

.sah-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3d6b4f;
}

.sah-count {
  font-size: 0.72em;
  color: var(--faint);
  font-weight: 400;
}

.sah-chevron {
  font-size: 0.8em;
  color: var(--faint);
  transition: transform 0.2s;
  width: 16px;
  text-align: center;
}

.smart-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.smart-accordion-body.expanded {
  max-height: 2000px;
  overflow: visible;
}

/* Fix nested section styling within accordions */
.smart-accordion-body > div {
  /* Preserve existing section styling */
}

/* ── Sticky Action Dock ───────────────────────────────────────── */

.action-dock {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: var(--panel, #faf9f6);
  border-top: 1px solid var(--border, #d9d5cd);
  box-shadow: 0 -2px 12px rgba(31,33,23,0.08);
  z-index: 100;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 8px;
  flex-shrink: 0;
}

.sidebar.has-dock {
  padding-bottom: 0 !important;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--muted, #5e6054);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  position: relative;
  min-width: 54px;
}

.dock-btn:hover {
  color: var(--text, #1f2117);
  background: rgba(61, 107, 79, 0.06);
}
.dock-btn:hover .dock-label {
  color: var(--muted, #5e6054);
}

.dock-btn:active {
  transform: scale(0.95);
}

.dock-btn.dock-btn-active {
  color: var(--primary, #3d6b4f);
  animation: dockPulse 1.5s ease infinite;
}

@keyframes dockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.dock-icon {
  font-size: 1.5em;
  line-height: 1;
  color: var(--muted, #5e6054);
}

.dock-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--text-faint, #9a9c92);
}

/* Proforma hero button — teal circle ring */
.dock-btn-hero {
  position: relative;
  color: #00d4aa;
  background: transparent;
  padding: 10px 14px;
}

.dock-btn-hero .dock-icon {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid #00d4aa;
  display: flex; align-items: center; justify-content: center;
  color: #00d4aa;
}

.dock-btn-hero::before {
  display: none;
}

.dock-btn-hero:hover {
  background: rgba(0, 212, 170, 0.06);
}

.dock-btn-hero .dock-icon {
  font-size: 1.65em;
}

.dock-roi-teaser {
  display: none;
  font-size: 0.55em;
  color: #00d4aa;
  font-weight: 600;
  white-space: nowrap;
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 212, 170, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

/* More menu */
.dock-more-wrap {
  position: relative;
}

.dock-more-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  background: var(--surface2, #ffffff);
  border: 1px solid var(--border, #d9d5cd);
  border-radius: 10px;
  padding: 4px;
  min-width: 180px;
  box-shadow: 0 -8px 24px rgba(31,33,23,0.12);
  margin-bottom: 8px;
}

.dock-more-menu.visible {
  display: block;
  animation: fadeSlideUp 0.15s ease;
}

.dock-more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text, #1f2117);
  padding: 8px 12px;
  font-size: 0.82em;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}

.dock-more-menu button:hover {
  background: rgba(61, 107, 79, 0.08);
  color: var(--primary, #3d6b4f);
}

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

/* ── Property Comparison Rail ─────────────────────────────────── */

.comparison-rail {
  display: none;
  height: 48px;
  background: #0d1117;
  border-top: 1px solid #2a3a4a;
  flex-shrink: 0;
  position: sticky;
  bottom: 76px; /* sits above the 76px dock */
  z-index: 99;
}

.cr-scroll {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  height: 100%;
  align-items: center;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cr-scroll::-webkit-scrollbar {
  display: none;
}

.cr-card {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  white-space: nowrap;
}

.cr-card:hover {
  background: rgba(0, 212, 170, 0.1);
  border-color: rgba(0, 212, 170, 0.3);
}

.cr-card.cr-current {
  border-color: #00d4aa;
  background: rgba(0, 212, 170, 0.08);
}

.cr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cr-addr {
  font-size: 0.72em;
  color: #d1d5db;
  font-weight: 500;
}

/* ── Quick Glance Overlay ─────────────────────────────────────── */

.qg-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.qg-overlay.visible {
  display: flex;
}

.qg-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.qg-card {
  position: relative;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 14px;
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.qg-card.animate-in {
  transform: scale(1);
  opacity: 1;
}

.qg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #21262d;
  font-weight: 600;
  font-size: 0.9em;
  color: #e2e8f0;
}

.qg-card-actions {
  display: flex;
  gap: 6px;
}

.qg-copy-btn,
.qg-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8b949e;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.qg-copy-btn:hover,
.qg-close-btn:hover {
  background: rgba(0, 212, 170, 0.1);
  color: #00d4aa;
}

.qg-card-body {
  padding: 16px;
  overflow-y: auto;
  max-height: 60vh;
  font-size: 1.05em;
}

/* Shortcuts feature removed */

/* ── Mobile Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .action-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .sidebar.has-dock {
    padding-bottom: 90px !important;
  }

  .comparison-rail {
    position: fixed;
    bottom: 76px;
    left: 0;
    right: 0;
    z-index: 9999;
    bottom: calc(76px + env(safe-area-inset-bottom, 0));
  }

  .qg-card {
    max-width: 95vw;
  }
}

/* ── Hide old button stack when dock is active ────────────────── */
.sidebar.has-dock #parcelAnalyzeBtn,
.sidebar.has-dock #saveParcelBtn,
.sidebar.has-dock #exportPdfBtn,
.sidebar.has-dock #shareReportBtn,
.sidebar.has-dock #shareClientBtn,
.sidebar.has-dock #proximityBtn,
.sidebar.has-dock #sidebarPipelineBtn {
  /* These are hidden by JS, but this is a fallback */
}
