/* ==========================================================================
   Agent Xmas UI - Responsive Design (Desktop Gemini/ChatGPT + Mobile 100dvh)
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --border-subtle: #1e293b;
  --border-focus: #3b82f6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-height: 64px;
  --telemetry-height: 60px;
}

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

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

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.25rem 0.5rem;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Model Selector Pill */
.model-selector-pill {
  display: flex;
  background: #1e293b;
  border-radius: 9999px;
  padding: 3px;
  border: 1px solid #334155;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.pill-btn:hover {
  color: var(--text-primary);
}

.pill-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: #334155;
  color: #fff;
}

/* Telemetry Bar */
.telemetry-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--telemetry-height);
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 90;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
}

.telemetry-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  overflow-x: auto;
}

.turn-indicator {
  display: flex;
  flex-direction: column;
  min-width: 130px;
}

.telemetry-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.progress-track {
  height: 4px;
  background: #334155;
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.3s ease;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  background: #1e293b;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  min-width: 100px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-pill.highlight .stat-val {
  color: #38bdf8;
}

.stat-pill.savings .stat-val {
  color: var(--success);
}

.checkout-action-wrap {
  margin-left: auto;
}

.btn-hitl-checkout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--success);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  animation: pulse-glow 2s infinite;
  white-space: nowrap;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Container */
.main-container {
  height: 100%;
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
}

/* Hero Surface (Gemini/ChatGPT Desktop initial style) */
.hero-surface {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.hero-content {
  width: 100%;
  max-width: 760px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.hero-headline {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 600px;
}

/* Centered Prompt Box */
.prompt-box {
  width: 100%;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 1rem 1.25rem 0.75rem 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prompt-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 12px 30px -5px rgba(59, 130, 246, 0.25), 0 0 0 1px var(--primary);
}

.prompt-box textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.prompt-box-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.protocol-tags {
  display: flex;
  gap: 0.5rem;
}

.tag {
  background: #1e293b;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #334155;
}

.submit-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Suggestion Pills */
.suggestions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.chip {
  background: #1e293b;
  color: var(--text-secondary);
  border: 1px solid #334155;
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: #334155;
  color: #fff;
  border-color: #475569;
}

/* Chat Surface */
.chat-surface {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.messages-stream {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message-card {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.95rem;
}

.message-card.user {
  background: #1e293b;
  align-self: flex-end;
  max-width: 80%;
  border: 1px solid #334155;
}

.message-card.agent {
  background: #111827;
  align-self: flex-start;
  max-width: 88%;
  border: 1px solid #1e293b;
}

.avatar {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sender-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
}

.turn-tag {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.offer-card {
  margin-top: 0.5rem;
  background: #0b0f19;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.offer-meta {
  display: flex;
  flex-direction: column;
}

.offer-title {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.offer-price {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
}

/* Bottom Composer */
.bottom-composer {
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
}

.composer-form {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.composer-input-wrap {
  display: flex;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  align-items: center;
}

.composer-input-wrap:focus-within {
  border-color: var(--primary);
}

.composer-input-wrap textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  resize: none;
  line-height: 1.4;
}

.composer-send-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.composer-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

.modal-card {
  background: #111827;
  border: 1px solid #334155;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 30px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-info {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.input-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem 0;
  font-weight: 600;
}

.text-input {
  width: 100%;
  background: #0b0f19;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
}

.text-input:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  background: #1e293b;
  border: 1px solid #334155;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* Mobile & Tablet Specifics (100dvh shell) */
@media (max-width: 1023px) {
  html, body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-header {
    padding: 0 1rem;
  }

  .btn-text {
    display: none;
  }

  .hero-headline {
    font-size: 1.75rem;
  }

  .hero-description {
    font-size: 0.9rem;
  }

  .chat-surface {
    height: calc(100dvh - var(--header-height) - var(--telemetry-height));
  }

  .telemetry-inner {
    gap: 0.75rem;
  }

  .stat-pill {
    min-width: 80px;
  }
}
