/* Sil sidebar — conversation list, rename/delete, title bar */

/* Conversation title bar */
.conv-title-bar {
  padding: 6px 16px;
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  max-width: 100%;
  text-align: center;
}
.conv-title-bar:hover { color: var(--fg); cursor: pointer; }

/* Conversation list on landing page */

.conv-section {
  margin-top: 2rem;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.conv-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conv-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.conv-item:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.conv-title {
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.3;
}

.conv-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.conv-loading,
.conv-empty {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.5rem 0;
}

.conv-item-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.conv-item-wrap .conv-item {
  flex: 1;
  padding-right: 4.2rem;
}

/* Search input */
.conv-search-wrap {
  padding: 0.5rem 0.75rem 0.75rem;
  border-bottom: none; /* remove line that was tangent to first item */
}

.conv-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg, #f8f8f8);
  color: var(--fg, #333);
  outline: none;
}

.conv-search:focus {
  border-color: var(--accent, #7c3aed);
}

/* Context menu button (⋮) — always visible on touch,
   hover-reveal on desktop (no hover on mobile). */
.conv-menu-btn {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  opacity: 0.6; /* visible by default for touch */
  transition: opacity 0.15s, color 0.15s;
}

/* On devices with hover capability, hide until hover */
@media (hover: hover) {
  .conv-menu-btn {
    opacity: 0;
  }
  .conv-item-wrap:hover .conv-menu-btn {
    opacity: 1;
  }
}

.conv-menu-btn:hover {
  color: var(--accent);
  background: rgba(124, 58, 237, 0.08);
}

/* Context menu dropdown */
.conv-context-menu {
  position: absolute;
  top: 100%;
  right: 0.5rem;
  z-index: 300;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  min-width: 140px;
}

.conv-context-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  color: var(--fg, #333);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.conv-context-item:hover {
  background: var(--bg, #f5f5f5);
}

.conv-context-item + .conv-context-item {
  border-top: 1px solid var(--border, #eee);
}

/* Inline delete confirmation */
.conv-delete-confirm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--error-bg);
  border-top: 1px solid var(--error);
  font-size: 0.8rem;
  color: var(--error);
}

.conv-confirm-yes,
.conv-confirm-no {
  border: none;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.conv-confirm-yes {
  background: var(--error);
  color: var(--bg);
}

.conv-confirm-no {
  background: transparent;
  color: var(--muted, #888);
}

/* Starred conversations — star icon before title */
.conv-item.starred .conv-title::before {
  content: '\2605 '; /* ★ filled star */
  color: var(--accent, #7c3aed);
}

/* Tag pills below conversation title */
.conv-tags {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.conv-tag-pill {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--border, #e5e5e5);
  color: var(--muted, #666);
}

.conv-title-input {
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  background: var(--card-bg);
  color: var(--fg);
  width: 100%;
  outline: none;
}

/* Slide-in conversation sidebar (conversation page) */

.conv-sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 499;
}
.conv-sidebar-backdrop.open { display: block; }

.conv-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: var(--bg, #fff);
  border-right: 1px solid var(--border, #e5e5e5);
  z-index: 500;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.conv-sidebar.open { transform: translateX(0); }

/* On wide screens, push content instead of overlaying */
@media (min-width: 768px) {
  .conv-sidebar.open ~ .messages,
  .conv-sidebar.open ~ .input-area,
  .conv-sidebar.open ~ .toolbar {
    margin-left: 280px;
    transition: margin-left 0.2s ease;
  }
  .conv-sidebar-backdrop.open {
    display: none; /* no backdrop on desktop */
  }
}

.conv-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border, #e5e5e5);
  flex-shrink: 0;
}
.conv-sidebar-title {
  font-weight: 600;
  font-size: 1rem;
}
.conv-sidebar-close {
  border: none;
  background: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 0.25rem 0.5rem;
}

/* Sidebar conversation list items */

.conv-sidebar .conv-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.conv-list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 0.625rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--fg, #333);
  border-bottom: 1px solid var(--border, #e5e5e5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-list-item:hover { background: var(--border); }
.conv-list-item.active { background: var(--accent, #4A90D9); color: #fff; }
.conv-list-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted, #888);
  font-size: 0.875rem;
}
