/* ============================
   SIDEBAR: layout + styling
   ============================ */

/* Outer neon frame on the left */
.neon-sidebar {
  background: radial-gradient(circle at top left, #141a3a 0, #060711 55%);
  border-right: 1px solid var(--border-subtle);
  box-shadow:
    0 0 18px rgba(0, 234, 255, 0.15),
    0 0 30px rgba(255, 0, 153, 0.2);
}

/* Slide-in sidebar container */
.sidebar {
  width: 0;                 /* closed by default (desktop) */
  opacity: 0;
  pointer-events: none;
  padding: 0;
  padding-right: 2px;       /* bring scrollbar closer to divider */
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;         /* .sidebar-body scrolls inside */
  transition: width 0.22s ease-out, opacity 0.22s ease-out;
  z-index: 80;
}

.sidebar.is-open {
  width: 260px;
  opacity: 1;
  pointer-events: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Desktop – part of layout */
@media screen and (min-width: 1024px) {
  .sidebar {
    position: relative;
  }
}

/* Mobile – overlay + slide in/out */
@media screen and (max-width: 1023px) {
  .sidebar {
    position: fixed;
    z-index: 80;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar.is-hidden-touch {
    display: block;
  }
}

/* Sidebar header – sticky and aligned with main topbar */
.sidebar-header {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;   /* NEW: space between logo + close button */
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;

  background: #060711;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.7);
  position: sticky;
  top: 0;
  z-index: 15;
}


.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;              /* NEW: lets the logo grow */
}

.sidebar-close-button {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-muted);
  padding: 0.25rem 0.35rem;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.sidebar-close-button .icon {
  font-size: 1.1rem;
}

/* Hover for the close icon */
.sidebar-close-button:hover {
  color: var(--neon-blue);
}

.sidebar-header .icon {
  color: var(--neon-blue);
}

/* Scrollable body inside sidebar */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 1.5rem;
  margin-right: -1.2rem;  /* extend scroll area into the sidebar padding */
  padding-right: 0.75rem;  /* keep some breathing room for text */
}

/* Sidebar section labels & menu links */
.sidebar .menu-label {
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-top: 1.5rem;
  padding-left: 0.2rem;
}

.sidebar .menu-list {
  margin-left: 0.2rem;
}

.sidebar .menu-list a {
  background-color: transparent;
  color: var(--text-main);
  border-radius: 0.7rem;
  padding: 0.4rem 0.7rem;
  transition: 0.2s;
}



/* Fine border tweak on small topbar area in sidebar */
.sidebar-topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Clear history: make the icon neon red */
.sidebar-clear-history-icon {
  color: var(--neon-red);
}

/* ============================
   RECENT SEARCHES LIST
   ============================ */

/* UL wrapper */
.sidebar #recent-searches {
  list-style: none;
  margin: 0;
  padding-left: 0;
  margin-left: 0.2rem;   /* match other sidebar links */
  margin-right: 0.2rem;  /* small inset so right radius is visible */
}

/* Each <li> behaves as a full-width row */
.sidebar #recent-searches li {
  list-style: none;
  width: 100%;
  overflow: hidden; /* keep text + menu inside */
}

/* Wrapper for each item */
.sidebar .recent-search-item {
  width: 100%;
  position: relative;
}

/* Row: text on the left, menu button on the right */
.sidebar .recent-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.25rem 0.55rem;
  border-radius: 0.7rem;
  overflow: hidden; /* prevents gradient from bleeding outside corners */
}

/* Hover look */
/* Unified hover style for sidebar pills (actions + recent searches) */
.sidebar .menu-list a:hover,
.sidebar .recent-search-row:hover {
  background:
    linear-gradient(
      120deg,
      rgba(0, 234, 255, 0.15),
      rgba(255, 0, 204, 0.15)
    ),
    #050510; /* solid backing to remove transparent corners */

  box-shadow: 0 0 10px rgba(0, 234, 255, 0.2);
}

/* The clickable text: single line + CSS ellipsis */
.sidebar .recent-search-link {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  font-size: 0.9rem;

  /* one line only; trim with "…" when too long */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* keep it looking like normal sidebar text */
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  color: var(--text-main);
  text-decoration: none;
}

.sidebar .recent-search-link:hover {
  color: var(--text-main);   /* don’t turn blue on hover */
}

/* The menu button (3 dots icon), separate from text */
.sidebar .recent-search-menu-button {
  background: transparent;
  border: none;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0;
  margin-left: 6px;
  transition:
    opacity 0.15s ease-in-out,
    background 0.15s ease-in-out,
    color 0.15s ease-in-out;
}

/* Show button on row hover */
.sidebar .recent-search-item:hover .recent-search-menu-button {
  opacity: 1;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

/* Make sure both action links and recent rows clip their gradient */
.sidebar .menu-list a,
.sidebar .recent-search-row {
  border-radius: 0.7rem;
  overflow: hidden;
}

/* Remove ONLY Bulma's glow shadow */
.sidebar .menu-list a:hover {
  box-shadow: none !important;   /* kill Bulma glow */
  /* DO NOT touch background here */
}

/* Unified hover style for sidebar actions + recent searches */
.sidebar .menu-list a:hover,
.sidebar .recent-search-row:hover {
  background:
    linear-gradient(
      120deg,
      rgba(0, 234, 255, 0.15),
      rgba(255, 0, 204, 0.15)
    ),
    #060711;
  box-shadow: none;
}

/* ============================
   Sidebar: search history icon
   ============================ */

.sidebar #search-chats-input {
  /* a bit more room so the icon doesn't feel cramped */
  padding-left: 4.4rem;
}

/* Position the icon nicely inside the pill */
.sidebar .control.has-icons-left .icon.is-left {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* clicks go to the input */
}

/* Make the magnifying glass a bit bigger and on-brand */
.sidebar .control.has-icons-left .icon.is-left i {
  font-size: 1.05rem;           /* tweak up/down if you like */
}

/* Keep icon colour consistent (no Bulma blue on focus) */
.sidebar .control.has-icons-left .icon {
  color: var(--text-muted);
}

.sidebar .control.has-icons-left .input:focus ~ .icon {
  color: var(--text-muted) !important;
}

/* ============================
   Sidebar search – mobile tweaks
   ============================ */
@media screen and (max-width: 768px) {
  /* Give the pill a bit more breathing room left/right */
  .sidebar .p-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Slightly less left padding so text feels centred in the pill */
  .sidebar #search-chats-input {
    padding-left: 3.4rem;   /* desktop is 3.6rem */
    font-size: 0.95rem;   /* small bump so it feels balanced */
  }

  /* Tiny tweak to icon size so it matches the tighter pill */
  .sidebar .control.has-icons-left .icon.is-left i {
    font-size: 1rem;
  }
}