:root {
  --bg-color: #131314;
  --panel-bg: #1e1f20;
  --text-primary: #e3e3e3;
  --text-secondary: #c4c7c5;
  --text-muted: #8e918f;
  --accent-blue: #a8c7fa;
  --accent-purple: #d3e3fd;
  --surface-hover: #333537;
  --border-color: #444746;
  --input-bg: #1e1f20;
  --terminal-bg: #0f1011;
  --terminal-text: #00ff41;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Icons */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: var(--text-secondary);
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.icon-btn:hover {
  background-color: var(--surface-hover);
}

.icon-btn:hover .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--panel-bg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid var(--border-color);
}

.sidebar-header {
  margin-bottom: 24px;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--surface-hover);
  border: none;
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  width: fit-content;
  margin-bottom: 24px;
}

.new-chat-btn:hover {
  background-color: #444746;
}

.new-chat-btn .material-symbols-outlined {
  color: var(--text-primary);
}

.recent-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0 12px;
  margin-bottom: 4px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 24px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
  color: var(--text-secondary);
}

.recent-item:hover {
  background-color: var(--surface-hover);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
}

/* Top Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  height: 64px;
}

.model-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.model-selector h2 {
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-secondary);
}

.model-selector:hover {
  background-color: var(--surface-hover);
}

.model-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 300px;
  max-height: 500px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.model-dropdown::-webkit-scrollbar {
  width: 6px;
}
.model-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
.model-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.model-option {
  transition: background-color 0.2s;
}

.model-option:hover {
  background-color: var(--surface-hover);
}

.model-option.active {
  background-color: var(--surface-hover);
  border-left: 3px solid var(--accent-blue);
}

.model-option.active .material-symbols-outlined {
  color: var(--accent-blue);
}

.hidden {
  display: none !important;
}

.user-profile .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

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

.chat-container::-webkit-scrollbar {
  width: 8px;
}
.chat-container::-webkit-scrollbar-track {
  background: transparent;
}
.chat-container::-webkit-scrollbar-thumb {
  background: var(--surface-hover);
  border-radius: 4px;
}

/* Welcome Screen */
.welcome-screen {
  max-width: 830px;
  width: 100%;
  padding: 40px 24px;
  margin-top: 40px;
}

.welcome-screen h1 {
  font-family: 'Google Sans', sans-serif;
  font-size: 56px;
  line-height: 1.2;
  font-weight: 500;
  margin-bottom: 40px;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: -webkit-linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #131314 75%, #131314 100%);
  background-size: 400% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
}

.suggestion-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 60px;
}

.card {
  background-color: var(--panel-bg);
  border-radius: 12px;
  padding: 16px;
  width: calc(25% - 9px);
  min-width: 180px;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  background-color: var(--surface-hover);
}

.card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.4;
}

.card .material-symbols-outlined {
  align-self: flex-end;
  background-color: var(--bg-color);
  padding: 8px;
  border-radius: 50%;
  font-size: 20px;
}

/* Messages Area */
.messages {
  max-width: 830px;
  width: 100%;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

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

.avatar-wrapper {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.ai-avatar {
  background: linear-gradient(135deg, #a8c7fa, #d3e3fd);
  border-radius: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-avatar .material-symbols-outlined {
  color: #131314;
  font-size: 18px;
  font-variation-settings: 'FILL' 1;
}

.user-avatar {
  background-color: var(--surface-hover);
  border-radius: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.message-content {
  max-width: 85%;
}

.user-message .message-content {
  background-color: var(--surface-hover);
  padding: 12px 16px;
  border-radius: 24px;
  border-top-right-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
}

.ai-message .message-content {
  padding-top: 4px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.message-content h3 {
  font-size: 16px;
  margin: 16px 0 8px 0;
  font-weight: 500;
}

/* Terminal/Code UI */
.terminal-block {
  margin: 16px 0;
  background-color: var(--terminal-bg);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background-color: var(--surface-hover);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.terminal-content {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--terminal-text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 500px;
  overflow-y: auto;
}

.terminal-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.terminal-content::-webkit-scrollbar-track {
  background: var(--terminal-bg);
}
.terminal-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.error-text {
  color: #ff5252;
}

/* Input Area */
.input-container {
  max-width: 830px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 24px 24px;
  position: relative;
}

.input-wrapper {
  background-color: var(--input-bg);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  transition: background-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.input-wrapper:focus-within {
  background-color: #2b2c2e;
  box-shadow: 0 0 0 1px inset var(--border-color);
}

.input-box {
  display: flex;
  align-items: flex-end;
  padding: 8px 16px 8px 8px;
  gap: 8px;
}

.attachment-btn {
  margin-bottom: 4px;
}

.attachment-btn .material-symbols-outlined {
  font-size: 24px;
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-family);
  resize: none;
  padding: 12px 0;
  max-height: 200px;
  min-height: 44px;
  line-height: 1.4;
  outline: none;
}

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

.send-btn {
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.send-btn.active {
  color: #fff;
  background-color: #333537;
}

.send-btn.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

.file-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
  /* Will add margin-top dynamically when files exist */
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface-hover);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  margin-top: 12px;
}

.file-chip .material-symbols-outlined {
  font-size: 16px;
}

.file-chip .remove-file {
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-chip .remove-file:hover {
  background-color: #444746;
  color: var(--text-primary);
}

.disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* Loading Animation */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ─── Login Screen ─────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.login-logo {
  background: linear-gradient(135deg, #a8c7fa, #d3e3fd);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.login-logo .material-symbols-outlined {
  color: #131314;
  font-size: 28px;
  font-variation-settings: 'FILL' 1;
}

.login-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 28px;
  font-weight: 500;
  margin: 0;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-field input {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-family);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.15);
}

.login-error {
  font-size: 13px;
  color: #ff5252;
  text-align: center;
  background: rgba(255, 82, 82, 0.08);
  border: 1px solid rgba(255, 82, 82, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
}

.login-btn {
  background: var(--accent-blue);
  color: #131314;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 4px;
}

.login-btn:hover {
  opacity: 0.88;
}

/* Logout button in top nav */
.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background-color: var(--surface-hover);
}

.logout-btn .material-symbols-outlined {
  font-size: 20px;
  color: var(--text-muted);
}

/* ─── Terminal Toggle Button ───────────────────────────────── */
.terminal-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 4px 0;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.terminal-toggle-btn:hover {
  background-color: var(--surface-hover);
  border-color: var(--text-muted);
}

.terminal-toggle-btn .material-symbols-outlined {
  font-size: 16px;
}

/* Summary Card */
.summary-card {
  margin-top: 16px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.summary-header .material-symbols-outlined {
  font-size: 18px;
  color: #fdd663;
  font-variation-settings: 'FILL' 1;
}

.summary-flag {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.summary-flag-value {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #69ff85;
  background: rgba(105, 255, 133, 0.08);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(105, 255, 133, 0.2);
  word-break: break-all;
}

.summary-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.summary-section:last-child {
  border-bottom: none;
}

.summary-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.summary-commands {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--terminal-text);
  background: var(--terminal-bg);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .sidebar { width: 0; padding: 0; overflow: hidden; border: none; }
  .welcome-screen h1 { font-size: 36px; }
  .card { width: calc(50% - 6px); }
  .message-content { max-width: 90%; }
}
