/* ═══════════════════════════════════════════════
   DarkRP — Dark Glassmorphic Design System
   ═══════════════════════════════════════════════ */

:root {
  --bg-deep: #08060a;
  --bg-surface: #0e0b12;
  --bg-card: rgba(20, 12, 18, 0.7);
  --bg-glass: rgba(28, 18, 24, 0.6);
  --bg-input: rgba(35, 22, 30, 0.6);
  --border: rgba(120, 40, 60, 0.2);
  --border-focus: rgba(200, 30, 60, 0.5);

  --accent: #c81e3c;
  --accent-glow: rgba(200, 30, 60, 0.3);
  --accent-soft: #d44a6a;
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.12);

  --text: #f0eaf2;
  --text-dim: #9a8b9e;
  --text-muted: #5a4a5e;

  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen { display: none; height: 100vh; width: 100vw; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════ */

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(200, 30, 60, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(13, 7, 18, 1) 0%, #040206 100%);
}

.login-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 30, 60, 0.15) 0%, rgba(124, 58, 237, 0.1) 50%, transparent 70%);
  filter: blur(100px);
  animation: pulse-glow 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

.hero-text {
  text-align: center;
  margin-bottom: 56px;
  z-index: 2;
  animation: fade-up 0.8s ease-out;
}

.login-logo {
  width: 460px;
  max-width: 90%;
  height: auto;
  margin-bottom: 32px;
  filter: drop-shadow(0 8px 32px rgba(255, 45, 85, 0.3));
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.4s ease;
}

.login-logo:hover {
  transform: translateY(-6px) scale(1.03);
  filter: drop-shadow(0 12px 40px rgba(255, 45, 85, 0.5));
}

.hero-text h1 {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: clamp(34px, 4.8vw, 66px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: #ebe5d8;
  -webkit-text-fill-color: #ebe5d8;
  margin-bottom: 16px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hero-text p {
  font-size: clamp(14px, 1.8vw, 17px);
  color: #d4c9d8;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.login-card {
  width: 380px;
  padding: 40px 36px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 2;
  animation: fade-up 0.6s ease-out 0.15s both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo { text-align: center; margin-bottom: 36px; }
.logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.logo h1 {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.input-group { margin-bottom: 20px; }
.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}
.input-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-group input::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.error-text {
  color: var(--error);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

/* ═══════════════════════════════════════════════
   CHAT LAYOUT
   ═══════════════════════════════════════════════ */

#chatScreen { display: none; }
#chatScreen.active { display: flex; }

/* ── Sidebar ── */
.sidebar {
  width: 280px;
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--accent-glow);
  background: rgba(200, 30, 60, 0.08);
}

.expand-sidebar-btn {
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  margin-right: 8px;
}

.expand-sidebar-btn:hover {
  color: var(--text);
  border-color: var(--accent-glow);
}

.sidebar.collapsed ~ .chat-main .expand-sidebar-btn {
  display: flex;
}

.sidebar-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.logo-small {
  font-weight: 600;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover img {
  transform: scale(1.1);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent-glow); background: rgba(200, 30, 60, 0.08); }
.btn-icon.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 30, 60, 0.15);
  box-shadow: 0 0 10px var(--accent-glow);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.conversation-list::-webkit-scrollbar { width: 4px; }
.conversation-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.conv-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item:hover { background: var(--purple-soft); color: var(--text); }
.conv-item.active { background: var(--purple-soft); color: var(--accent); border-left: 2px solid var(--accent); }

/* ── Sidebar Footer ── */
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }

.usage-meter { margin-bottom: 12px; }
.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.usage-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}
.usage-count { font-size: 11px; color: var(--text-muted); min-width: 36px; text-align: right; }

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-name { font-size: 13px; font-weight: 500; }
.tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tier-badge { background: var(--purple-soft); color: var(--purple); }
.tier-badge.pro { background: rgba(233, 30, 140, 0.15); color: var(--accent); }

/* ── Chat Main ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 11, 18, 0.8);
  backdrop-filter: blur(12px);
}
.chat-title { flex: 1; min-width: 0; }
.chat-title h2 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--purple-soft);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 2px;
}

.header-actions { display: flex; gap: 8px; }

/* ── Messages ── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(200, 30, 60, 0.02) 0%, transparent 60%);
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.messages {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.welcome-icon { font-size: 56px; display: block; margin-bottom: 16px; }
.welcome-message h3 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

/* Message Bubbles */
.message { display: flex; gap: 12px; animation: msg-in 0.3s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }

.message.user { flex-direction: row-reverse; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 4px;
}
.message.assistant .message-avatar { background: linear-gradient(135deg, var(--accent), var(--purple)); }
.message.user .message-avatar { background: var(--bg-glass); border: 1px solid var(--border); }

.message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}
.message.assistant .message-bubble {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}
.message.user .message-bubble {
  background: linear-gradient(135deg, rgba(200, 30, 60, 0.15), rgba(124, 58, 237, 0.12));
  border: 1px solid rgba(200, 30, 60, 0.2);
}

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble code {
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Fira Code', monospace;
}
.message-bubble pre {
  background: rgba(0,0,0,0.4);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
}
.message-bubble pre code { background: none; padding: 0; }
.message-bubble em { color: var(--text-dim); font-style: italic; }
.message-bubble .dialogue { color: var(--accent-soft); }
.message-bubble strong { color: var(--text); font-weight: 600; }

.message-image {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  border: 1px solid var(--border);
}

.message-audio {
  margin-top: 8px;
  width: 100%;
  height: 36px;
  border-radius: 20px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

/* ── Input Area ── */
.input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(14, 11, 18, 0.9);
  backdrop-filter: blur(12px);
}

.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: var(--transition);
}
.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#messageInput {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 150px;
  padding: 4px 0;
}
#messageInput::placeholder { color: var(--text-muted); }

.input-actions { display: flex; gap: 4px; align-items: center; }

.input-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.btn-send {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-send:hover { filter: brightness(1.15); transform: scale(1.05); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════
   INLINE SCENARIO FORM
   ═══════════════════════════════════════════════ */

.scenario-inline {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 0 60px;
  animation: fade-up 0.4s ease-out;
}

.scenario-header {
  text-align: center;
  margin-bottom: 32px;
}

.scenario-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.scenario-header h2 {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.scenario-header p {
  color: var(--text-dim);
  font-size: 14px;
}

.form-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding-left: 2px;
}

.form-section-label:first-child {
  margin-top: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 6px;
}

.tab-btn:hover {
  color: var(--text-dim);
}

.tab-btn.active {
  color: var(--text);
  background: var(--bg-glass);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.tab-content {
  display: none;
  animation: fade-in 0.25s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.scenario-inline .input-group {
  margin-bottom: 0;
}

.scenario-inline .input-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.scenario-inline .input-group input,
.scenario-inline .styled-select,
.scenario-inline textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.scenario-inline .input-group input:focus,
.scenario-inline .styled-select:focus,
.scenario-inline textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.scenario-inline .input-group input::placeholder,
.scenario-inline textarea::placeholder {
  color: var(--text-muted);
}

.styled-select {
  appearance: none;
  cursor: pointer;
}

.styled-select option {
  background: var(--bg-deep);
  color: var(--text);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.chip {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.chip:hover {
  border-color: var(--accent-glow);
  color: var(--text);
}

.chip.active {
  background: rgba(233, 30, 140, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.scenario-start-btn {
  margin-top: 28px;
  padding: 16px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

@media (max-width: 600px) {
  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .scenario-inline {
    padding: 20px 0 40px;
  }
}

/* ═══════════════════════════════════════════════
   UPGRADE MODAL
   ═══════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }

.modal-card {
  width: 380px;
  padding: 40px 32px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  animation: fade-up 0.3s ease-out;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-icon { font-size: 48px; margin-bottom: 12px; }
.modal-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.modal-card > p { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.pro-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}
.feature-item {
  font-size: 13px;
  padding: 8px 12px;
  background: var(--purple-soft);
  border-radius: var(--radius-sm);
  text-align: left;
}

.modal-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.modal-price span { font-size: 16px; font-weight: 400; color: var(--text-dim); }
.modal-note { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

.mobile-only { display: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 100;
    transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }
  .mobile-only { display: flex; }

  .message-bubble { max-width: 90%; }

  .login-card { width: 90%; max-width: 380px; padding: 36px 24px; }

  .modal-card { width: 90%; max-width: 380px; }
  .pro-features { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   EMPTY / LOADING STATES
   ═══════════════════════════════════════════════ */

/* Glassmorphic dashboard container */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 720px;
  margin: 60px auto;
  padding: 48px 32px;
  background: rgba(14, 8, 20, 0.45);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(120, 40, 60, 0.15);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  animation: fade-up 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ambient plum halo glow behind dashboard */
.empty-state::before {
  content: '';
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 30, 60, 0.12) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.empty-state-icon {
  z-index: 1;
  margin-bottom: 24px;
}

/* Portal glow surrounding the SVG ball */
.glow-portal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

/* Sparkle animations for our custom SVG ball */
.sparkle-one { animation: pulse-opacity 3s ease-in-out infinite; transform-origin: center; }
.sparkle-two { animation: pulse-opacity 2.5s ease-in-out infinite 0.5s; transform-origin: center; }
.sparkle-three { animation: pulse-opacity 3.5s ease-in-out infinite 1s; transform-origin: center; }

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.glow-pulse {
  animation: pulse-scale 4s ease-in-out infinite;
  transform-origin: center;
}

@keyframes pulse-scale {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}

.empty-state h3 {
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 700;
  color: #ebe5d8;
  margin-bottom: 12px;
  z-index: 1;
}

.empty-state p {
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--text-dim);
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 36px;
  z-index: 1;
}

/* Upgraded button styling for empty state CTA */
.empty-state .btn-primary {
  width: auto;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(200, 30, 60, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.empty-state .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(200, 30, 60, 0.6), 0 0 15px rgba(124, 58, 237, 0.4);
}

/* Feature cards container */
.dashboard-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin-top: 8px;
  z-index: 1;
}

@media (max-width: 600px) {
  .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

/* Dashboard Action Cards */
.dashboard-card {
  background: rgba(30, 18, 38, 0.3);
  border: 1px solid rgba(120, 40, 60, 0.15);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  border-color: rgba(200, 30, 60, 0.4);
  background: rgba(35, 20, 45, 0.45);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.dashboard-card .card-glow {
  position: absolute;
  top: -50px;
  left: -50px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(24px);
  z-index: 0;
  transition: transform 0.5s ease;
}

.dashboard-card:hover .card-glow {
  transform: scale(1.5);
}

.dashboard-card .card-icon {
  font-size: 28px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.05);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-card .card-content {
  flex: 1;
  z-index: 1;
}

.dashboard-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: #ebe5d8;
  margin-bottom: 4px;
}

.dashboard-card p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0;
  max-width: 100%;
}

.dashboard-card .card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform 0.3s ease, color 0.3s ease;
  z-index: 1;
}

.dashboard-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

/* Sidebar action container */
.sidebar-actions {
  padding: 10px 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-sidebar-new {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(200, 30, 60, 0.2);
}

.btn-sidebar-new:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(200, 30, 60, 0.35), 0 0 8px rgba(124, 58, 237, 0.2);
  filter: brightness(1.05);
}

.btn-sidebar-new svg {
  transition: transform 0.25s ease;
}

.btn-sidebar-new:hover svg {
  transform: rotate(90deg);
}

/* Loading skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--bg-glass) 25%, rgba(60,40,55,0.4) 50%, var(--bg-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════
   PROFILE MODAL
   ═══════════════════════════════════════════════ */

.profile-modal-card {
  max-width: 360px;
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(200, 30, 60, 0.25);
}

.profile-section {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(120, 40, 60, 0.1);
}

.profile-stat-row:last-child {
  border-bottom: none;
}

.profile-stat-label {
  font-size: 13px;
  color: var(--text-dim);
}

.profile-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ═══════════════════════════════════════════════
   ACCESSIBILITY & POLISH
   ═══════════════════════════════════════════════ */

/* Improve text contrast on conversation items */
.conv-item {
  font-size: 14px;
  color: #b8a8bc;
  padding: 14px 16px;
}

.conv-item.active {
  color: var(--text);
  background: rgba(200, 30, 60, 0.08);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.usage-count {
  font-size: 12px;
  color: #b8a8bc;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.model-badge {
  font-size: 12px;
  color: #b8a8bc;
  padding: 3px 10px;
}

.chat-title h2 {
  font-size: 17px;
}

/* Stronger active state for TTS toggle */
.btn-icon.active {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(200, 30, 60, 0.2), rgba(124, 58, 237, 0.15));
  box-shadow: 0 0 12px var(--accent-glow), inset 0 0 8px rgba(200, 30, 60, 0.1);
}

/* Home button hover hint */
#homeBtn:hover {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}

#profileBtn:hover {
  color: var(--purple);
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.08);
}

/* ═══════════════════════════════════════════════
   AUDIO PLAYER & TTS LOADER
   ═══════════════════════════════════════════════ */

audio {
  color-scheme: dark;
}

.tts-loader {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 12px;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--bg-input) 25%, rgba(120, 40, 60, 0.2) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite linear;
  opacity: 0.7;
}

@keyframes loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.model-badge.infinite, .tier-badge.infinite {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: white;
  box-shadow: 0 0 10px rgba(0, 198, 255, 0.4);
  font-weight: 700;
}

audio {
  color-scheme: dark;
  /* Forcing dark mode on audio element for stubborn browsers */
  filter: invert(0.85) hue-rotate(180deg) brightness(1.2);
  width: 100%;
  margin-top: 12px;
  border-radius: 12px;
  outline: none;
}

.tts-error {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-top: 12px;
  border-radius: 8px;
  background: rgba(200, 30, 60, 0.2);
  color: #ff6b6b;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  border: 1px solid rgba(200, 30, 60, 0.4);
}
