/* =========================================================
   05-components.sidebar.css (Production)
   Sidebar + overlay + hamburger
   Keeps existing IDs/classes intact (#mySidenav, .sidenav, .menu-hamburguer, .barra)
========================================================= */

/* ---------- Base sidebar (mobile/tablet = off-canvas) ---------- */
.sidenav{
  position: fixed;
  top: 0;
  left: 0;
  height: calc(var(--vh, 1vh) * 100);
  width: min(var(--sidebar-width, 320px), 92vw);

  transform: translateX(-105%);
  transition: transform 220ms ease;

  z-index: 2000; /* above overlay */
  padding: var(--space-4, 16px);

  overflow: auto;
  overscroll-behavior: contain;

  /* A11y + iOS polish */
  -webkit-overflow-scrolling: touch;
  contain: layout paint;
  display: flex;
  flex-direction: column;
}

.sidenav.open{
  transform: translateX(0);
}

/* ---------- Desktop: pinned sidebar (always visible) ---------- */
@media (min-width: 1250px){
  .sidenav{
    position: sticky;
    top: 0;
    transform: none;
    width: var(--sidebar-width, 320px);
    height: calc(var(--vh, 1vh) * 100);
    z-index: 10;
  }
}

/* ---------- Overlay (click outside to close) ---------- */
#nav-overlay{
  position: fixed;
  inset: 0;

  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;

  z-index: 1990; /* below sidebar (2000), above page */
}

#nav-overlay.open{
  opacity: 1;
  pointer-events: auto;
}

/* On desktop, no overlay needed */
@media (min-width: 1250px){
  #nav-overlay{ display: none; }
}

/* Prevent background scroll when nav open (mobile/tablet) */
body.is-nav-open{
  overflow: hidden;
}

/* ---------- Sidebar items (keeps your design tokens) ---------- */
.glass-item{
  border-radius: var(--radius-md, 16px);
  padding: var(--space-3, 12px);
  border: 1px solid var(--border, rgba(15,23,42,.12));
  background: var(--surface, rgba(255,255,255,.85));
  box-shadow: var(--shadow-xs, 0 8px 18px rgba(15,23,42,.10));
  margin-bottom: var(--space-3, 12px);
}

/* Brand row */
.nav-brand{ padding: var(--space-3, 12px); }

.nav-logo-wrap{
  width: 66px;
  height: 66px;
  border-radius: 14px;
  border: 1px dashed var(--border, rgba(15,23,42,.18));
  background: var(--surface-2, rgba(255,255,255,.65));
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.nav-logo-wrap img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.nav-logo-placeholder{
  font-size: 10px;
  color: var(--muted, rgba(15,23,42,.6));
  text-align: center;
  padding: 6px;
  line-height: 1.2;
}

.nav-logo-wrap:not(.is-placeholder) .nav-logo-placeholder{ display: none; }
.nav-logo-wrap.is-placeholder img{ display: none; }

/* Sidebar emblem */
.sidebar-emblem{
  margin-top: auto;
  padding-top: var(--space-4, 16px);
  opacity: 0.95;
  display: flex;
  justify-content: center;
}

.sidebar-emblem img{
  max-width: 40%;
  border-radius: var(--radius-md, 16px);
  /* border: 1px solid var(--border, rgba(15,23,42,.12)); */
}

/* ---------- Hamburger button ---------- */
.menu-hamburguer{
  appearance: none;
  border: 1px solid var(--color-border-subtle, rgba(15,23,42,.12));
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-subtle, 0 10px 26px rgba(15,23,42,.12));
  border-radius: 999px;

  width: 44px;
  height: 44px;

  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;

  cursor: pointer;

  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 3000; /* above sidebar + overlay */

  -webkit-tap-highlight-color: transparent;
}

.menu-hamburguer:focus-visible{
  outline: 2px solid var(--color-accent-blue, #5ecbff);
  outline-offset: 2px;
}

.menu-hamburguer .barra{
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-text-main, #0f172a);
  transition: transform 200ms ease, opacity 200ms ease;
  transform-origin: center;
}

/* X animation when open */
.menu-hamburguer.is-active .barra:nth-child(1){
  transform: translateY(8px) rotate(45deg);
}
.menu-hamburguer.is-active .barra:nth-child(2){
  opacity: 0;
}
.menu-hamburguer.is-active .barra:nth-child(3){
  transform: translateY(-8px) rotate(-45deg);
}

/* On desktop you can hide the hamburger because sidebar is pinned */
@media (min-width: 1250px){
  .menu-hamburguer{ display: none; }
}

/* Sidebar should NOT scroll unless a dropdown panel is open */
.sidenav{
  overflow: hidden; /* default: no scroll */
}

/* Turn scrolling on only when JS adds this class */
.sidenav.is-scrollable{
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4, 16px); /* so bottom content isn't clipped */
}

/* Force sidebar to NOT scroll unless JS enables it */
#mySidenav{
  overflow: hidden !important;
}

/* Only scroll when JS adds the class */
#mySidenav.is-scrollable{
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* Center the logo/placeholder block inside the brand row */
#mySidenav .saas-brand-row .topbar-logo{
  display: flex;
  justify-content: center;
  width: 100%;
}

/* (Optional, but safe) ensure the placeholder text is centered */
#mySidenav .nav-logo-placeholder{
  text-align: center;
}

/* ONLY the logo/brand card: no shadow, no border, transparent */
#mySidenav .glass-item.nav-brand{
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;          /* optional: remove inner padding */
  margin-bottom: var(--space-3, 12px); /* keep spacing consistent */
}

/* //////////////////////////////// */
/* ===== Upload PDF: selectable file list (matches palette) ===== */
.saas-file-input{
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  position: relative;
}

/* Hide native input but keep it functional via label */
.saas-file-input input[type="file"]{
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Button-like label */
.saas-file-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;

  border-radius: var(--radius-pill);
  border: 1px solid rgba(162, 117, 255, 0.25);
  background: rgba(94, 203, 255, 0.12);
  color: var(--color-text-main);

  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

.saas-file-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(162, 117, 255, 0.22);
  border-color: rgba(94, 203, 255, 0.35);
}

.saas-file-btn:active{
  transform: translateY(0);
  box-shadow: var(--shadow-subtle);
}

.saas-file-btn:focus-visible{
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}

.saas-file-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saas-file-hint{
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.saas-file-clear{
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.04);
  color: var(--color-text-soft);
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.saas-file-clear:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.saas-file-list{
  display: grid;
  gap: 8px;
}

.saas-file-chip{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--shadow-subtle);
}

.saas-file-name{
  font-size: var(--text-sm);
  color: var(--color-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saas-file-meta{
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: 10px;
}

/* .saas-file-remove{
  border: 1px solid rgba(162, 117, 255, 0.25);
  background: rgba(162, 117, 255, 0.10);
  color: var(--color-text-main);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
} */

.saas-file-remove:focus-visible{
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}

/* Allow ellipsis inside flex chips */
.saas-file-chip{ align-items: center; }
.saas-file-left{ min-width: 0; }

/* Limit list height so it doesn't push sidebar buttons */
.saas-file-list{
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Clear button below list full-width */
.saas-file-clear-below{
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.saas-file-remove{
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;

  border: 1px solid rgba(162, 117, 255, 0.25);
  background: rgba(162, 117, 255, 0.10);
  color: var(--color-text-main);

  border-radius: 999px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;

  cursor: pointer;
}

/* //////////////////////////// */

/* ===== Chats dropdown rows (generated by run()) ===== */
#mySidenav #dropdown-content1 .div27 .a12{
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 72px;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: var(--shadow-xs);
  cursor: pointer;

  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

#mySidenav #dropdown-content1 .div27 .a12:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(94, 203, 255, 0.35);
}

#mySidenav #dropdown-content1 .div27 .a12:focus-visible{
  outline: none;
  box-shadow: var(--shadow-sm), var(--ring);
}

/* Selected thread highlight */
#mySidenav #dropdown-content1 .div27 .a12.selected{
  border-color: rgba(162, 117, 255, 0.35);
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,0.92);
}

/* Left icon column */
#mySidenav #dropdown-content1 .conversation-icons{
  display: grid;
  gap: 6px;
  justify-items: center;
}

/* LIVE badge (uses your existing .is-live class) */
#mySidenav #dropdown-content1 .live-indicator{
  display: none;
}
#mySidenav #dropdown-content1 .live-indicator.is-live{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #0f172a;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent-blue));
  border: 1px solid rgba(15,23,42,.10);
}

/* Chat icon sizing */
#mySidenav #dropdown-content1 .chat-icon{
  width: 18px;
  height: 18px;
  opacity: .9;
}

/* Middle info column (avoid layout shifting / long titles) */
#mySidenav #dropdown-content1 .a12 .user-info{
  min-width: 0; /* required for ellipsis in grid/flex */
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#mySidenav #dropdown-content1 .a12 .user-name{
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  /* overflow: hidden;
  text-overflow: ellipsis; */
  overflow-x: auto;
  text-overflow: clip;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;

}

#mySidenav #dropdown-content1 .a12 .user-email{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right actions column */
#mySidenav #dropdown-content1 .conversation-actions{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

#mySidenav #dropdown-content1 .conversation-actions img{
  width: 32px;                /* bigger tap target */
  height: 32px;
  padding: 7px;               /* icon has room inside */
  object-fit: contain;        /* SVG stays crisp */
  display: block;
}

#mySidenav #dropdown-content1 .conversation-actions img:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
  background: rgba(94,203,255,.10);
}

#mySidenav #dropdown-content1 .conversation-actions img:active{
  transform: translateY(0);
}

#mySidenav #dropdown-content1 .a12.is-live-thread{ border-left: 4px solid var(--accent-blue); }

#mySidenav #dropdown-content1 .a12 .user-info{ min-width: 0; }
#mySidenav #dropdown-content1 .a12 .user-name{ min-width: 0; }

/* #mySidenav #dropdown-content1 .a12 .user-name{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
} */
/* #mySidenav #dropdown-content1 .a12 .user-name::-webkit-scrollbar{ display:none; } */

#mySidenav #dropdown-content1 .a12 .user-name::-webkit-scrollbar{ display:none; }
