/* FILE: css/chat.css */

/* === Chat Area === */
#chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* === Chat Header === */
#chat-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: max(var(--space-3), env(safe-area-inset-top)) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  flex-shrink: 0;
  z-index: var(--z-header);
  width: 100%;
  box-sizing: border-box;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.chat-header-center {
  flex-shrink: 0;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

/* Hamburger (mobile) */
#hamburger-btn {
  display: none;
}

/* Conversation title */
#conversation-title {
  font-size: clamp(13px, 3.5vw, 16px);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  max-width: 100%;
  border: 1px solid transparent;
  line-height: 1.4;
}

#conversation-title:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

#title-edit-input {
  font-size: var(--font-size-base);
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  color: var(--text-primary);
  outline: none;
  width: min(280px, 50vw);
  max-width: 100%;
}

/* === Model Status === */
#model-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: default;
  transition: all var(--transition-fast);
}

.model-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

#model-status.status-loading .model-status-dot {
  background: var(--accent-warning);
  animation: breathe 1.5s ease-in-out infinite;
}

#model-status.status-ready .model-status-dot {
  background: var(--accent-success);
}

#model-status.status-thinking .model-status-dot {
  background: var(--accent-secondary);
  animation: pulse 1s ease-in-out infinite;
}

#model-status.status-error .model-status-dot {
  background: var(--accent-danger);
}

#model-status.status-error {
  cursor: pointer;
}

#model-status.status-error:hover {
  border-color: var(--accent-danger);
  background: rgba(255, 82, 82, 0.1);
}

.model-status-text {
  color: var(--text-secondary);
}

/* === In-Chat Search === */
#in-chat-search {
  padding: var(--space-2) var(--space-5);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideDown 0.2s ease;
  flex-shrink: 0;
}

#search-in-chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  outline: none;
}

#search-in-chat-input:focus {
  border-color: var(--border-input);
}

#search-match-count {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

.search-nav-btns {
  display: flex;
  gap: var(--space-1);
}

/* === Messages Container === */
#messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#messages-list {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 100%;
  contain: layout style;
}

/* === Empty State === */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center;
  flex: 1;
  min-height: 400px;
  gap: var(--space-5);
}

.empty-logo {
  width: 80px;
  height: 80px;
  position: relative;
}

.empty-logo svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 0 20px rgba(108, 99, 255, 0.4));
}

.empty-particles-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.empty-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: particleFloat 3s ease-in-out infinite;
}

.empty-particle:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; background: var(--accent-primary); }
.empty-particle:nth-child(2) { top: 20%; right: 15%; animation-delay: 0.5s; background: var(--accent-secondary); }
.empty-particle:nth-child(3) { bottom: 15%; left: 10%; animation-delay: 1s; background: var(--accent-primary); }
.empty-particle:nth-child(4) { bottom: 20%; right: 20%; animation-delay: 1.5s; background: var(--accent-secondary); }

#empty-state h1 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

#empty-state p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  max-width: 360px;
  line-height: 1.6;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  max-width: 480px;
}

.suggestion-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-accent);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

/* === New Message Button (scroll) === */
#new-message-btn {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-md);
  animation: slideInUp var(--transition-fast) ease;
  z-index: var(--z-base);
  white-space: nowrap;
}

#new-message-btn:hover {
  background: var(--bg-active);
  border-color: var(--accent-primary);
}

/* === Date Separator === */
.date-separator {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.date-sep-pill {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  white-space: nowrap;
}

/* === Search highlight === */
.search-highlight {
  background: rgba(255, 200, 0, 0.3);
  border-radius: 2px;
}

.search-highlight.active {
  background: rgba(255, 200, 0, 0.6);
}
