/* =============================================
   ArtFlea — Wall Visualizer Styles
   v7 — Mobile-first, immersive full-screen
   ============================================= */

/* ---- Base Container ---- */
#visualizer-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  margin-top: 70px;
  background: var(--dark);
  overflow: hidden;
  position: relative;
}

@media (min-width: 900px) {
  #visualizer-container {
    flex-direction: row;
  }
}

/* ============================================================
   MOBILE — Full-screen wall canvas, bottom sheet controls
   ============================================================ */

/* Wall area FIRST, fills screen */
#wall-area {
  flex: 1;
  position: relative;
  background: #111;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 1;
}

@media (max-width: 899px) {
  #wall-area {
    /* Fill full height minus the collapsed control strip */
    height: calc(100vh - 70px - 64px);
    min-height: 0;
  }
}

/* ---- Sidebar / Control Panel ---- */
#visualizer-sidebar {
  flex: 0 0 320px;
  background: var(--dark-2);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  order: 2;
}

@media (max-width: 899px) {
  #visualizer-sidebar {
    /* Bottom sheet: collapsed strip by default, expandable */
    flex: none;
    order: 2;
    height: 64px;           /* Collapsed state: just the handle */
    overflow: hidden;
    border-right: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--dark-2);
    padding: 0;
    transition: height 0.35s cubic-bezier(0.4,0,0.2,1);
    position: relative;
  }
  #visualizer-sidebar.expanded {
    height: 70vh;
    overflow-y: auto;
  }

  /* Mobile handle strip (always visible) */
  #sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    height: 64px;
    cursor: pointer;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--dark-2);
    z-index: 5;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  #sidebar-handle-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  #sidebar-handle-title .chip {
    background: var(--yellow);
    color: var(--dark);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: 0.03em;
  }
  #sidebar-handle-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: transform 0.3s;
  }
  #visualizer-sidebar.expanded #sidebar-handle-arrow {
    transform: rotate(180deg);
  }
  #sidebar-inner {
    padding: 16px 18px 24px;
  }
}

@media (min-width: 900px) {
  #sidebar-handle { display: none; }
  #sidebar-inner { padding: 0; }
}

.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: var(--text-main);
}

@media (max-width: 899px) {
  .sidebar-title { display: none; }
}

.control-group {
  margin-bottom: 20px;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: block;
}

/* Wall Options */
.wall-options {
  display: flex;
  gap: 10px;
}
.wall-btn {
  flex: 1;
  padding: 9px 6px;
  text-align: center;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  transition: var(--transition);
  color: var(--text-main);
}
.wall-btn.active {
  background: rgba(245, 197, 24, 0.1);
  border-color: var(--yellow);
  color: var(--yellow);
}
.wall-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* Artwork Catalog */
#artwork-catalog {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 899px) {
  #artwork-catalog {
    grid-template-columns: repeat(4, 80px);
    grid-auto-flow: column;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    display: flex;
    gap: 10px;
  }
  .catalog-item {
    flex: 0 0 80px;
  }
}

.catalog-item {
  background: var(--dark-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.catalog-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}
.catalog-item-info {
  padding: 6px;
  font-size: 0.7rem;
}
.catalog-item-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.catalog-item-artist {
  color: var(--text-muted);
  display: none; /* hide on small tiles */
}
.catalog-item:hover {
  border-color: rgba(255,255,255,0.2);
}
.catalog-item.active {
  border-color: var(--yellow);
}

/* Action Area */
.visualizer-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 899px) {
  .visualizer-actions {
    margin-top: 16px;
  }
}

/* ============================================================
   WALL AREA
   ============================================================ */

#zoom-wrapper {
  transition: transform 0.2s ease-out;
  transform-origin: center center;
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#wall-container {
  position: relative;
  width: 92%;
  max-width: 1200px;
  aspect-ratio: 1.5;
  background-color: #F4F1EA;
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  border-radius: 4px;
  flex-shrink: 0;
  min-height: 120px;
}

@media (max-width: 899px) {
  #wall-container {
    width: 96%;
  }
}

/* Live Camera Feed */
#live-camera-feed {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  display: none;
  border-radius: 4px;
}

/* Disclaimer — tiny and minimal */
#wall-disclaimer {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Wall Dimension label */
#wall-dimension-label {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.7);
  padding: 3px 7px;
  font-size: 0.72rem;
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
  font-family: monospace;
}

/* ---- Zoom Controls — minimal floating ---- */
.zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.zoom-controls button {
  width: 36px;
  height: 36px;
  background: rgba(13,13,13,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  transition: var(--transition);
  backdrop-filter: blur(6px);
}
.zoom-controls button:hover {
  background: var(--yellow);
  color: var(--dark);
  border-color: var(--yellow);
}
#zoom-reset { font-size: 0.68rem; }

/* Placed Artwork */
.placed-artwork {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  cursor: grab;
}
.placed-artwork.active {
  box-shadow: 0 8px 32px rgba(245,197,24,0.5);
}
.placed-artwork:active { cursor: grabbing; }
.placed-artwork img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

/* Dimension label on placed art */
.art-dimension-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.65);
  color: #fff;
  padding: 2px 6px;
  font-size: 0.68rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  font-family: monospace;
  opacity: 0;
  transition: opacity 0.2s;
}
.placed-artwork.active .art-dimension-label { opacity: 1; }

/* Added Art Panel (floating) */
#added-art-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(13,13,13,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px;
  border-radius: 10px;
  min-width: 180px;
  max-width: 220px;
  z-index: 10;
  max-height: calc(100% - 100px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
#added-art-panel h4 {
  font-size: 0.75rem;
  margin: 0 0 8px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 6px;
}
#added-art-list { list-style: none; padding: 0; margin: 0; }
.added-art-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}
.added-art-item:hover { background: rgba(255,255,255,0.1); }
.added-art-item.active {
  background: rgba(245,197,24,0.15);
  border-left: 2px solid var(--yellow);
}
.added-art-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 6px;
  color: var(--text-main);
}
.added-art-item .remove-art-btn {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.added-art-item .remove-art-btn:hover { color: #ef4444; }

/* Range Slider */
input[type=range] {
  width: 100%;
  margin: 8px 0;
  -webkit-appearance: none;
  background: transparent;
}
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--yellow);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -5px;
}
