/* =============================================================================
   collection-panel.css
   Reusable right-side Collection & Map panel
   Included on every page via master.blade.php
   ============================================================================= */

/* Panel must appear above filter header (z-index: 20) on PLP */
.page-venues .ai-panel {
  z-index: 9300;
}

/* Mobile/tablet: filter-modal-spacing-fix.css forces .listing__top-bar to
   z-index: 10001 !important. Beat it when the panel is open so the panel and
   its backdrop render on top of the filter toolbar. */
@media (max-width: 1023px) {
  .page-venues .ai-panel--open {
    z-index: 10100 !important;
  }
}

/* -----------------------------------------------------------------------------
   DESIGN TOKENS — width tokens on :root so siblings/parents can read them
   ----------------------------------------------------------------------------- */
:root {
  --cp-width:        440px;   /* panel open width (desktop) */
  --cp-width-tablet: 360px;   /* panel open width (tablet) */
}

.ai-panel {
  --cp-bg:            #1a1a1a;   /* panel surface */
  --cp-bg-raised:     #262626;   /* cards, tabs container */
  --cp-bg-dark:       #111111;   /* darkest bg (brand btn text) */
  --cp-border:        #262626;   /* panel edge border */
  --cp-border-inner:  #383838;   /* inner borders, separators */
  --cp-border-subtle: #1e1e1e;   /* card bottom divider */
  --cp-text-primary:  #e8e8e8;   /* active/primary text */
  --cp-text-muted:    #757575;   /* secondary text, tab labels */
  --cp-text-dim:      #4f4f4f;   /* disabled, separators */
  --cp-text-white:    #fafafa;   /* card title */
  --cp-text-empty:    #a8a8a8;   /* empty state title */
  --cp-text-empty-sub:#595959;   /* empty state subtitle */
  --cp-brand:         #c8d200;   /* brand accent */
  --cp-brand-hover:   #d4df00;   /* brand hover */
  --cp-brand-light:   #eef291;   /* badge label */
  --cp-font:          'Neue', sans-serif;
  --cp-radius:        8px;       /* standard border radius */
  --cp-radius-inner:  6px;       /* inner tab / card border radius */
  --cp-transition:    0.15s;     /* micro-interaction duration */
}

/* -----------------------------------------------------------------------------
   PAGE LAYOUT WRAPPER (flex row: main content + panel)
   ----------------------------------------------------------------------------- */
#page-layout {
  display: flex;
  align-items: stretch;
}

#page-layout > #page_container {
  flex: 1;
  min-width: 0;
}

/* -----------------------------------------------------------------------------
   PANEL SHELL — in-flow flex child, pushes content when open
   ----------------------------------------------------------------------------- */
.ai-panel {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--cp-bg);
  box-shadow: 0 1px 2px 0 rgba(10, 13, 18, 0.05);
  border-left: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  will-change: width;
}

.ai-panel--open {
  width: var(--cp-width);
  border-left: 1px solid var(--cp-border);
}

.ai-panel__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding: 20px 24px 16px 24px;  /* 16px bottom = permanent scroll gap */
  flex-shrink: 0;
}

/* Tabs container */
.ai-panel__tabs {
  width: 344px;
  background: var(--cp-bg-raised);
  border: 1px solid var(--cp-border-inner);
  border-radius: var(--cp-radius);
  display: flex;
  overflow: hidden;
  flex-shrink: 0;
}

.ai-panel__tab-btn {
  position: relative;
  cursor: pointer;
  display: flex;
  flex: 1;
}


.ai-panel__tab-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ai-panel__tab-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  width: 100%;
  padding: 0 12px;
  border-radius: var(--cp-radius-inner);
  font-family: var(--cp-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--cp-text-muted);
  background: transparent;
  cursor: pointer;
  transition: background var(--cp-transition), color var(--cp-transition), box-shadow var(--cp-transition);
  white-space: nowrap;
  user-select: none;
}

.ai-panel__tab-radio:checked + .ai-panel__tab-inner {
  background: var(--cp-border-inner);
  color: var(--cp-text-primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--cp-text-dim);
}

.ai-panel__tab-radio:focus-visible + .ai-panel__tab-inner {
  outline: 2px solid var(--cp-brand);
  outline-offset: -2px;
}

.ai-panel__tab-radio:disabled + .ai-panel__tab-inner {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.ai-panel__tab-btn:has(.ai-panel__tab-radio:disabled) {
  cursor: not-allowed;
  pointer-events: none;
}

.ai-panel__tab-badge {
  background: var(--cp-border-inner);
  border: 0.5px solid var(--cp-text-dim);
  border-radius: 16px;
  padding: 2px 10px;
  font-family: var(--cp-font);
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  color: var(--cp-brand-light);
  text-align: center;
  white-space: nowrap;
  display: none;
}

.ai-panel__tab-badge--visible {
  display: inline-flex;
}

.ai-panel__collapse-btn {
  width: 24px;
  height: 24px;
  overflow: hidden;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity var(--cp-transition);
}

.ai-panel__collapse-btn:hover {
  opacity: 1;
}

.ai-panel__collapse-btn img {
  width: 24px;
  height: 24px;
}

.collection-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1a1a1a;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  max-width: calc(100vw - 48px);
  white-space: normal;
  text-align: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.collection-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.collection-toast--error {
  background: #b91c1c;
}

.ai-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 16px;  /* 20px top + 16px from header = 36px initial gap */
}

.ai-panel__map-content {
  display: none;
  height: 100%;
  position: relative;   /* popup-layer anchor */
  overflow: hidden;
  margin-top: 10px;
  margin-bottom: 8px;
}

.ai-panel__map-content--visible {
  display: block;
}

/* Map canvas fills the container */
#cp-map-canvas {
  width: 100%;
  height: 100%;
  overflow: visible !important;   /* never clip Leaflet's marker pane */
}

/* ── Loading spinner ────────────────────────────────────── */
.cp-map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 7px;
}

.cp-map-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cp-brand);
  animation: cp-dot-bounce 1.2s ease-in-out infinite;
}

.cp-map-loading span:nth-child(2) { animation-delay: 0.2s; }
.cp-map-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cp-dot-bounce {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
  40%           { transform: scale(1);    opacity: 1;    }
}

/* ── Map marker wrapper ───────────────────────────────────── */
.cp-marker-wrap {
  cursor: pointer;
  user-select: none;
  pointer-events: all;
  /* Remove Leaflet's default white background on the divIcon wrapper */
  background: none !important;
  border: none !important;
}

.cp-marker-wrap svg {
  display: block;
  overflow: visible;
  transition: transform 0.15s ease;
}

.cp-marker-wrap:hover svg,
.cp-marker-wrap--active svg {
  transform: scale(1.2);
}

.cp-marker-wrap--out {
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* ── Popup card ─────────────────────────────────────────── */
.cp-popup {
  position: absolute;
  width: 270px;
  background: #262626;
  border: 1px solid #4f4f4f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.75);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.cp-popup--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.cp-popup__img-wrap {
  position: relative;
  height: 175px;
  overflow: hidden;
  background: #1c1c1c;
  flex-shrink: 0;
}

.cp-popup__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cp-popup__img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.cp-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cp-popup__body {
  padding: 10px 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cp-popup__name-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cp-popup__name {
  font-family: var(--cp-font);
  font-size: 15px;
  font-weight: 500;
  color: #ffffff;
  flex: 0 1 auto;               /* don't grow — badge stays right next to text */
  min-width: 0;
  max-width: calc(100% - 21px); /* 16px badge + 5px gap — prevents overflow */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cp-popup__badge-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cp-popup__tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-popup__type {
  background: var(--cp-border-inner);
  color: #a8a8a8;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--cp-font);
  font-size: 10px;
  line-height: 16px;
}


.cp-popup__location {
  color: var(--cp-text-muted);
  font-size: 11px;
  font-family: var(--cp-font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-popup__capacity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-popup__cap-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--cp-font);
  font-size: 11px;
  color: #a0a0a0;
  white-space: nowrap;
}

.cp-popup__cap-item img {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.cp-popup__link {
  display: inline-block;
  font-family: var(--cp-font);
  font-size: 11px;
  font-weight: 500;
  color: #f2f2f2 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-top: 2px;
}

.cp-popup__link:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ── Hide Google Maps attribution injected by GoogleMutant ──
   TWO LAYERS of protection:

   Layer 1 — scoped CSS inside our containers.              */
#cp-map-canvas .gmnoprint,
#cp-map-canvas .gm-style-cc,
#cp-map-canvas a[href*="google.com/maps"],
#cp-map-canvas .gm-bundled-control,
#cp-map-canvas .gm-svpc,
#ai-panel-map .gmnoprint,
#ai-panel-map .gm-style-cc,
#ai-panel-map a[href*="google.com/maps"],
#ai-panel-map .gm-bundled-control,
#ai-panel-map .gm-svpc {
  display: none !important;
}

/* Layer 2 — global CSS, activated by JS at map init time.
   GoogleMutant appends a hidden Google Maps div directly to
   document.body (outside our containers). The white .gm-style-cc
   box lives there and is unreachable by scoped rules above.
   JS adds data-cp-map to <body> at init, enabling these rules.  */
body[data-cp-map] .gmnoprint,
body[data-cp-map] .gm-style-cc,
body[data-cp-map] a[href*="google.com/maps"],
body[data-cp-map] .gm-bundled-control,
body[data-cp-map] .gm-svpc {
  display: none !important;
}

/* ── Fix: transparent backgrounds on internal Google containers */
#cp-map-canvas .leaflet-google-mutant-container,
#cp-map-canvas .gm-style {
  background: transparent !important;
}

/* ── Fix: Leaflet control bar container background ──────────*/
#cp-map-canvas .leaflet-bar {
  background: transparent !important;
  overflow: hidden;
}

/* ── Leaflet popup chrome override ──────────────────────────
   Strips all Leaflet defaults — our .cp-popup__inner is the card */
.cp-popup-wrap .leaflet-popup-content-wrapper {
  background: #262626;
  border: 1px solid #4f4f4f !important;
  border-radius: 12px;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.75);
  padding: 0;
  overflow: hidden;
}

.cp-popup-wrap .leaflet-popup-content {
  margin: 0;
  width: 270px !important;
  line-height: normal;
}

.cp-popup-wrap .leaflet-popup-tip-container {
  display: none;
}

/* ── Hide Leaflet attribution control ───────────────────────
   GoogleMutant adds a Leaflet attribution control for Google Maps
   copyright even when attributionControl:false is set on the map.
   This renders as a white rounded box in the bottom-right corner.
   We hide it entirely — this is the root cause of the white square. */
#cp-map-canvas .leaflet-control-attribution,
.ai-panel__map-content .leaflet-control-attribution {
  display: none !important;
}

/* ── Zoom controls — dark themed ───────────────────────────── */
#cp-map-canvas .leaflet-control-zoom,
.ai-panel__map-content .leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5) !important;
}

#cp-map-canvas .leaflet-control-zoom a,
.ai-panel__map-content .leaflet-control-zoom a {
  background: #262626 !important;
  border: 1px solid #383838 !important;
  color: #a0a0a0 !important;
  width: 28px !important;
  height: 28px !important;
  line-height: 26px !important;
  font-size: 16px !important;
}

#cp-map-canvas .leaflet-control-zoom a:hover,
.ai-panel__map-content .leaflet-control-zoom a:hover {
  background: #323232 !important;
  color: #fafafa !important;
}

.ai-panel__empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  gap: 12px;
  text-align: center;
}

.ai-panel__empty-icon {
  width: 64px;
  height: 64px;
  opacity: 0.4;
}

.ai-panel__empty-title {
  font-family: var(--cp-font);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: var(--cp-text-empty);
  text-align: center;
  margin: 0;
}

.ai-panel__empty-subtitle {
  font-family: var(--cp-font);
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: var(--cp-text-empty-sub);
  text-align: center;
  margin: 0;
  max-width: 260px;
}

/* -----------------------------------------------------------------------------
   ACTION BUTTONS
   ----------------------------------------------------------------------------- */
.ai-panel__actions {
  padding: 16px 24px 24px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
}

.ai-panel__action-btn {
  border-radius: var(--cp-radius);
  padding: 10px 14px;
  border: 1px solid var(--cp-border-inner);
  background: transparent;
  color: var(--cp-text-dim);
  font-family: var(--cp-font);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.ai-panel__action-btn:disabled {
  opacity: 1;
  color: var(--cp-text-dim);
}

.ai-panel__action-btn:not(:disabled) {
  color: var(--cp-brand);
  border-color: var(--cp-brand);
}

.ai-panel__action-btn:not(:disabled):hover {
  background: var(--cp-brand);
  border-color: var(--cp-brand);
  color: var(--cp-bg);
}

.ai-panel__action-btn:hover {
  background: var(--cp-bg-raised);
  border-color: var(--cp-text-dim);
  color: var(--cp-text-primary);
}

/* Has-venues state: rearranges 4 buttons → 3-button layout */
.ai-panel__actions--has-venues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "primary  primary"
    "proposal compare";
  gap: 8px;
  padding: 12px 24px 16px;
}

.ai-panel__actions--has-venues #btn-multi-inquire {
  grid-area: primary;
  background: var(--cp-brand);
  border-color: var(--cp-brand);
  color: var(--cp-bg);
  cursor: pointer;
  font-size: 15px;
}

.ai-panel__actions--has-venues #btn-multi-inquire:hover {
  background: var(--cp-brand-hover);
  border-color: var(--cp-brand-hover);
}

.ai-panel__actions--has-venues #btn-proposal {
  grid-area: proposal;
  font-size: 13px;
  padding: 10px 8px;
  border-color: #4e5200;
}

.ai-panel__actions--has-venues #btn-compare {
  grid-area: compare;
  font-size: 13px;
  padding: 10px 8px;
  border-color: #4e5200;
}

.ai-panel__actions--has-venues #btn-ai-preview {
  display: none;
}

/* -----------------------------------------------------------------------------
   VENUE CARDS
   ----------------------------------------------------------------------------- */
.collection-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  background: var(--cp-bg-raised);
  border-radius: var(--cp-radius);
  border-bottom: 1px solid var(--cp-border-subtle);
  margin-bottom: 10px;
}

.collection-card__thumb {
  width: 116px;
  height: 72px;
  min-width: 116px;
  border-radius: 6px;
  background: var(--cp-bg-raised) center/cover no-repeat;
  overflow: hidden;
}

@media (max-width: 767px) {
  .collection-card__thumb {
    width: 90px;
    min-width: 90px;
  }
}

.collection-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.collection-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.collection-card__name-group {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.collection-card__name {
  font-family: var(--cp-font);
  font-size: 12px;
  font-weight: 600;
  color: var(--cp-text-white);
  flex: 0 0 auto;          /* takes natural text width only, never grows */
  max-width: calc(100% - 40px); /* truncate before badge crowds remove btn */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.collection-card__badge {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.collection-card__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--cp-transition);
}

.collection-card__remove:hover {
  opacity: 0.7;
}

.collection-card__meta {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.collection-card__meta-type {
  display: inline-block;
  background: var(--cp-border-inner);
  color: #a8a8a8;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 16px;
  margin-right: 6px;
}

.collection-card__meta-loc {
  color: var(--cp-text-muted);
}

.collection-card__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.collection-card__count {
  font-size: 14px;
  font-weight: 500;
  color: #a8a8a8;
}

.collection-card__sep {
  color: var(--cp-border-inner);
  font-size: 11px;
}

.collection-card__show {
  font-size: 14px;
  font-weight: 600;
  color: var(--cp-brand);
  background: var(--cp-text-dim);
  text-decoration: none;
  border-radius: 6px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.collection-card__show:hover {
  color: var(--cp-brand-hover);
  text-decoration: none;
}

/* -----------------------------------------------------------------------------
   EMPTY SLOTS
   ----------------------------------------------------------------------------- */
.ai-slot--empty {
  height: 50px;
  border: none;
  border-radius: 6px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e%3crect width='100%25' height='100%25' fill='none' rx='6' stroke='%23757575' stroke-width='1' stroke-dasharray='7 7' stroke-linecap='round'/%3e%3c/svg%3e");
}

.collection-card + .ai-slot--empty {
  margin-top: 24px;
}

/* -----------------------------------------------------------------------------
   RESPONSIVE
   ----------------------------------------------------------------------------- */

/* Desktop: sticky panel — stays in viewport regardless of page length.
   Problem: mobile-overflow-fix.css sets overflow-x:hidden on html+body globally,
   which creates a new scroll container and silently breaks position:sticky.
   Fix: override to overflow-x:clip on desktop. Unlike 'hidden', 'clip' prevents
   overflow display WITHOUT creating a scroll container, so sticky works correctly. */
@media (min-width: 1024px) {
  html, body {
    overflow-x: clip;
  }

  .ai-panel {
    position: sticky;
    top: var(--navigation-height, 80px);
    height: calc(100dvh - var(--navigation-height, 80px));
    align-self: flex-start;
    transform: translateZ(0);
    will-change: width;
  }

  /* 3 columns — applied by JS via .cp-panel-open AFTER the open animation
     completes (transitionend), not during it. This decouples the grid reflow
     from the width animation so both don't hit the browser on the same frame. */
  #page-layout.cp-panel-open .listing__content-cards,
  #page-layout.cp-panel-open .listing__content-static-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  /* Suppress intrinsic min-width on grid items so tracks can shrink freely */
  .listing__card-item {
    min-width: 0;
  }

  /* PLP PERFORMANCE — content-visibility skips layout/paint for off-screen cards,
     slashing the cost of every reflow triggered by panel animation.
     Off-screen cards (typically 8-9 of 12) are treated as opaque 380px boxes
     so grid track sizing is near-free for those slots. */
  .page-venues .listing__card-item {
    content-visibility: auto;
    contain-intrinsic-size: auto 380px;
  }
}

/* Tablet: fixed right-side overlay — doesn't push content */
@media (min-width: 768px) and (max-width: 1023px) {
  .ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--cp-width-tablet) !important;
    height: 100dvh;
    border-left: 1px solid var(--cp-border);
    z-index: 9200;
    transform: translateX(100%);
    transition: transform 0.3s ease !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .ai-panel--open {
    width: var(--cp-width-tablet) !important;
    transform: translateX(0) !important;
  }

  /* Tabs: flex: 1 so they share space with the collapse btn instead of
     forcing a fixed 344px that overflows the 360px panel */
  .ai-panel__tabs {
    flex: 1;
    width: auto;
  }

  /* Tighten header padding to fit everything in 360px */
  .ai-panel__header {
    padding: 16px 16px 0;
    gap: 12px;
  }

  /* Swap layout-right icon → X close icon on tablet */
  .ai-panel__collapse-btn img {
    display: none;
  }

  .ai-panel__collapse-btn {
    opacity: 0.6;
    width: 28px;
    height: 28px;
  }

  .ai-panel__collapse-btn::after {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M13.5 4.5L4.5 13.5M4.5 4.5l9 9' stroke='%23a8a8a8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
  }
}

/* Mobile-only topbar — hidden on desktop */
.ai-panel__mobile-topbar {
  display: none;
}

/* Mobile: full-screen overlay sliding up from bottom */
@media (max-width: 767px) {
  /* Panel shell — full-screen, off-screen by default, slides up when open */
  .ai-panel {
    position: fixed;
    inset: 0;
    width: 100% !important;
    height: 100dvh !important;
    border-radius: 0;
    border-left: none !important;
    border-top: none;
    z-index: 9200;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    box-shadow: 0 1px 2px 0 rgba(10, 13, 18, 0.05);
  }

  .ai-panel--open {
    width: 100% !important;
    border-top: none;
    transform: translateY(0);
  }

  /* Mobile-only topbar */
  .ai-panel__mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    flex-shrink: 0;
  }

  .ai-panel__mobile-title {
    font-family: var(--cp-font);
    font-size: 18px;
    font-weight: 600;
    color: var(--cp-text-empty);
  }

  .ai-panel__mobile-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cp-text-white);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  /* Header: hide desktop collapse button, full-width tabs */
  .ai-panel__header {
    padding: 12px 16px 0;
  }

  .ai-panel__collapse-btn {
    display: none;
  }

  .ai-panel__tabs {
    width: 100%;
  }


  /* Scrollable content area */
  .ai-panel__content,
  .ai-panel__map-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Actions stick to bottom */
  .ai-panel__actions,
  .ai-panel__actions--has-venues {
    flex-shrink: 0;
    padding: 10px 12px 12px;
  }
}

/* =============================================================================
   MOBILE COLLECTION BAR
   Floating card above the chat input bar on the AI-Wise page (mobile only).
   Shown via JS when ≥1 property is in the collection.
   ============================================================================= */
.ai-mob-collection-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 357px;
  height: 66px;
  background: #ffffff;
  border-radius: 14px;
  padding: 0 20px;
  margin: 0 auto 8px;
  box-sizing: border-box;
  cursor: default;
}

/* Thumbnail — stack container */
.ai-mob-collection-bar__thumb {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Back image — rotated to give stack depth (shown only when count > 1) */
.ai-mob-collection-bar__thumb-back {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: #d0d0d0 center / cover no-repeat;
  transform: rotate(12deg);
  transform-origin: center bottom;
  opacity: 0.55;
}

/* Front image — sits flat on top */
.ai-mob-collection-bar__thumb-front {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: #e0e0e0 center / cover no-repeat;
}

/* Text block */
.ai-mob-collection-bar__info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 4px;
}

.ai-mob-collection-bar__title {
  font-size: 14px;
  font-weight: 400;
  color: #4f4f4f;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-mob-collection-bar__count {
  font-size: 14px;
  font-weight: 600;
  color: #262626;
  line-height: 1.3;
}

/* Show button */
.ai-mob-collection-bar__show {
  flex-shrink: 0;
  width: 80px;
  height: 40px;
  background: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.ai-mob-collection-bar__show:hover {
  background: #000000;
}

/* Hide on tablet/desktop — only relevant on mobile */
@media (min-width: 768px) {
  .ai-mob-collection-bar {
    display: none !important;
  }
}
