/* =========================================================
   EklavyaX — GRAVITY AI TUTOR
   ChatGPT & Gemini-Inspired Conversational UI
   Chalkboard / Dark Glassmorphic Modern Aesthetic
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Work+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --board: #162c22;
  --board-dark: #0c1813;
  --board-surface: rgba(18, 38, 29, 0.75);
  --board-border: rgba(245, 240, 226, 0.12);
  --chalk: #f5f0e2;
  --chalk-dim: #9eb2a3;
  --marigold: #eeb43e;
  --marigold-glow: rgba(238, 180, 62, 0.35);
  --terracotta: #d97a5c;
  --gemini-cyan: #38bdf8;
  --gemini-purple: #a855f7;
  --gemini-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  --paper: #f3ead4;
  --paper-soft: #eae0c8;
  --ink: #1a2b3c;
  --success: #22c55e;
  --font-hand: 'Kalam', cursive;
  --font-body: 'Work Sans', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(56, 189, 248, 0.06), transparent 60%),
    radial-gradient(900px 600px at 90% 100%, rgba(238, 180, 62, 0.04), transparent 60%),
    linear-gradient(135deg, #091510 0%, #11241c 50%, #08130e 100%);
  color: var(--chalk);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 95%);
}

.container {
  display: flex;
  min-height: 100vh;
}

/* Hide floating global chatbot widget specifically on Gravity AI page to avoid overlap */
#chatbot-container,
#chatbot-toggle,
.chatbot-widget,
#chatbot-bubble,
.chatbot-toggle-btn {
  display: none !important;
}

/* =========================================================
   SIDEBAR (Platform Nav)
   ========================================================= */
.sidebar,
aside.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: 240px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0e1c15 0%, #08130e 100%);
  border-right: 1.5px dashed rgba(245, 240, 226, 0.15);
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

aside .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 18px;
}

.logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--marigold);
}

nav.menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  overflow-y: auto;
}

nav.menu a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 12px;
  color: var(--chalk-dim);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

nav.menu a i {
  width: 20px;
  text-align: center;
  font-size: 1.05rem;
}

nav.menu a:hover {
  background: rgba(245, 240, 226, 0.07);
  color: var(--chalk);
  transform: translateX(4px);
}

nav.menu a.active {
  background: linear-gradient(135deg, var(--paper) 0%, var(--paper-soft) 100%);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

nav.menu a.active i {
  color: var(--terracotta);
}

aside .profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 12px 18px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(245, 240, 226, 0.18);
  border-radius: 14px;
  color: var(--chalk);
  cursor: pointer;
}

aside .profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--marigold);
  background: var(--paper);
}

aside .profile .profile-info strong {
  display: block;
  font-family: var(--font-hand);
  font-size: 1.02rem;
  color: var(--chalk);
}

aside .profile .profile-info span {
  font-size: 0.76rem;
  color: var(--terracotta);
  font-weight: 600;
}

/* =========================================================
   MAIN CHAT APPLICATION WORKSPACE
   ========================================================= */
.content {
  flex-grow: 1;
  min-width: 0;
  height: 100vh;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Top App Header */
.ai-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(14, 28, 21, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--board-border);
  z-index: 20;
  flex-shrink: 0;
  gap: 12px;
}

.ai-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ai-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #e0f2fe;
}

.top-gravity-logo-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.ai-model-pill .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-glow 2s infinite ease-in-out;
}

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

.ai-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.ai-balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(238, 180, 62, 0.2), rgba(217, 122, 92, 0.2));
  border: 1px solid rgba(238, 180, 62, 0.35);
  color: var(--marigold);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.new-chat-btn,
.history-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(245, 240, 226, 0.08);
  border: 1px solid var(--board-border);
  color: var(--chalk);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.new-chat-btn:hover,
.history-toggle-btn:hover {
  background: rgba(245, 240, 226, 0.16);
  color: #ffffff;
  border-color: rgba(245, 240, 226, 0.25);
  transform: translateY(-1px);
}

/* Chat Main Layout Split */
.chat-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Chat Scrollable Thread */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  position: relative;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 160px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

/* Custom Scrollbars */
.chat-messages-container::-webkit-scrollbar,
.history-sidebar-content::-webkit-scrollbar {
  width: 6px;
}
.chat-messages-container::-webkit-scrollbar-thumb,
.history-sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(245, 240, 226, 0.15);
  border-radius: 4px;
}

/* =========================================================
   WELCOME / HERO STATE (ChatGPT & Gemini Style)
   ========================================================= */
.chat-welcome-state {
  max-width: 780px;
  margin: auto;
  text-align: center;
  padding: 30px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-gravity-logo-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-gravity-logo {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  object-fit: cover;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.4), 0 0 25px rgba(168, 85, 247, 0.3);
  animation: float-logo 3.5s infinite ease-in-out;
}

.gravity-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 26px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(168, 85, 247, 0.2) 60%, transparent 80%);
  animation: pulse-ring 2.8s infinite ease-in-out;
  z-index: 1;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.welcome-title {
  font-family: var(--font-hand);
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  font-weight: 700;
  color: var(--chalk);
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, var(--marigold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  color: var(--chalk-dim);
  font-size: 1rem;
  max-width: 580px;
  line-height: 1.5;
  margin-bottom: 32px;
}

/* Suggestion Cards Grid */
.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.suggestion-card {
  text-align: left;
  padding: 16px 18px;
  background: rgba(18, 38, 29, 0.6);
  border: 1px solid rgba(245, 240, 226, 0.12);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.suggestion-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gemini-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.suggestion-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(24, 48, 37, 0.85);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.suggestion-card:hover::before {
  opacity: 0.05;
}

.suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--marigold);
}

.suggestion-prompt {
  font-size: 0.82rem;
  color: var(--chalk-dim);
  line-height: 1.4;
}

/* =========================================================
   CHAT MESSAGE BUBBLES
   ========================================================= */
.chat-message-row {
  display: flex;
  gap: 14px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  animation: fadeInMsg 0.3s ease;
}

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

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

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  overflow: hidden;
}

.chat-message-row.user .msg-avatar {
  background: linear-gradient(135deg, var(--marigold), var(--terracotta));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(217, 122, 92, 0.3);
}

.chat-message-row.ai .msg-avatar {
  background: #091510;
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
}

.chat-gravity-logo-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-body-wrapper {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 54px);
}

.chat-message-row.user .msg-body-wrapper {
  align-items: flex-end;
}

.msg-bubble {
  border-radius: 18px;
  padding: 16px 20px;
  font-size: 0.95rem;
  line-height: 1.65;
  position: relative;
  word-break: break-word;
}

/* User Bubble */
.chat-message-row.user .msg-bubble {
  background: linear-gradient(145deg, #1c3d2e, #142e22);
  border: 1px solid rgba(238, 180, 62, 0.25);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* AI Bubble */
.chat-message-row.ai .msg-bubble {
  background: rgba(14, 30, 23, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 240, 226, 0.12);
  border-bottom-left-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  color: var(--chalk);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--chalk-dim);
  margin-top: 6px;
  padding: 0 4px;
}

/* Rich Content in AI Response */
.ai-text-content strong {
  color: #ffffff;
  font-weight: 700;
}

.ai-text-content h3, 
.ai-text-content h4, 
.ai-text-content h5 {
  font-family: var(--font-hand);
  color: var(--marigold);
  margin: 16px 0 6px 0;
}

.ai-text-content h3 { font-size: 1.3rem; }
.ai-text-content h4 { font-size: 1.15rem; }
.ai-text-content h5 { font-size: 1.02rem; }

.ai-text-content .list-item-bullet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
  padding-left: 6px;
}

.ai-text-content .list-bullet-icon {
  color: var(--marigold);
  font-size: 0.85rem;
  margin-top: 4px;
}

.ai-text-content .list-item-numbered {
  margin: 10px 0 6px;
  font-weight: 600;
}

.ai-text-content .num-badge {
  color: var(--marigold);
  font-weight: 800;
  margin-right: 6px;
}

/* Math rendering with KaTeX */
.ai-text-content .katex {
  color: #f7e8cb;
  font-size: 1.05em;
}

.ai-text-content .katex-display {
  margin: 14px 0;
  padding: 12px 18px;
  background: rgba(238, 180, 62, 0.07);
  border-left: 3.5px solid var(--marigold);
  border-radius: 0 12px 12px 0;
  overflow-x: auto;
}

.ai-text-content .katex-display > .katex {
  color: #eeb43e;
  font-size: 1.15em;
}

/* Code Blocks */
.ai-code-block {
  margin: 14px 0;
  border-radius: 12px;
  background: #08110d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--chalk-dim);
}

.code-copy-btn {
  background: transparent;
  border: none;
  color: var(--chalk-dim);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.code-copy-btn:hover {
  color: var(--chalk);
}

.ai-code-block pre {
  padding: 14px;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #a5f3fc;
  overflow-x: auto;
}

/* AI Action Toolbar on Bubble */
.msg-actions-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(245, 240, 226, 0.12);
}

.action-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 240, 226, 0.12);
  color: var(--chalk-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--chalk);
  border-color: rgba(245, 240, 226, 0.25);
}

.action-chip-btn.refund-btn {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.25));
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
  font-weight: 700;
}

.action-chip-btn.refund-btn:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.35), rgba(16, 185, 129, 0.4));
  color: #ffffff;
  transform: translateY(-1px);
}

.action-chip-btn.refunded {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
  cursor: default;
}

/* =========================================================
   GENERATING / THINKING ANIMATION (Gemini Style)
   ========================================================= */
.typing-indicator-row {
  display: flex;
  gap: 14px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(14, 30, 23, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.gemini-wave-bar {
  display: flex;
  gap: 5px;
  align-items: center;
}

.wave-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gemini-cyan);
  animation: wave-bounce 1.4s infinite ease-in-out;
}

.wave-dot:nth-child(1) { animation-delay: -0.32s; }
.wave-dot:nth-child(2) { animation-delay: -0.16s; background: var(--gemini-purple); }
.wave-dot:nth-child(3) { animation-delay: 0s; background: var(--marigold); }

@keyframes wave-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}

.typing-text {
  font-size: 0.84rem;
  color: #7dd3fc;
  font-weight: 500;
}

/* =========================================================
   CHATGPT / GEMINI STYLE FLOATING BOTTOM INPUT BAR
   ========================================================= */
.chat-input-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px 20px;
  background: linear-gradient(to top, rgba(9, 21, 16, 0.96) 75%, transparent 100%);
  pointer-events: none;
  z-index: 30;
}

.chat-input-box {
  pointer-events: auto;
  max-width: 860px;
  margin: 0 auto;
  background: rgba(18, 38, 29, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid rgba(245, 240, 226, 0.2);
  border-radius: 24px;
  padding: 10px 14px 10px 18px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.chat-input-box:focus-within {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.chat-input-main {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 0.96rem;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  padding: 6px 0;
}

.chat-textarea::placeholder {
  color: rgba(245, 240, 226, 0.45);
}

.chat-visual-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(245, 240, 226, 0.18);
  border-radius: 12px;
  color: var(--chalk);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  flex-shrink: 0;
}

.visual-doubt-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-visual-btn span {
  display: none;
  margin-left: 5px;
  font-family: var(--font-body);
  font-size: 0.72rem;
}

@media (max-width: 600px) {
  .chat-visual-btn span {
    display: inline;
  }
}

.chat-visual-btn:hover,
.chat-visual-btn.has-image {
  color: var(--marigold);
  border-color: var(--marigold);
  background: rgba(244, 174, 37, 0.18);
}

.visual-doubt-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-top: 1px solid rgba(245, 240, 226, 0.12);
  color: var(--chalk);
  font-size: 0.75rem;
}

.visual-doubt-preview[hidden] {
  display: none;
}

.visual-doubt-preview img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(245, 240, 226, 0.22);
}

.visual-doubt-preview div {
  display: grid;
  gap: 3px;
  flex: 1;
}

.visual-doubt-preview span {
  color: var(--chalk-dim);
}

.visual-doubt-preview button {
  border: 0;
  color: var(--chalk-dim);
  background: transparent;
  cursor: pointer;
}

.user-visual-attachment img {
  display: block;
  width: min(280px, 100%);
  max-height: 240px;
  margin-bottom: 8px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
}

.visual-instruction {
  color: inherit;
  white-space: pre-wrap;
}

.chat-input-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-select-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 240, 226, 0.15);
  color: var(--chalk);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-select-pill:focus,
.lang-select-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--marigold);
}

.lang-select-pill option {
  background: #0f2018;
  color: #ffffff;
}

.chat-voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(245, 240, 226, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--chalk);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  position: relative;
}

.chat-voice-btn:hover:not(:disabled) {
  background: rgba(244, 174, 37, 0.18);
  border-color: var(--marigold);
  color: var(--marigold);
  transform: scale(1.06);
}

.chat-voice-btn.listening {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  border-color: #f87171 !important;
  animation: pulse-voice 1.5s infinite;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.65);
}

.chat-voice-btn.processing {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
}

@keyframes pulse-voice {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: none;
  background: var(--gemini-gradient);
  color: #ffffff;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

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

.chat-input-footer-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--chalk-dim);
  margin-top: 4px;
}

/* =========================================================
   RECENT SESSIONS SLIDE-IN DRAWER & BACKDROP
   CLOSED BY DEFAULT on both desktop and mobile!
   ========================================================= */
.history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 85vw;
  background: rgba(13, 26, 19, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1.5px solid var(--board-border);
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 90;
}

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

.history-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--board-border);
  gap: 10px;
}

.history-drawer-header h3 {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--marigold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-clear-btn {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-clear-btn:hover {
  background: rgba(248, 113, 113, 0.25);
}

.history-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--board-border);
  color: var(--chalk);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.history-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card-item {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(245, 240, 226, 0.08);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-card-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateX(-3px);
}

.history-card-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--chalk);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.history-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--chalk-dim);
}

/* =========================================================
   RESPONSIVE DESIGN (PHONES: <= 768px)
   ========================================================= */
@media (max-width: 900px) {
  .suggestions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sidebar,
  aside.sidebar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    display: block !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 1.5px dashed rgba(245, 240, 226, 0.15) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
  }

  aside .logo {
    padding: 10px 14px 6px !important;
  }

  nav.menu {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 6px !important;
    padding: 4px 10px 8px !important;
    flex: none !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  nav.menu::-webkit-scrollbar {
    display: none !important;
  }

  nav.menu a {
    width: auto !important;
    min-width: max-content !important;
    padding: 6px 11px !important;
    gap: 6px !important;
    font-size: 0.74rem !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  aside .profile {
    display: none !important;
  }

  .content {
    margin-left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 95px) !important;
  }

  .ai-top-bar {
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  .ai-model-pill {
    padding: 4px 8px !important;
    font-size: 0.74rem !important;
  }

  .top-gravity-logo-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .ai-balance-chip {
    padding: 4px 8px !important;
    font-size: 0.74rem !important;
  }

  .new-chat-btn,
  .history-toggle-btn {
    padding: 5px 9px !important;
    font-size: 0.74rem !important;
  }

  .new-chat-btn span,
  .history-toggle-btn span {
    display: none !important;
  }

  .chat-messages-container {
    padding: 12px 10px 145px !important;
    gap: 16px !important;
  }

  .chat-input-wrapper {
    padding: 8px 10px 12px !important;
  }

  .chat-input-box {
    padding: 8px 10px !important;
    border-radius: 18px !important;
  }

  .chat-textarea {
    font-size: 0.88rem !important;
  }

  .lang-select-pill {
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
  }

  .chat-send-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .msg-bubble {
    padding: 12px 14px !important;
    font-size: 0.88rem !important;
  }

  .msg-avatar {
    width: 32px !important;
    height: 32px !important;
  }

  .welcome-title {
    font-size: 1.45rem !important;
  }

  .welcome-gravity-logo {
    width: 60px !important;
    height: 60px !important;
  }

  .welcome-gravity-logo-wrap {
    width: 64px !important;
    height: 64px !important;
    margin-bottom: 14px !important;
  }

  .suggestion-card {
    padding: 12px 14px !important;
  }

  .history-drawer {
    width: 300px !important;
    max-width: 90vw !important;
  }
}
