/* ═══════════════════════════════════════════════════════
   Rose — Custom Styles
   ═══════════════════════════════════════════════════════ */

/* ── Base ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #dce4e8;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #c2cdd3;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* ── Glass Panel ──────────────────────────────────────── */
.glass-panel {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
}

/* ── Sidebar Active State ─────────────────────────────── */
.sidebar-active {
  background-color: rgba(78, 69, 228, 0.1);
  color: #4e45e4;
  font-weight: 600;
}

/* ── Material Symbols ─────────────────────────────────── */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  user-select: none;
  vertical-align: middle;
}

/* ── Settings Panel Slide-in ──────────────────────────── */
.settings-slide-in {
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  pointer-events: all;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  max-width: 360px;
}

.toast.success { background: #22c55e; }
.toast.error   { background: #ef4444; }
.toast.info    { background: #4e45e4; }

@keyframes toastIn {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to   { transform: translateY(16px) scale(0.96); opacity: 0; }
}

.toast.leaving {
  animation: toastOut 0.2s ease forwards;
}

/* ── Message Bubbles ──────────────────────────────────── */
.msg-user {
  display: flex;
  justify-content: flex-end;
}

.msg-user .bubble {
  max-width: 75%;
  background: #4e45e4;
  color: #fbf7ff;
  padding: 12px 16px;
  border-radius: 1rem;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(78, 69, 228, 0.25);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.msg-assistant {
  display: flex;
  justify-content: flex-start;
}

.msg-assistant .bubble {
  max-width: 85%;
  background: #ffffff;
  color: #2c3437;
  padding: 14px 18px;
  border-radius: 1rem;
  border-bottom-left-radius: 4px;
  border: 1px solid #e5eaed;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

/* ── Streaming cursor ─────────────────────────────────── */
.streaming-cursor::after {
  content: '▋';
  animation: blink 0.7s step-end infinite;
  color: #4e45e4;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Message Action Buttons ───────────────────────────── */
.msg-actions {
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  margin-left: 2px;
}

.msg-assistant-wrapper:hover .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  padding: 4px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
}

.msg-action-btn:hover {
  background: #f3f4f6;
  color: #4e45e4;
}

/* ── Metrics Line ─────────────────────────────────────── */
.msg-metrics {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-top: 5px;
  margin-left: 2px;
  font-family: 'Manrope', monospace;
}

/* ── Code blocks inside messages ─────────────────────── */
.bubble pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  margin: 10px 0;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Cascadia Code', monospace;
}

.bubble code:not(pre code) {
  background: rgba(78, 69, 228, 0.08);
  color: #4e45e4;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12.5px;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
}

.msg-user .bubble code:not(pre code) {
  background: rgba(255,255,255,0.2);
  color: #fbf7ff;
}

.bubble strong {
  font-weight: 700;
}

.bubble em {
  font-style: italic;
}

.bubble ul {
  list-style: disc;
  padding-left: 20px;
  margin: 6px 0;
}

.bubble ol {
  list-style: decimal;
  padding-left: 20px;
  margin: 6px 0;
}

.bubble li {
  margin: 3px 0;
}

.bubble p {
  margin: 6px 0;
}

.bubble p:first-child {
  margin-top: 0;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  font-weight: 700;
  margin: 10px 0 4px;
}

.bubble h1 { font-size: 1.2em; }
.bubble h2 { font-size: 1.1em; }
.bubble h3 { font-size: 1em; }

.bubble hr {
  border: none;
  border-top: 1px solid #e5eaed;
  margin: 10px 0;
}

.bubble blockquote {
  border-left: 3px solid #4e45e4;
  padding-left: 12px;
  margin: 8px 0;
  color: #596064;
  font-style: italic;
}

/* ── Model Tab ────────────────────────────────────────── */
.model-tab {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  color: #596064;
  background: transparent;
}

.model-tab:hover {
  background: rgba(78, 69, 228, 0.07);
  color: #4e45e4;
}

.model-tab.active {
  background: rgba(78, 69, 228, 0.12);
  color: #4e45e4;
  border-color: rgba(78, 69, 228, 0.2);
}

/* ── Project list item ────────────────────────────────── */
.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 13px;
  font-weight: 500;
  color: #596064;
  position: relative;
  border: 1px solid transparent;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #2c3437;
}

.project-item.active {
  background: #ffffff;
  color: #4e45e4;
  font-weight: 700;
  border-color: rgba(78, 69, 228, 0.12);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

.project-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #acb3b7;
  flex-shrink: 0;
  transition: background 0.12s;
}

.project-item.active .project-dot {
  background: #4e45e4;
  box-shadow: 0 0 6px rgba(78, 69, 228, 0.5);
}

.project-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-settings-btn {
  opacity: 0;
  padding: 3px;
  border-radius: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #acb3b7;
  transition: all 0.12s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.project-item:hover .project-settings-btn,
.project-item.active .project-settings-btn {
  opacity: 1;
}

.project-settings-btn:hover {
  background: rgba(78, 69, 228, 0.1);
  color: #4e45e4;
}

/* ── File chip ────────────────────────────────────────── */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  background: #eaddff;
  color: #6617d7;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.file-chip .remove-file {
  cursor: pointer;
  border: none;
  background: none;
  color: #6617d7;
  padding: 0;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.12s;
}

.file-chip .remove-file:hover {
  opacity: 1;
}

/* ── Document list item ───────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid #eaeff2;
}

.doc-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #2c3437;
}

.doc-item-meta {
  font-size: 10px;
  color: #747c80;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Mic active state ─────────────────────────────────── */
#mic-btn.recording {
  background: #ef4444 !important;
  color: white !important;
}

#mic-btn.recording .material-symbols-outlined {
  animation: pulse-mic 1s ease infinite;
}

@keyframes pulse-mic {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Spinning loader ──────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* ── Typing indicator ─────────────────────────────────── */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
}

.typing-dots span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #acb3b7;
  animation: typing-bounce 1.2s ease infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick action chips ───────────────────────────────── */
.quick-chip {
  transition: transform 0.12s ease, background 0.15s ease;
}

.quick-chip:active {
  transform: scale(0.96);
}

/* ── Textarea auto-resize ─────────────────────────────── */
#message-input {
  field-sizing: content;
}

/* Fallback for browsers without field-sizing */
@supports not (field-sizing: content) {
  #message-input {
    overflow-y: auto;
  }
}

/* ── Focus ring refinement ────────────────────────────── */
button:focus-visible {
  outline: 2px solid #4e45e4;
  outline-offset: 2px;
}

input:focus-visible, textarea:focus-visible {
  outline: none;
}

/* ── Drag over state ──────────────────────────────────── */
#input-bar.drag-over {
  ring-color: #4e45e4;
  background: rgba(78, 69, 228, 0.03);
}

/* ── Copy button feedback ─────────────────────────────── */
.copy-success .material-symbols-outlined {
  color: #22c55e !important;
}

/* ── Notification badge on project ───────────────────── */
.project-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: #4e45e4;
  color: #fbf7ff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Empty documents state ────────────────────────────── */
.docs-empty {
  text-align: center;
  padding: 20px;
  color: #acb3b7;
  font-size: 12px;
}

/* ── Confirm dialog overlay ───────────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.confirm-box {
  background: white;
  border-radius: 1rem;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
