/* Valerie desktop sidebar gallery workspace
   The gallery replaces only the conversation-history portion of the desktop
   sidebar. The main chat, composer, header, and profile remain untouched. */

.sidebar-gallery-btn{
  position:relative;
  outline:none;
}
.sidebar-gallery-btn:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:2px;
}

/* While the gallery is open, hide only the sidebar history controls. */
.sidebar.gallery-sidebar-open .sidebar-top,
.sidebar.gallery-sidebar-open .chat-list,
.sidebar.gallery-sidebar-open .sidebar-gallery-launch{
  display:none!important;
}

/* The gallery is a flex child inside the sidebar, above the profile area. */
.sidebar .sidebar-gallery-panel{
  position:static!important;
  inset:auto!important;
  width:100%!important;
  height:auto!important;
  min-width:0!important;
  min-height:0!important;
  flex:1 1 auto!important;
  z-index:auto!important;
  overflow:hidden!important;
  background:
    radial-gradient(circle at 50% 0,rgba(201,168,76,.055),transparent 34%),
    var(--bg2)!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
  animation:sidebarGalleryIn .18s ease!important;
}
@keyframes sidebarGalleryIn{
  from{opacity:0;transform:translateX(-6px)}
  to{opacity:1;transform:none}
}

.sidebar .sidebar-gallery-panel .gallery-header{
  min-height:56px!important;
  height:auto!important;
  padding:10px 10px 8px!important;
  display:flex!important;
  align-items:center!important;
  gap:8px;
  background:rgba(14,12,9,.96)!important;
  border-bottom:1px solid var(--border)!important;
  flex:0 0 auto!important;
}
.sidebar .sidebar-gallery-panel .gallery-header-title{
  min-width:0;
  flex:1;
  font-family:'Cormorant Garamond',serif!important;
  font-size:17px!important;
  font-weight:500!important;
  color:var(--gold2)!important;
  letter-spacing:.025em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.sidebar .sidebar-gallery-panel .gallery-header-actions{
  display:flex!important;
  align-items:center!important;
  gap:5px!important;
  flex:0 0 auto;
}
.sidebar .sidebar-gallery-panel .gallery-delete-toolbar{
  display:flex!important;
  align-items:center!important;
  gap:5px!important;
}
.sidebar .sidebar-gallery-panel .gallery-trash-btn,
.sidebar .sidebar-gallery-panel .gallery-close,
.sidebar .sidebar-gallery-panel .gallery-cancel-delete-btn,
.sidebar .sidebar-gallery-panel .gallery-delete-selected-btn{
  min-width:30px!important;
  height:30px!important;
  padding:0 8px!important;
  border-radius:10px!important;
  font-size:11px!important;
  line-height:1!important;
}
.sidebar .sidebar-gallery-panel .gallery-trash-btn,
.sidebar .sidebar-gallery-panel .gallery-close{
  width:30px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
}

.sidebar .sidebar-gallery-panel .gallery-tabs{
  min-height:42px!important;
  padding:0 8px!important;
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:2px!important;
  background:rgba(14,12,9,.92)!important;
  border-bottom:1px solid var(--border)!important;
  flex:0 0 auto!important;
}
.sidebar .sidebar-gallery-panel .gallery-tab{
  min-width:0;
  min-height:42px!important;
  padding:0 3px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:10px!important;
  text-align:center;
  white-space:nowrap;
}

.sidebar .sidebar-gallery-panel .gallery-grid{
  flex:1 1 auto!important;
  min-height:0!important;
  width:100%!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:10px!important;
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:8px!important;
  align-content:start!important;
  background:transparent!important;
}
.sidebar .sidebar-gallery-panel .gallery-item{
  width:100%!important;
  min-width:0!important;
  aspect-ratio:1/1!important;
  border-radius:10px!important;
  box-shadow:0 8px 22px rgba(0,0,0,.22);
}
.sidebar .sidebar-gallery-panel .gallery-item:hover{
  transform:translateY(-1px)!important;
}
.sidebar .sidebar-gallery-panel .gallery-source-badge{
  top:5px!important;
  right:5px!important;
  max-width:calc(100% - 10px);
  padding:2px 5px!important;
  font-size:8px!important;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sidebar .sidebar-gallery-panel .gallery-item-overlay{
  padding:18px 6px 6px!important;
}
.sidebar .sidebar-gallery-panel .gallery-item-label{
  font-size:9px!important;
}
.sidebar .sidebar-gallery-panel .gallery-select-box{
  top:5px!important;
  left:5px!important;
  width:22px!important;
  height:22px!important;
}
.sidebar .sidebar-gallery-panel .gallery-empty{
  grid-column:1/-1;
  padding:32px 10px;
  color:var(--text3);
  font-size:12px;
  line-height:1.5;
  text-align:center;
}

/* Absolutely no main-workspace changes while the sidebar gallery is open. */
body.gallery-workspace-open .input-area{
  display:block!important;
}
body.gallery-workspace-open .chat-area{
  pointer-events:auto!important;
}

@media(max-width:900px){
  .sidebar .sidebar-gallery-panel .gallery-grid{
    grid-template-columns:1fr!important;
  }
}
@media(prefers-reduced-motion:reduce){
  .sidebar .sidebar-gallery-panel{animation:none!important}
}
