/* ============================================
   MYTHOS AI — Stylesheet
   File: style.css
   ============================================ */

:root {
  --gold: #f5ca0b;
  --gold-light:#fbc924;
  --gold-dark: #d4af1a;
  


  --orange: #E8741A;
  --red: #CC3D1A;
  --bg: #0A0A0A;
  --bg2: #111111;
  --bg3: #181818;
  --bg4: #1E1E1E;
  --border: #2A2A2A;
  --text: #E8E8E8;
  --text-dim: #888;
  --text-muted: #555;
  --user-bubble: #1A1500;
  --ai-bubble: #0F1A0F;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* ===================== LOADING SCREEN ===================== */
#loading-screen {
  position: fixed; inset: 0;
  background: #000;
  display: flex;
  align-items: center; justify-content: center;
  z-index: 9999;
  /* fade is now controlled by JS — no CSS auto-dismiss */
}

.loading-content {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Circular logo + ring */
.loading-logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 120px;
}

.ring-progress {
  animation: fillRing 3.0s linear forwards;
}

.loading-logo-img {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
}

/* Right text block */
.loading-text-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loading-title {
  font-family: var(--font-display);
  font-size: 64px;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(245, 202, 11, 0.35);
  line-height: 1;
  animation: titlePulse 2s ease-in-out infinite alternate;
}

.loading-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: #555;
  padding-left: 4px;
}

@keyframes fillRing {
  0%   { stroke-dashoffset: 326.7; }
  100% { stroke-dashoffset: 0; }
}

@keyframes titlePulse {
  from { text-shadow: 0 0 20px rgba(245, 202, 11, 0.2); }
  to   { text-shadow: 0 0 60px rgba(245, 202, 11, 0.6), 0 0 100px rgba(245, 180, 11, 0.2); }
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
@keyframes fadeOutLoading { to { opacity:0; pointer-events:none; } }
@keyframes fadeInApp {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* ===================== AUTH SCREENS ===================== */
#auth-screen {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  background: var(--bg);
  overflow: hidden;
}

/* Galaxy particles - all will move continuously */
.galaxy-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  z-index: 0;
  will-change: transform, opacity;
}

#auth-screen.active { display: flex; }

.auth-card {
  position: relative;
  z-index: 2;
  background: var(--bg2);
  border: none;
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  animation: slideUp 0.5s ease, authCardBorderPulse 3s ease-in-out infinite;
  box-shadow: 0 0 0 2px #f5ca0b55, 0 0 30px #f5ca0b33, 0 40px 80px rgba(0,0,0,0.6);
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(var(--auth-angle, 0deg),
    var(--gold), var(--orange), var(--red),
    #ff0000, var(--gold), #ff0000,var(--orange));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: authRotateBorder 3s linear infinite;
  z-index: 0;
  pointer-events: none;
}

.auth-card > * { position: relative; z-index: 1; }

@property --auth-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes authRotateBorder {
  to { --auth-angle: 360deg; }
}

@keyframes authCardBorderPulse {
  0%, 100% { box-shadow: 0 0 0 2px #f5ca0b55, 0 0 30px #f5ca0b33, 0 40px 80px rgba(0,0,0,0.6); }
  50% { box-shadow: 0 0 0 2px #f5ca0b99, 0 0 60px #f5ca0b66, 0 40px 80px rgba(0,0,0,0.6); }
}

@keyframes slideUp {
  from { opacity:0; transform: translateY(30px); }
  to   { opacity:1; transform: translateY(0); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-text {
  font-family: var(--font-display);
  font-size: 48px;

  letter-spacing: 4px;
  color:rgba(255, 238, 0, 0.968);
  line-height: 1;
  display: block;
}

.auth-logo-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 6px;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.auth-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.auth-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  margin-bottom: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.auth-input:focus {
  border-color: #f5a623;
  box-shadow: 0 0 0 3px rgba(245,166,35,0.1);
}

.auth-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ffc400ac, #ffff00ac);
  border: none;
  border-radius: 8px;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.auth-btn:hover {
  background: linear-gradient(135deg, #ffea00, #ff9d00);
  box-shadow: 0 8px 30px rgba(245, 166, 35, 0.3);
  transform: translateY(-1px);
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.auth-switch a {
  color: #f5bd23;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-error {
  color: #ff6b4a;
  font-size: 13px;
  margin-top: 12px;
  display: none;
  text-align: center;
}
/* ===================== MAIN APP ===================== */
#app {
  display: none;
  height: 100vh;
  flex-direction: column;
}

#app.active { display: flex; }

/* TOP BAR */
.topbar {
  display: flex; align-items: center;
  padding: 0 20px;
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
  z-index: 50;
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 22px;

  letter-spacing: 4px;
  color: var(--gold);
}


.topbar-model-select {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}

.model-dropdown-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}

.model-dropdown-btn:hover {
  border-color: var(--gold);
  background: var(--bg4);
}

.model-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100%{ box-shadow:0 0 0 0 rgba(245,166,35,0.5); }
  50%{ box-shadow:0 0 0 5px rgba(245,166,35,0); }
}

.model-chevron { color: var(--text-muted); font-size: 10px; }

/* Model dropdown panel */
.model-panel {
  position: absolute;
  top: 58px;
  right: 60px;
  width: 240px;
  background: var(--bg2);
  border-radius: 12px;
  padding: 2px;
  z-index: 200;
  display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  animation: dropDown 0.15s ease;
  /* Animated gradient border via background trick */
  background: linear-gradient(var(--model-border-angle, 0deg), var(--gold), var(--orange), var(--red), #a020f0, var(--gold));
}

@property --model-border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes modelBorderSpin {
  to { --model-border-angle: 360deg; }
}

.model-panel.open {
  display: block;
  animation: dropDown 0.15s ease, modelBorderSpin 3s linear infinite;
}

.model-panel-inner {
  background: var(--bg2);
  border-radius: 11px;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.model-panel-inner::-webkit-scrollbar { width: 3px; }
.model-panel-inner::-webkit-scrollbar-track { background: transparent; }
.model-panel-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

@keyframes dropDown {
  from { opacity:0; transform: translateY(-8px); }
  to   { opacity:1; transform: translateY(0); }
}

.model-group-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  text-transform: uppercase;
}

.model-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}

.model-item:hover, .model-item.selected {
  background: var(--bg3);
}

.model-item.selected .model-item-name { color: var(--gold); }

.model-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: var(--bg4);
  flex-shrink: 0;
}

.model-item-info { flex: 1; min-width: 0; }
.model-item-name { font-size: 13px; font-weight: 500; color: var(--text); }
.model-item-desc { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.model-check { color: var(--gold); font-size: 12px; }

/* Topbar right */
.topbar-right {
  display: flex; align-items: center; gap: 12px;
}

.user-avatar-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--orange));
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0;
  transition: all 0.2s;
}

.user-avatar-btn:hover {
  box-shadow: 0 0 20px rgba(245,166,35,0.4);
  transform: scale(1.05);
}

/* ===================== MAIN LAYOUT ===================== */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 16px 16px 8px;
}

.new-chat-btn {
  margin: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(245,166,35,0.15), rgba(232,116,26,0.1));
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, rgba(245,166,35,0.25), rgba(232,116,26,0.15));
  box-shadow: 0 4px 16px rgba(245,166,35,0.15);
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.conversations-list::-webkit-scrollbar { width: 4px; }
.conversations-list::-webkit-scrollbar-track { background: transparent; }
.conversations-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.conv-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.conv-item:hover, .conv-item.active { background: var(--bg3); }
.conv-item.active { border-left: 2px solid var(--gold); }

.conv-item-body {
  flex: 1;
  min-width: 0;
}

.conv-del-btn {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.conv-item:hover .conv-del-btn { display: flex; }
.conv-del-btn:hover { background: rgba(204,61,26,0.15); color: #ff6b4a; }

/* Message bubble action buttons */
.msg-actions {
  display: none;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-end;
}

.message-row.user:hover .msg-actions { display: flex; }

.msg-action-btn {
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

.msg-action-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(245,202,11,0.08); }

/* 3-dot bubble menu */
.bubble-menu-wrap {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.bubble-dots-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  letter-spacing: 2px;
  transition: all 0.15s;
  opacity: 0;
}

.msg-bubble.user:hover .bubble-dots-btn,
.bubble-dots-btn:focus,
.bubble-popup.open ~ .bubble-dots-btn,
.bubble-menu-wrap:has(.bubble-popup.open) .bubble-dots-btn {
  opacity: 1;
}

.msg-bubble.user:hover .bubble-dots-btn { opacity: 1; }

.bubble-dots-btn:hover {
  background: rgba(245,202,11,0.12);
  color: var(--gold);
  opacity: 1;
}

.bubble-popup {
  display: none;
  position: absolute;
  bottom: 28px;
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
  min-width: 150px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 100;
  animation: popupIn 0.12s ease;
}

@keyframes popupIn {
  from { opacity:0; transform: scale(0.92) translateY(6px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.bubble-popup.open { display: block; }

.bubble-popup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  border-radius: 7px;
  text-align: left;
  transition: background 0.12s;
  white-space: nowrap;
}

.bubble-popup-item:hover { background: var(--bg4); }
.bubble-popup-item.danger { color: #ff6b4a; }
.bubble-popup-item.danger:hover { background: rgba(204,61,26,0.15); }

/* Profile edit styles */
.profile-edit-section {
  margin-bottom: 20px;
}

.profile-avatar-wrap {
  position: relative;
  width: 80px;
  margin: 0 auto 16px;
  cursor: pointer;
}

.profile-avatar-wrap:hover .avatar-edit-overlay { opacity: 1; }

.avatar-edit-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.2s;
}

.profile-edit-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s;
  text-align: center;
}

.profile-edit-input:focus { border-color: var(--gold); }

.profile-save-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, rgba(245,202,11,0.2), rgba(232,116,26,0.15));
  border: 1px solid rgba(245,202,11,0.4);
  border-radius: 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.profile-save-btn:hover { background: linear-gradient(135deg, rgba(245,202,11,0.3), rgba(232,116,26,0.2)); }

.conv-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.conv-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding: 8px;
}

.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.2s;
}

.sidebar-nav-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-nav-item.active { background: var(--bg3); color: var(--gold); }

.sidebar-nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ===================== CHAT AREA ===================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}


.welcome-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  overflow-y: auto;
}

/* For mobile */
@media (max-width: 768px) {
  .welcome-view {
    justify-content: center;
    padding: 30px 16px;
    overflow-y: auto;
  }
  
  .chat-area {
    overflow-y: auto;
  }
}

.welcome-logo {
  font-family: var(--font-display);
  font-size: 50px;
  letter-spacing: 9px;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(245,166,35,0.3);
  margin-bottom: 6px;
}

.welcome-sub {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--text-muted);
  margin-bottom: 32px;
}


/* Animated label chips */
.welcome-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 520px;
  margin-bottom: 28px;
}

@keyframes chipPop {
  0%   { opacity: 0; transform: translateY(14px) scale(0.85); }
  70%  { transform: translateY(-3px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes chipGlow {
  0%, 100% { box-shadow: 0 0 0px rgba(245,166,35,0); border-color: rgba(245,166,35,0.25); }
  50%       { box-shadow: 0 0 12px rgba(245,166,35,0.35); border-color: rgba(245,166,35,0.7); }
}

.wl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(245,166,35,0.07);
  border: 1px solid rgba(245,166,35,0.25);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: default;
  opacity: 0;
  animation: chipPop 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards,
             chipGlow 3s ease-in-out infinite;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.wl-chip:hover {
  background: rgba(245,166,35,0.18);
  color: var(--gold);
  transform: translateY(-2px) scale(1.05);
}
.wl-delay-0 { animation-delay: 0.15s, 1.5s; }
.wl-delay-1 { animation-delay: 0.28s, 1.9s; }
.wl-delay-2 { animation-delay: 0.41s, 2.3s; }
.wl-delay-3 { animation-delay: 0.54s, 2.7s; }
.wl-delay-4 { animation-delay: 0.67s, 3.1s; }
.wl-delay-5 { animation-delay: 0.80s, 3.5s; }
.wl-delay-6 { animation-delay: 0.93s, 3.9s; }
.wl-delay-7 { animation-delay: 1.06s, 4.3s; }

/* Warning line below labels */
.welcome-warning {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.6;
  opacity: 0.75;
  border-top: 1px solid rgba(245,166,35,0.1);
  padding-top: 16px;
}


/* Messages */
.messages-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: none;
}

.messages-view.active {
  display: block;
}

.messages-view::-webkit-scrollbar { width: 4px; }
.messages-view::-webkit-scrollbar-track { background: transparent; }
.messages-view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.message-row {
  padding: 8px 24px;
  display: flex;
  gap: 14px;
  animation: msgIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes msgIn {
  from { opacity:0; transform: translateY(12px); }
  to   { opacity:1; transform: translateY(0); }
}

.message-row.user { justify-content: flex-end; }
.message-row.ai   { justify-content: flex-start; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.msg-avatar.user {
  background: linear-gradient(135deg, var(--gold-dark), var(--orange));
  color: #111;
  order: 2;
}

.msg-avatar.ai {
  background: linear-gradient(135deg, #2a2a30, #1c1c22);
  border: 1px solid rgba(150,150,160,0.25);
  color: #aaa;
}

.msg-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  position: relative;
}

.msg-bubble.user {
  background: linear-gradient(135deg, rgba(245, 202, 11, 0.271), rgba(232, 115, 26, 0.304));
  border: 1px solid rgba(245,202,11,0.35);
  color: var(--text);
  border-top-right-radius: 4px;
}

.msg-bubble.ai {
  background: linear-gradient(135deg, rgba(60,60,65,0.7), rgba(40,40,45,0.7));
  border: 1px solid rgba(100,100,110,0.25);
  color: var(--text);
  border-top-left-radius: 4px;
}

.msg-bubble .model-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.msg-bubble pre {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.msg-bubble code {
  font-family: var(--font-mono);
  background: rgba(245,166,35,0.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.typing-indicator {
  display: flex; gap: 4px; align-items: center; padding: 4px 0;
}

.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%,60%,100%{ transform: translateY(0); opacity:0.4; }
  30%{ transform: translateY(-6px); opacity:1; }
}

/* ===================== CHAT INPUT ===================== */
.chat-input-area {
  padding: 16px 24px 20px;
  flex-shrink: 0;
}

/* The magic animated border box */
.chatbox-wrapper {
  position: relative;
  border-radius: 16px;
  padding: 2px;
  background: var(--bg2);
  isolation: isolate;
}

.chatbox-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(var(--angle, 0deg), 
    var(--gold), var(--orange), var(--red), 
    transparent, transparent,
    var(--gold), var(--orange), var(--red));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: rotateBorder 3s linear infinite;
  pointer-events: none;
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotateBorder {
  to { --angle: 360deg; }
}

.chatbox-inner {
  background: var(--bg2);
  border-radius: 14px;
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 110px;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  resize: none;
  min-height: 40px;
  max-height: 240px;
  line-height: 1.6;
  overflow-y: auto;
  pointer-events: all;
  cursor: text;
  align-self: center;
}

.chat-textarea::placeholder { color: var(--text-muted); }

.chat-textarea::-webkit-scrollbar { width: 3px; }
.chat-textarea::-webkit-scrollbar-thumb { background: var(--border); }

.chat-actions {
  display: flex; align-items: center; gap: 6px;
}

.chat-icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.chat-icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245,166,35,0.08);
}

.send-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  color: #111;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.send-btn:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 20px rgba(245,166,35,0.4);
  transform: scale(1.05);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.attached-file-preview {
  display: none;
  align-items: center; gap: 8px;
  background: var(--bg3);
  border: 1px solid rgba(245,166,35,0.2);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--gold);
}

.attached-file-preview.show { display: flex; }

.remove-file {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  margin-left: auto;
  padding: 0 2px;
}

.remove-file:hover { color: var(--red); }

.input-hints {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 2px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ===================== PROFILE MODAL ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
  animation: slideUp 0.3s ease;
}

.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-thumb { background: var(--border); }

.modal-header {
  padding: 24px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  
  letter-spacing: 2px;
  color: var(--text);
}

.modal-title span { color: var(--gold); }

.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--bg4); color: var(--text); }

.modal-body { padding: 0 24px 24px; }

/* Profile modal */
.profile-avatar-big {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--orange));
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #111;
  font-family: var(--font-display);
  margin: 0 auto 16px;
  box-shadow: 0 0 40px rgba(245,166,35,0.3);
}

.profile-name {
  text-align: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 4px;
}

.profile-email {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 26px;
  
  color: var(--gold);
  letter-spacing: 1px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.profile-logout-btn {
  width: 100%;
  padding: 11px;
  background: rgba(204,61,26,0.1);
  border: 1px solid rgba(204,61,26,0.3);
  border-radius: 8px;
  color: #ff6b4a;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.profile-logout-btn:hover {
  background: rgba(204,61,26,0.2);
}

/* Settings modal */
.settings-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 0 -0px 20px;
  gap: 0;
}

.settings-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.settings-section { display: none; }
.settings-section.active { display: block; }

.settings-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 16px;
  display: block;
}

.settings-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-mono);
  margin-bottom: 4px;
  outline: none;
  transition: border-color 0.2s;
}

.settings-input:focus { border-color: var(--gold); }

.api-row {
  display: flex; gap: 8px; align-items: center;
}

.api-row .settings-input { margin-bottom: 0; }

.save-api-btn {
  padding: 10px 16px;
  background: var(--gold);
  border: none;
  border-radius: 8px;
  color: #111;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.save-api-btn:hover { background: var(--gold-light); }

.admin-gate {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.admin-gate .lock-icon { font-size: 32px; margin-bottom: 12px; display: block; }

.theme-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

/* ===================== MISC ===================== */
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(107,203,119,0.4); color: #6BCB77; }
.toast.error { border-color: rgba(204,61,26,0.4); color: #ff6b4a; }

/* File attachment hidden input */
#file-input { display: none; }

/* Scrollbar for messages */
.messages-view { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* ================================================================
   MODAL ANIMATED BORDER — conic gradient on wrapper bg
   The wrapper's background IS the spinning gradient border.
   Inner .modal-card covers it leaving only 2px visible edge.
   ================================================================ */

@property --mangle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes modalSpin {
  to { --mangle: 360deg; }
}

.modal-border-wrap {
  position: relative;
  border-radius: 18px;
  padding: 2px;
  width: 400px;
  display: flex;
  flex-direction: column;
  background: conic-gradient(
    from var(--mangle, 0deg),
    #f5ca0b  0%,
    #E8741A 18%,
    #CC3D1A 28%,
    #161616 36%,
    #161616 64%,
    #CC3D1A 72%,
    #E8741A 84%,
    #f5ca0b 100%
  );
  animation: modalSpin 2.8s linear infinite, slideUp 0.3s ease;
  /* No overflow here — card handles it */
}

.modal-border-wrap--wide {
  width: 484px;
}

.modal-border-wrap > .modal-card {
  border-radius: 16px;
  border: none;
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-sizing: border-box;
}
.modal-border-wrap > .modal-card::-webkit-scrollbar {
  display: none;
}

/* ================================================================
   GENERAL SETTINGS — Banner + grid + toggles
   ================================================================ */

/* Banner */
.gen-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(245,166,35,0.1), rgba(204,61,26,0.07));
  border: 1px solid rgba(245,166,35,0.22);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.gen-banner-logo-wrap {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 18px rgba(245,166,35,0.4);
  overflow: hidden;
  flex-shrink: 0;
}

.gen-banner-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.gen-banner-text {
  flex: 1;
}

.gen-banner-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 3px;
}

.gen-banner-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.gen-banner-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: #6BCB77;
  animation: pulseBadge 2s ease-in-out infinite;
}

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

/* 3-col info grid */
.gen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.gen-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px 10px;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  cursor: default;
}
.gen-card:hover {
  border-color: rgba(245,166,35,0.45);
  background: rgba(245,166,35,0.05);
  transform: translateY(-2px);
}

.gen-card-icon { font-size: 18px; margin-bottom: 5px; line-height: 1; }
.gen-card-key {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.gen-card-val {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold);
}

/* Section header */
.gen-section-hdr {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* Toggle row enhancements */
.toggle-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.toggle-row-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}
.toggle-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--gold);
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ===================== VOICE RECORDING ===================== */

/* Recording state — button pulses red */
.voice-record-btn.recording {
  background: rgba(204, 61, 26, 0.18);
  border-color: #CC3D1A;
  color: #ff6b4a;
  animation: voicePulse 1s ease-in-out infinite;
  position: relative;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 61, 26, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(204, 61, 26, 0); }
}

/* Waveform dots shown while recording */
.voice-record-btn.recording::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #CC3D1A;
  animation: voiceDot 1s ease-in-out infinite;
}

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

/* Recording timer pill that appears above the button */
.voice-timer {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: rgba(20, 10, 10, 0.92);
  border: 1px solid rgba(204, 61, 26, 0.5);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: #ff6b4a;
  white-space: nowrap;
  display: none;
  align-items: center;
  gap: 6px;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.voice-timer.show {
  display: flex;
}

.voice-timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6b4a;
  flex-shrink: 0;
  animation: voiceDotBlink 1s step-start infinite;
}

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

/* Audio file preview — reuses .attached-file-preview base, override icon colour */
.attached-file-preview.audio-preview .audio-icon {
  font-size: 15px;
  color: #ff9d4a;
}

/* Inline audio player in chat bubble */
.msg-audio-player {
  margin-top: 8px;
  width: 100%;
  max-width: 320px;
  height: 36px;
  border-radius: 8px;
  outline: none;
  accent-color: var(--gold);
  display: block;
}

/* Wrapper so the timer floats relative to the button */
.voice-btn-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
/* ===================== EXTRACTION PROGRESS ===================== */
.extract-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.82);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 30;
  backdrop-filter: blur(3px);
  pointer-events: all;
}

.extract-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(245,202,11,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: extractSpin 0.7s linear infinite;
}

@keyframes extractSpin {
  to { transform: rotate(360deg); }
}

.extract-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold);
}

.extract-progress {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Extracted text badge in file preview */
.extracted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6BCB77;
  background: rgba(107,203,119,0.1);
  border: 1px solid rgba(107,203,119,0.3);
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ===== AI MODE BUTTONS (AI IMG / AI VID) ===== */
.ai-mode-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 35px;
  height: 35px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.25s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.ai-mode-btn:hover {
  border-color: rgba(245,202,11,0.4);
  color: var(--gold);
  background: rgba(245,202,11,0.05);
}

.ai-mode-btn.active {
  border-color: var(--gold);
  background: rgba(245,202,11,0.1);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(245,202,11,0.25), inset 0 0 8px rgba(245,202,11,0.06);
}

.ai-mode-icon {
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s;
}

.ai-mode-btn.active .ai-mode-icon {
  transform: scale(1.15);
}

.ai-mode-label {
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1;
}

/* Animated shimmer pulse on the button when active */
.ai-mode-pulse {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, transparent 30%, rgba(245,202,11,0.18) 50%, transparent 70%);
  background-size: 200% 200%;
  animation: aiModeSweep 1.8s linear infinite;
  pointer-events: none;
}

.ai-mode-btn.active .ai-mode-pulse {
  display: block;
}

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

/* Active label flicker */
.ai-mode-btn.active .ai-mode-label {
  animation: labelFlicker 2.5s ease-in-out infinite;
}

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

/* AI IMG active — orange tint */
#ai-img-btn.active {
  border-color: #E8741A;
  background: rgba(232,116,26,0.1);
  color: #E8741A;
  box-shadow: 0 0 12px rgba(232,116,26,0.25), inset 0 0 8px rgba(232,116,26,0.06);
}
#ai-img-btn.active .ai-mode-pulse {
  background: linear-gradient(135deg, transparent 30%, rgba(232,116,26,0.18) 50%, transparent 70%);
  background-size: 200% 200%;
  animation: aiModeSweep 1.8s linear infinite;
}

/* AI VID active — purple tint */
#ai-vid-btn.active {
  border-color: #9B59B6;
  background: rgba(155,89,182,0.1);
  color: #B87FD4;
  box-shadow: 0 0 12px rgba(155,89,182,0.25), inset 0 0 8px rgba(155,89,182,0.06);
}
#ai-vid-btn.active .ai-mode-pulse {
  background: linear-gradient(135deg, transparent 30%, rgba(155,89,182,0.18) 50%, transparent 70%);
  background-size: 200% 200%;
  animation: aiModeSweep 1.8s linear infinite;
}

/* Generated image in chat */
.ai-gen-img-wrap {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 420px;
}

.ai-gen-img-wrap img {
  width: 100%;
  display: block;
  border-radius: 10px 10px 0 0;
}

.ai-gen-img-actions {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg3);
  border-top: 1px solid var(--border);
}

.ai-gen-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(245,202,11,0.08);
  border: 1px solid rgba(245,202,11,0.3);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.ai-gen-dl-btn:hover {
  background: rgba(245,202,11,0.18);
  border-color: var(--gold);
}

/* Video in chat */
.ai-gen-video-wrap {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 420px;
}

.ai-gen-video-wrap video {
  width: 100%;
  display: block;
  border-radius: 10px 10px 0 0;
  background: #000;
}

.ai-gen-video-wrap .ai-gen-img-actions {
  border-radius: 0 0 10px 10px;
}

/* Mode indicator badge near textarea */
.ai-mode-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 4px;
  border: 1px solid;
  animation: indicatorPulse 2s ease-in-out infinite;
}

.ai-mode-indicator.show { display: flex; }

.ai-mode-indicator.img-mode {
  color: #E8741A;
  border-color: rgba(232,116,26,0.4);
  background: rgba(232,116,26,0.07);
}

.ai-mode-indicator.vid-mode {
  color: #B87FD4;
  border-color: rgba(155,89,182,0.4);
  background: rgba(155,89,182,0.07);
}

@keyframes indicatorPulse {
  0%,100% { opacity:1; }
  50%      { opacity:0.6; }
}
/* ===================== TOPBAR POWERED BADGE ===================== */

.topbar {
  position: relative; /* ensure absolute child works */
}

.topbar-powered {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(calc(-50% + 130px), -50%);
  pointer-events: none;
  z-index: 10;
}
.powered-text {
  position: relative;
  overflow: hidden;

  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;

  color: #f5ca0b;
  border: 1px solid rgba(245, 202, 11, 0.25);
  background: rgba(10, 10, 10, 0.6);
  white-space: nowrap;

  animation: hamzaif-glow 3s ease-in-out infinite;
}

/* Shimmer sweep */
.powered-text::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 60%;
  height: 100%;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.4),
    transparent
  );

  transform: skewX(-25deg);
  animation: hamzaif-shimmer 4s infinite;
}

@keyframes hamzaif-shimmer {
  0%, 70% {
    left: -150%;
  }
  100% {
    left: 180%;
  }
}

@keyframes hamzaif-glow {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(245, 202, 11, 0.20),
      0 0 18px rgba(245, 202, 11, 0.10);
  }
  50% {
    box-shadow:
      0 0 12px rgba(245, 202, 11, 0.45),
      0 0 30px rgba(245, 202, 11, 0.18);
  }
}

/* ============================================================
   MOBILE RESPONSIVE — App-like layout (≤ 768px)
   PC layout is completely untouched above this block.
   ============================================================ */

/* ── Hamburger button (hidden on desktop) ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.2s;
}
.hamburger-btn:hover { border-color: var(--gold); }
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 149;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* Sidebar mobile header row */
.sidebar-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--gold);
}
.sidebar-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.sidebar-close-btn:hover { background: var(--bg4); color: var(--text); }

/* ── @media mobile ── */
@media (max-width: 768px) {

  /* Prevent double scroll on body */
  html, body { overflow: hidden; }

  /* === LOADING SCREEN — compact centered === */
  .loading-content {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .loading-logo-wrap {
    width: 90px;
    height: 90px;
  }
  .progress-ring { width: 90px; height: 90px; }
  .loading-logo-img { width: 64px; height: 64px; }
  .loading-text-block { align-items: center; }
  .loading-title {
    font-size: 40px;
    letter-spacing: 6px;
    text-align: center;
  }
  .loading-subtitle {
    font-size: 9px;
    letter-spacing: 2px;
    text-align: center;
  }

  /* === AUTH SCREEN — full screen app login === */
  #auth-screen {
    align-items: flex-end;
    padding: 0;
  }
  .auth-card {
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 28px 24px 36px;
    animation: slideUpMobile 0.4s ease, authCardBorderPulse 3s ease-in-out infinite;
    max-height: 85vh;
    overflow-y: auto;
    /* keep animated border */
  }
  @keyframes slideUpMobile {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .auth-logo { margin-bottom: 20px; }
  .auth-logo-text { font-size: 36px; letter-spacing: 3px; }
  .auth-logo-sub { font-size: 9px; letter-spacing: 3px; }
  .auth-title { font-size: 18px; margin-bottom: 4px; }
  .auth-subtitle { font-size: 12px; margin-bottom: 22px; }
  .auth-label { font-size: 9px; }
  .auth-input {
    padding: 11px 14px;
    font-size: 16px; /* prevent iOS zoom */
    margin-bottom: 14px;
  }
  .auth-btn {
    padding: 13px;
    font-size: 14px;
    margin-bottom: 14px;
  }
  .auth-switch { font-size: 12px; }

  /* === TOPBAR === */
  .topbar {
    padding: 0 12px;
    height: 52px;
    gap: 10px;
    /* stay fixed at top */
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .hamburger-btn { display: flex; }

  .topbar-logo {
    font-size: 18px;
    letter-spacing: 3px;
  }
  .topbar-logo img { width: 26px; height: 26px; }

  /* Hide "Hamzaif powered" badge on mobile — saves space */
  .topbar-powered { display: none; }

  /* Model selector — compact */
  .topbar-model-select { margin-left: auto; }
  .model-dropdown-btn {
    padding: 6px 10px;
    font-size: 11px;
    gap: 6px;
    max-width: 130px;
  }
  #current-model-name {
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
  }
  .model-chevron { font-size: 9px; }

  /* Model panel — full-width from bottom on mobile */
  .model-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 3px;
    z-index: 300;
  }
  .model-panel-inner {
    max-height: 55vh;
    border-radius: 18px 18px 0 0;
    padding: 8px 6px 20px;
  }

  /* User avatar */
  .user-avatar-btn { width: 32px; height: 32px; font-size: 12px; }

  /* === SIDEBAR — slide in drawer === */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82vw;
    max-width: 300px;
    z-index: 150;
    transform: translateX(-110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 30px rgba(0,0,0,0.6);
    display: flex !important;
    /* always rendered, just off-screen */
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-mobile-header { display: flex; }

  /* === MAIN LAYOUT === */
  .main-layout {
    flex-direction: column;
    height: calc(100vh - 52px); /* minus topbar */
  }

  /* === CHAT AREA === */
  .chat-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
    /* === WELCOME VIEW — mobile layout (no labels) === */
  .welcome-view {
    padding: 20px 16px;
    justify-content: space-between;
    min-height: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  /* Welcome content at center */
  .welcome-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .welcome-logo {
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 6px;
    margin-top: 0;
  }
  
  .welcome-sub {
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 0;
  }
  
  /* Hide ALL labels on mobile */
  .welcome-labels {
    display: none !important;
  }
  
  /* Warning text - pushed to bottom, above chat input */
  .welcome-warning {
    font-size: 10px;
    padding-top: 12px;
    margin-top: auto;
    margin-bottom: 8px;
    border-top: none;
    text-align: center;
  }

@media (max-width: 768px) {
  .welcome-logo {
    font-size: 28px;
    letter-spacing: 1px;
  }
}

  /* === MESSAGES — WhatsApp-style === */
  .messages-view {
    padding: 12px 0 8px;
  }
  .message-row {
    padding: 4px 12px;
    gap: 8px;
  }
  /* Avatars — smaller on mobile */
  .msg-avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
  /* Bubbles — wider, WhatsApp feel */
  .msg-bubble {
    max-width: 82%;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.55;
    border-radius: 16px;
  }
  .msg-bubble.user {
    border-top-right-radius: 4px;
  }
  .msg-bubble.ai {
    border-top-left-radius: 4px;
  }
  .msg-bubble .model-tag {
    font-size: 8px;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
  }
  .msg-bubble pre {
    font-size: 11px;
    padding: 10px;
  }
  .msg-bubble code { font-size: 11px; }

  /* Typing indicator */
  .typing-dot { width: 5px; height: 5px; }

  /* === CHAT INPUT AREA — WhatsApp style === */
  .chat-input-area {
    padding: 8px 10px 12px;
    flex-shrink: 0;
  }

  /* Animated border wrapper — keep it, just tighter corners */
  .chatbox-wrapper {
    border-radius: 28px;
    padding: 2px;
  }
  .chatbox-wrapper::before {
    border-radius: 28px;
  }

  /* Inner container — single-line pill like WhatsApp */
  .chatbox-inner {
    border-radius: 26px;
    padding: 6px 6px 6px 14px;
    min-height: unset;
    gap: 6px;
    align-items: center;
    flex-direction: row;
  }

  /* Textarea — inline, single-line feel */
  .chat-textarea {
    font-size: 14px; /* no iOS zoom */
    min-height: 36px;
    max-height: 120px;
    line-height: 1.5;
    padding: 0;
    align-self: center;
  }

  /* Actions row — all icons in a tight row */
  .chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  /* Icon buttons — smaller */
  .chat-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 15px;
    flex-shrink: 0;
  }

  /* AI mode buttons */
  .ai-mode-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .ai-mode-icon { font-size: 14px; }
  .ai-mode-label { display: none; } /* hide label on mobile, icon is enough */

  /* Send button — round like WhatsApp */
  .send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 15px;
    flex-shrink: 0;
  }

  /* File preview row */
  .attached-file-preview {
    font-size: 11px;
    padding: 5px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
  }

  /* AI mode indicator */
  .ai-mode-indicator {
    font-size: 8px;
    padding: 3px 8px;
    margin-bottom: 4px;
  }

  /* Voice timer */
  .voice-timer {
    bottom: calc(100% + 6px);
    font-size: 10px;
    padding: 3px 10px;
  }

  /* === MODALS — full bottom sheet on mobile === */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-border-wrap,
  .modal-border-wrap--wide {
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 2px 2px 0;
    /* keep animated spin */
    animation: modalSpin 2.8s linear infinite, slideUpMobile 0.35s ease;
  }
  .modal-border-wrap > .modal-card {
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 88vh;
    padding-bottom: 24px;
  }
  /* Standalone modal-card (no border-wrap) */
  .modal-card {
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    animation: slideUpMobile 0.35s ease;
  }
  .modal-header {
    padding: 18px 18px 0;
    margin-bottom: 16px;
  }
  .modal-title { font-size: 18px; }
  .modal-body { padding: 0 18px 20px; }

  /* Profile modal adjustments */
  .profile-avatar-big { width: 68px; height: 68px; font-size: 28px; }
  .profile-stats { gap: 8px; }
  .stat-card { padding: 10px 8px; }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 8px; }

  /* ===== SETTINGS MODAL — fully contained, no overflow ===== */

  /* Force the overlay to use safe inset + no side overflow */
  #settings-modal.modal-overlay {
    padding: 0;
    align-items: flex-end;
    overflow: hidden;
  }

  /* Border wrapper: full width, clips to screen */
  #settings-modal .modal-border-wrap,
  #settings-modal .modal-border-wrap--wide {
    width: 100vw;
    max-width: 100vw;
    border-radius: 18px 18px 0 0;
    padding: 2px 2px 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Inner card: flex column so body scrolls */
  #settings-modal .modal-border-wrap > .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 75vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    box-sizing: border-box;
  }

  /* Header — tight */
  #settings-modal .modal-header {
    padding: 10px 14px 0;
    margin-bottom: 8px;
    flex-shrink: 0;
  }
  #settings-modal .modal-title {
    font-size: 13px;
    letter-spacing: 2px;
  }
  #settings-modal .modal-close {
    font-size: 12px;
    width: 22px;
    height: 22px;
  }

  /* Scrollable body — contains everything */
  #settings-modal .modal-body {
    padding: 0 10px 14px;
    overflow-y: auto;
    overflow-x: hidden;   /* ← THIS kills horizontal overflow */
    flex: 1;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    width: 100%;
  }

  /* Tab bar */
  .settings-tab-bar {
    gap: 0;
    margin-bottom: 8px;
  }
  .settings-tab {
    padding: 6px 12px;
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  /* ── Banner strip ── */
  .gen-banner {
    padding: 7px 8px;
    gap: 8px;
    margin-bottom: 8px;
    border-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }
  .gen-banner-logo-wrap { width: 30px; height: 30px; flex-shrink: 0; }
  .gen-banner-img       { width: 30px; height: 30px; }
  .gen-banner-title     { font-size: 12px; letter-spacing: 1px; }
  .gen-banner-sub       { font-size: 8px;  margin-top: 1px; }
  /* Kill "Powered by Hamzaif" line — it causes overflow */
  .gen-banner-text > div[style] { display: none !important; }

  /* ── Info grid: 3-col, constrained ── */
  .gen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .gen-card {
    padding: 6px 2px 5px;
    border-radius: 6px;
    min-width: 0;          /* ← prevents grid cell from expanding */
    overflow: hidden;
  }
  .gen-card-icon { font-size: 12px; margin-bottom: 2px; }
  .gen-card-key  {
    font-size: 7px;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .gen-card-val  {
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Preferences ── */
  .gen-section-hdr { font-size: 9px; letter-spacing: 1px; margin: 7px 0 4px; padding-bottom: 4px; }
  .theme-toggle-row { padding: 6px 0; }
  .toggle-row-left  { font-size: 11px; gap: 6px; }
  .toggle-row-icon  { font-size: 12px; }
  .toggle-badge     { font-size: 8px; padding: 2px 6px; letter-spacing: 0.5px; }

  /* ── API Keys tab ── */
  #settings-apis {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .settings-label {
    font-size: 8px;
    letter-spacing: 0.8px;
    margin-bottom: 3px;
    margin-top: 8px;
    display: block;
  }
  .settings-input {
    font-size: 13px;    /* ≥13 prevents iOS zoom */
    padding: 6px 8px;
    margin-bottom: 0;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }
  .api-row {
    display: flex;
    gap: 5px;
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
  }
  .api-row .settings-input { flex: 1; min-width: 0; }
  .save-api-btn {
    padding: 6px 10px;
    font-size: 9px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.5px;
  }
  /* Free providers label */
  #settings-apis div[style*="margin:18px"] {
    margin: 6px 0 3px !important;
    font-size: 9px !important;
  }
  /* Admin gate */
  .admin-gate p  { font-size: 11px; }
  .lock-icon     { font-size: 20px; }

  /* === TOAST — bottom center, above input === */
  .toast {
    bottom: 80px;
    font-size: 12px;
    padding: 10px 16px;
    max-width: 85vw;
    text-align: center;
  }

  /* === AI generated image/video — full width === */
  .ai-gen-img-wrap,
  .ai-gen-video-wrap {
    max-width: 100%;
  }

  /* === Bubble popup menu — larger tap targets === */
  .bubble-popup-item {
    padding: 11px 14px;
    font-size: 14px;
  }

  /* === Extraction overlay === */
  .extract-overlay { border-radius: 26px; }

  /* === Input hints (hide on mobile — too cramped) === */
  .input-hints { display: none; }

  /* === Conv delete btn — always visible on mobile (no hover) === */
  .conv-del-btn { display: flex !important; }

  /* === Model panel drop-down backdrop (close on tap outside) === */
  .model-panel.open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
  }

} /* end @media (max-width: 768px) */

/* ── Very small phones (≤ 380px) ── */
@media (max-width: 380px) {
  .model-dropdown-btn { max-width: 100px; }
  #current-model-name { max-width: 65px; }
  .topbar-logo { font-size: 16px; letter-spacing: 2px; }
  .msg-bubble { max-width: 88%; font-size: 13px; }
  .chatbox-inner { padding: 5px 5px 5px 12px; }
  .chat-icon-btn, .ai-mode-btn { width: 29px; height: 29px; font-size: 13px; }
  .send-btn { width: 33px; height: 33px; font-size: 14px; }
}
/* ── Autopilot toggle active state ── */
#autopilot-toggle.active {
  background: rgba(76, 175, 80, 0.08);
  border-color: rgba(76, 175, 80, 0.3);
}
#autopilot-toggle.active #autopilot-badge {
  color: #4caf50 !important;
  border-color: rgba(76, 175, 80, 0.4) !important;
  background: rgba(76, 175, 80, 0.1);
}

/* ── Message content paragraph spacing fix ── */
.msg-content p {
  margin: 0;
  line-height: 1.6;
}
.msg-content p + p {
  margin-top: 6px;
}





/* ============================================
   CODE BLOCK STYLES - Copy & Download Buttons
   ============================================ */

.code-block-wrapper {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1117;
  border: 1px solid #30363d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-wrap: wrap;
  gap: 10px;
}

.code-lang {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 600;
  color: #f5ca0b;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: rgba(245, 202, 11, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

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

.copy-code-btn, .download-code-btn {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #c9d1d9;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copy-code-btn:hover, .download-code-btn:hover {
  background: #30363d;
  border-color: #f5ca0b;
  color: #f5ca0b;
  transform: translateY(-1px);
}

.copy-code-btn:active, .download-code-btn:active {
  transform: translateY(0);
}

.code-block-wrapper pre {
  margin: 0 !important;
  padding: 16px !important;
  overflow-x: auto;
  background: #0d1117;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  line-height: 1.6;
}

.code-block-wrapper code {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  line-height: 1.6;
  color: #e6edf3;
  background: transparent !important;
  padding: 0 !important;
  white-space: pre;
  tab-size: 2;
}

/* Syntax highlighting colors */
.code-block-wrapper code .keyword {
  color: #ff7b72;
}

.code-block-wrapper code .string {
  color: #a5d6ff;
}

.code-block-wrapper code .comment {
  color: #8b949e;
  font-style: italic;
}

.code-block-wrapper code .function {
  color: #d2a8ff;
}

.code-block-wrapper code .number {
  color: #79c0ff;
}

.code-block-wrapper code .operator {
  color: #ff7b72;
}

.code-block-wrapper code .punctuation {
  color: #e6edf3;
}

.code-block-wrapper code .property {
  color: #79c0ff;
}

.code-block-wrapper code .tag {
  color: #7ee787;
}

.code-block-wrapper code .attribute {
  color: #ffa657;
}

/* Scrollbar styling for code blocks */
.code-block-wrapper pre::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.code-block-wrapper pre::-webkit-scrollbar-track {
  background: #161b22;
  border-radius: 3px;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb:hover {
  background: #f5ca0b;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .code-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }
  
  .code-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .copy-code-btn, .download-code-btn {
    padding: 6px 12px;
    font-size: 10px;
  }
  
  .code-block-wrapper pre {
    padding: 12px !important;
  }
  
  .code-block-wrapper code {
    font-size: 12px;
    line-height: 1.5;
  }
  
  .code-lang {
    font-size: 10px;
  }
}

/* Dark theme overrides for better readability */
@media (prefers-color-scheme: dark) {
  .code-block-wrapper {
    background: #0a0c10;
    border-color: #2d2d2d;
  }
  
  .code-header {
    background: #111317;
    border-bottom-color: #2d2d2d;
  }
  
  .copy-code-btn, .download-code-btn {
    background: #1a1d24;
    border-color: #2d2d2d;
    color: #b4b4b4;
  }
  
  .code-block-wrapper pre {
    background: #0a0c10;
  }
}

/* Animation for copy/download feedback */
@keyframes btnPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.copy-code-btn:active, .download-code-btn:active {
  animation: btnPulse 0.2s ease;
}

/* Code block wrapper inside message bubbles */
.msg-bubble .code-block-wrapper {
  margin: 12px 0;
  max-width: 100%;
  overflow-x: auto;
}

/* Inline code styling */
.msg-content code:not(pre code) {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.9em;
  padding: 2px 6px;
  background: rgba(245, 202, 11, 0.15);
  border-radius: 4px;
  color: #f5ca0b;
  white-space: nowrap;
}

/* Pre element styling */
.msg-content pre {
  margin: 0;
  border-radius: 0 0 12px 12px;
}

/* Line numbers (optional - add if needed) */
.code-block-wrapper pre code {
  counter-reset: line;
}

.code-block-wrapper pre code .line {
  display: block;
  counter-increment: line;
}

.code-block-wrapper pre code .line::before {
  content: counter(line);
  display: inline-block;
  width: 2em;
  padding-right: 1em;
  text-align: right;
  color: #8b949e;
  user-select: none;
}

/* Success state for buttons */
.copy-code-btn.success, .download-code-btn.success {
  background: #238636;
  border-color: #2ea043;
  color: white;
}

/* Tooltip for buttons (optional) */
.copy-code-btn, .download-code-btn {
  position: relative;
}

.copy-code-btn::before, .download-code-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: #21262d;
  color: #e6edf3;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 8px;
}

.copy-code-btn:hover::before, .download-code-btn:hover::before {
  opacity: 1;
}