/* =====================================================================
   Tadashi Gemini-Style AI Platform Styles
   Modern Web Standards & Accessible Dark Theme
   ===================================================================== */

:root {
  color-scheme: dark;

  /* Google Gemini Dark Color Palette */
  --bg-primary: #131314;
  --bg-secondary: #1e1f20;
  --bg-tertiary: #282a2c;
  --bg-hover: #333538;
  --border-subtle: #2d2f31;
  --border-focus: #4b4f53;

  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;

  /* Google Gemini Gradient & Accents */
  --gemini-blue: #4285f4;
  --gemini-purple: #9b72cf;
  --gemini-pink: #d96570;
  --gemini-gradient: linear-gradient(135deg, #7aa2f7 0%, #b794f4 50%, #f687b3 100%);
  --gemini-glow: rgba(122, 162, 247, 0.15);

  --accent-green: #34a853;
  --accent-yellow: #fbbc04;
  --accent-red: #ea4335;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  --font-main: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, monospace;

  /* Scrollbar */
  scrollbar-color: var(--border-focus) transparent;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
  z-index: 50;
}

.sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
  overflow: hidden;
  border-right: none;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.new-chat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.new-chat-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}

.sidebar-section {
  padding: 12px 16px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.site-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s;
}

.site-card:hover {
  border-color: var(--gemini-blue);
}

.site-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--text-muted);
}

.site-dot.active {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 168, 83, 0.6);
}

.site-info {
  flex: 1;
}

.site-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.site-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.badge.live {
  font-size: 10px;
  font-weight: 700;
  background-color: rgba(52, 168, 83, 0.2);
  color: var(--accent-green);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.history-section {
  flex: 1;
  overflow-y: auto;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}

.history-item:hover, .history-item.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.plugin-download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: rgba(66, 133, 244, 0.12);
  border: 1px solid rgba(66, 133, 244, 0.3);
  border-radius: var(--radius-sm);
  color: #7aa2f7;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.plugin-download-btn:hover {
  background-color: rgba(66, 133, 244, 0.22);
  border-color: #7aa2f7;
  color: #fff;
}

.safety-shield, .engine-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(52, 168, 83, 0.6);
}

.status-indicator.offline {
  background-color: var(--accent-red);
  box-shadow: 0 0 6px rgba(234, 67, 53, 0.6);
}

/* Main Workspace */
.main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Top Navigation */
.top-nav {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-primary);
  z-index: 10;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-toggle {
  display: none;
}

.model-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}

.gemini-sparkle {
  color: #7aa2f7;
  font-size: 16px;
  animation: pulse-glow 2s infinite ease-in-out;
}

.model-name {
  color: var(--text-primary);
  font-weight: 600;
}

.model-tag {
  color: var(--text-muted);
  font-size: 11px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 8px;
}

.nav-link-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Welcome Screen */
.welcome-screen {
  max-width: 800px;
  width: 100%;
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.sparkle-hero {
  width: 56px;
  height: 56px;
  fill: url(#heroGradient);
  filter: drop-shadow(0 0 16px rgba(122, 162, 247, 0.4));
  margin-bottom: 8px;
}

.welcome-avatar {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  background-clip: text;
}

.welcome-title {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--gemini-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 620px;
  line-height: 1.6;
}

/* Quick Cards Grid */
.quick-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 24px;
  width: 100%;
  max-width: 740px;
}

.quick-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  background-color: var(--bg-tertiary);
}

.card-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Messages List */
.messages-list {
  max-width: 820px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.message-avatar.ai {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.2), rgba(155, 114, 207, 0.2));
  color: #7aa2f7;
}

.message-bubble {
  max-width: 90%;
  line-height: 1.65;
  font-size: 15px;
}

.message-row.user .message-bubble {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: 20px 20px 4px 20px;
  color: var(--text-primary);
}

.message-row.ai .message-bubble {
  flex: 1;
  color: var(--text-primary);
}

/* Markdown styling in AI replies */
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: #fff;
}

.message-bubble p {
  margin-bottom: 12px;
}

.message-bubble ul, .message-bubble ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble strong {
  color: #fff;
  font-weight: 600;
}

.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.message-bubble th, .message-bubble td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.message-bubble th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
}

.message-bubble pre {
  background-color: #0d0e0f;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 14px 0;
}

.message-bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
}

.message-bubble pre code {
  background: none;
  padding: 0;
}

/* Thinking Indicator */
.thinking-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.shimmer-dots {
  display: flex;
  gap: 4px;
}

.shimmer-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: #7aa2f7;
  animation: bounce-dot 1.4s infinite ease-in-out both;
}

.shimmer-dot:nth-child(1) { animation-delay: -0.32s; }
.shimmer-dot:nth-child(2) { animation-delay: -0.16s; }

/* Prompt Input Bar */
.prompt-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 20px 18px;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, transparent 0%, var(--bg-primary) 35%);
  z-index: 20;
}

.prompt-card {
  max-width: 820px;
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 8px 16px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(122, 162, 247, 0.25);
}

.prompt-top-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  overflow-x: auto;
}

.pill-chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pill-chip:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--accent-green);
}

.prompt-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#prompt-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 160px;
  min-height: 24px;
  padding: 6px 0;
}

#prompt-input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gemini-gradient);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(122, 162, 247, 0.4);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.prompt-footer-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.prompt-footer-note strong {
  color: var(--text-secondary);
}

/* Animations */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 4px #7aa2f7); }
}

@keyframes bounce-dot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: flex;
  }
  .quick-cards-grid {
    grid-template-columns: 1fr;
  }
  .welcome-title {
    font-size: 28px;
  }
}
