/* Retail 360 workspace layout */

.retail-workspace {
  display: grid;
  grid-template-columns: 200px 1fr 360px;
  gap: 1rem;
  min-height: 75vh;
  align-items: start;
}
.retail-workspace.with-filters {
  grid-template-columns: 200px 300px 1fr 360px;
}

.retail-sidebar { overflow-y: auto; max-height: 75vh; position: sticky; top: 0.5rem; }

/* Filter panel */
.retail-filters {
  overflow-y: auto;
  max-height: 75vh;
  position: sticky;
  top: 0.5rem;
  padding: 0.85rem 1rem !important;
}
.filters-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.filters-head h3 { margin: 0; font-size: 1rem; }
.filter-count {
  font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 999px;
  background: rgba(42,171,238,0.15); color: #38bdf8;
}

.filter-group {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  margin-bottom: 0.55rem;
  background: rgba(0,0,0,0.2);
  overflow: hidden;
}
.filter-group summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
  padding: 0.55rem 0.65rem;
  list-style: none;
  user-select: none;
}
.filter-group summary::-webkit-details-marker { display: none; }
.filter-group[open] summary {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.filter-group-body {
  padding: 0.55rem 0.65rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  width: 100%;
}
.filter-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.02em;
}
.filter-field select,
.filter-field input[type="text"],
.filter-field input[type="number"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: #0a0f18;
  color: #f1f5f9;
  font-size: 0.85rem;
  margin: 0;
}
.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: rgba(42,171,238,0.5);
  box-shadow: 0 0 0 2px rgba(42,171,238,0.15);
}
.filter-field.filter-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.filter-field.filter-check input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0; margin: 0;
  accent-color: #2aabee;
}
.filter-field.filter-check span {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.filter-actions { margin: 0.65rem 0; display: flex; flex-direction: column; gap: 0.35rem; }
.filter-sync { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.06); }
.filter-sync h4 { margin: 0 0 0.5rem; font-size: 0.85rem; color: #94a3b8; }

.retail-map-wrap { position: relative; min-height: 500px; }
.retail-map { height: 75vh; min-height: 500px; border-radius: 8px; border: 1px solid #334155; }
.map-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3); border-radius: 8px; pointer-events: none;
}

.retail-panel { overflow-y: auto; max-height: 75vh; position: sticky; top: 0.5rem; }
.retail-panel .detail-section { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #334155; }
.retail-panel .detail-dl {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 0.5rem; font-size: 0.85rem;
}
.retail-panel .detail-dl dt { opacity: 0.7; }
.retail-panel .detail-dl dd { margin: 0; font-weight: 600; text-align: right; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { opacity: 0.85; }

.retail-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }

.kpi-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.kpi-card {
  flex: 1; min-width: 110px; padding: 0.75rem 1rem;
  background: var(--panel-bg, #1e293b); border-radius: 8px; border: 1px solid #334155;
}
.kpi-card span { display: block; font-size: 0.75rem; opacity: 0.7; }
.kpi-card strong { font-size: 1.25rem; }
.kpi-green strong { color: #22c55e; }

.retail-main { min-height: 500px; min-width: 0; }
.retail-table-wrap { max-height: 75vh; overflow: auto; }
.retail-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.retail-table th, .retail-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #334155; text-align: left; }
.retail-table th { position: sticky; top: 0; background: var(--panel-bg, #1e293b); z-index: 1; }

.trends-ticker { margin-bottom: 1rem; padding: 0.75rem 1rem; overflow-x: auto; }
.ticker-items { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.ticker-item {
  background: rgba(42,171,238,0.1); padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.8rem; white-space: nowrap; border: 1px solid rgba(42,171,238,0.2);
}

.field-picker { margin-top: 1rem; font-size: 0.8rem; }
.field-group { margin: 0.5rem 0; }
.btn-block { width: 100%; margin-top: 0; }
.muted { opacity: 0.75; font-size: 0.9rem; }
.hint { font-size: 0.8rem; opacity: 0.7; }

.wholesale-list { max-height: 75vh; overflow-y: auto; }
.wholesale-item {
  padding: 0.6rem; border-bottom: 1px solid #1e293b; cursor: pointer; font-size: 0.85rem;
}
.wholesale-item:hover { background: rgba(42,171,238,0.06); }
.wholesale-item.active { border-left: 3px solid var(--pulse-blue, #2aabee); }

@media (max-width: 1400px) {
  .retail-workspace.with-filters { grid-template-columns: 180px 280px 1fr; }
  .retail-panel { grid-column: 1 / -1; max-height: 45vh; position: static; }
}
@media (max-width: 900px) {
  .retail-workspace,
  .retail-workspace.with-filters { grid-template-columns: 1fr; }
  .retail-sidebar, .retail-filters, .retail-panel { position: static; max-height: none; }
}
