/* ============ DRAWER (V5) ============ */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

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

.drawer-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.drawer-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.drawer-close svg {
  width: 18px;
  height: 18px;
}

.new-chat-btn {
  margin: 0 12px 12px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.new-chat-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent);
}

.new-chat-btn svg {
  width: 16px;
  height: 16px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: none;
}

.drawer-link:hover {
  color: var(--text-primary);
}

.drawer-link svg {
  width: 16px;
  height: 16px;
}

.drawer-link.studio-link svg {
  color: var(--text-secondary);
}

/* Quick links container */
.quick-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

/* Studio link in chat list */
.studio-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s;
}

.studio-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.studio-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

/* Section label */
.section-label {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-section {
  padding: 12px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.drawer-list::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

/* Overlay */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
  z-index: 99;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ============ CHAT ITEMS ============ */
.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
  transition: all 0.15s;
}

.chat-item:hover {
  background: var(--bg-elevated);
}

.chat-item.active {
  background: var(--bg-elevated);
}

.chat-item.active .chat-name {
  color: var(--text);
  font-weight: 500;
}

/* Chat icon */
.chat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-card);
}

.chat-icon svg {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

/* Chat info */
.chat-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.chat-item:hover .chat-name {
  color: var(--text);
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* Status indicators */
.chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.unread-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent);
}

/* Unread state */
.chat-item.unread .chat-name {
  font-weight: 600;
  color: var(--text);
}

/* Pending state - gradient bg + pause icon */
.chat-item.pending {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.12) 0%, transparent 100%);
}

.pending-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pending-icon svg {
  width: 12px;
  height: 12px;
  color: #eab308;
}

/* Chat menu button */
.chat-menu-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  z-index: 2;
}

.chat-menu-btn svg {
  width: 14px;
  height: 14px;
}

.chat-item:hover .chat-menu-btn,
.chat-menu-btn.active {
  opacity: 1;
}

.chat-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

/* Chat dropdown menu */
.chat-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 8px;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  padding: 6px;
  display: none;
}

.chat-dropdown.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.chat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.chat-dropdown-item:hover {
  background: var(--bg-hover);
}

.chat-dropdown-item.danger {
  color: var(--error);
}

.chat-dropdown-item.danger:hover {
  background: var(--error-bg);
}

.chat-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.chat-dropdown-separator {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Agent avatars */
.chat-agents {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-right: 4px;
  transition: opacity 0.15s;
}

.chat-item:hover .chat-agents {
  opacity: 0;
}

.agent-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-surface);
  object-fit: cover;
}

.agent-avatar:not(:first-child) {
  margin-left: -8px;
}

.agent-avatar-more {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-surface);
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
}

/* Chat list loader */
.chat-list-loader {
  display: flex;
  justify-content: center;
  padding: 16px;
}

/* Empty state */
.drawer-list .empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Pod type icon colors */
.chat-icon.image { background: rgba(59, 130, 246, 0.15); }
.chat-icon.image svg { color: #3b82f6; }
.chat-icon.video { background: rgba(168, 85, 247, 0.15); }
.chat-icon.video svg { color: #a855f7; }
.chat-icon.doc { background: rgba(34, 197, 94, 0.15); }
.chat-icon.doc svg { color: #22c55e; }
.chat-icon.voice { background: rgba(249, 115, 22, 0.15); }
.chat-icon.voice svg { color: #f97316; }

/* ============ PROFILE FOOTER ============ */
.profile-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  position: relative;
}

.profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.profile-btn:hover {
  background: var(--bg-elevated);
}

.profile-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.2s;
}

.profile-dropdown.open + .profile-btn svg,
.profile-btn:has(+ .profile-dropdown.open) svg {
  transform: rotate(180deg);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.profile-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.profile-plan {
  font-size: 11px;
  color: var(--text-muted);
}

/* Profile Dropdown */
.profile-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 12px;
  right: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.15s;
  z-index: 100;
}

.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.profile-dropdown-item:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.profile-dropdown-item svg {
  width: 16px;
  height: 16px;
}

.profile-dropdown-item.danger {
  color: #ef4444;
}

.profile-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.profile-dropdown-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
