﻿/* ========================================================
   POCKET COPILOT | "Airy New Day" Design System
   Modern, Luminous, High-Contrast Outdoor Field Aesthetic
   ======================================================== */

:root {
  /* Daylight & Dawn Palette */
  --bg-sky: #F0F7FF;
  --bg-gradient: linear-gradient(180deg, #E0F2FE 0%, #F0F9FF 35%, #F8FAFC 100%);
  --surface-card: rgba(255, 255, 255, 0.85);
  --surface-glass: rgba(255, 255, 255, 0.7);
  --surface-tinted: #E0F2FE;
  
  /* Primary & Accents */
  --primary-azure: #0284C7;
  --primary-deep: #0369A1;
  --primary-light: #38BDF8;
  --dawn-gold: #F59E0B;
  --dawn-amber: #D97706;
  --dawn-glow: rgba(245, 158, 11, 0.25);
  --accent-emerald: #10B981;
  --accent-rose: #F43F5E;
  
  /* Text & Borders */
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --border-soft: rgba(2, 132, 199, 0.15);
  --border-card: rgba(255, 255, 255, 0.6);
  --border-strong: rgba(2, 132, 199, 0.3);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(2, 132, 199, 0.06);
  --shadow-md: 0 8px 24px rgba(2, 132, 199, 0.09), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 36px rgba(2, 132, 199, 0.14), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 24px rgba(2, 132, 199, 0.35);
  
  /* Fonts & Radii */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* iOS Safe Areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-sky);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========================================================
   TOP HEADER NAVIGATION
   ======================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(240, 249, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-soft);
  padding: calc(var(--safe-top) + 10px) 16px 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  object-fit: cover;
}

.brand-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-deep);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title-group .zero-pii-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
}

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

.header-btn {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.header-btn:hover, .header-btn:active {
  background: var(--surface-tinted);
  border-color: var(--primary-azure);
  transform: translateY(-1px);
}

.header-btn.sync-pill.connected {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.3);
}

/* ========================================================
   QUICK FIELD SCENARIO CHIPS (HORIZONTAL SCROLL)
   ======================================================== */
.chips-scroll-container {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips-scroll-container::-webkit-scrollbar {
  display: none;
}

.scenario-chip {
  flex-shrink: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.scenario-chip:hover, .scenario-chip:active {
  background: var(--primary-deep);
  color: #FFFFFF;
  border-color: var(--primary-deep);
  box-shadow: var(--shadow-md);
  transform: scale(1.02);
}

.scenario-chip.active {
  background: var(--primary-azure);
  color: #FFFFFF;
  border-color: var(--primary-azure);
}

/* ========================================================
   MAIN CHAT & WORKSPACE FEED
   ======================================================== */
.chat-container {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px 140px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome Hero Card */
.welcome-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(224, 242, 254, 0.7) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.welcome-hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-deep);
  margin-bottom: 8px;
}

.welcome-hero p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.quick-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.stat-pill-box {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}

.stat-pill-box .stat-label {
  font-size: 0.72rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  font-weight: 700;
  display: block;
}

.stat-pill-box .stat-val {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-deep);
  font-family: var(--font-heading);
}

/* Chat Messages */
.chat-bubble {
  display: flex;
  gap: 12px;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

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

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

.bubble-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.chat-bubble.assistant .bubble-avatar {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
}

.chat-bubble.user .bubble-avatar {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
}

.bubble-content {
  max-width: 85%;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  line-height: 1.55;
  font-size: 0.92rem;
  position: relative;
}

.chat-bubble.user .bubble-content {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

.chat-bubble.user .bubble-content a {
  color: #E0F2FE;
}

/* High-Legibility Assistant Markdown Styling */
.bubble-content {
  max-width: 90%;
  background: #FFFFFF;
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-md);
  line-height: 1.68;
  font-size: 0.98rem;
  color: #0F172A;
  position: relative;
}

.md-body {
  font-size: 0.98rem;
  color: #0F172A;
}

.md-h1, .md-h2, .md-h3 {
  font-family: var(--font-heading);
  color: var(--primary-deep);
  font-weight: 800;
  margin: 16px 0 8px 0;
}
.md-h1:first-child, .md-h2:first-child, .md-h3:first-child {
  margin-top: 0;
}
.md-h1 { font-size: 1.25rem; }
.md-h2 { font-size: 1.12rem; }
.md-h3 { font-size: 1.02rem; }

.md-p {
  margin-bottom: 12px;
  line-height: 1.68;
  color: #0F172A;
}
.md-p:last-child {
  margin-bottom: 0;
}

.md-bold {
  font-weight: 750;
  color: #0369A1;
}

.md-ul, .md-ol {
  margin: 10px 0 14px 22px;
  padding-left: 4px;
}

.md-li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: #1E293B;
}

.md-code {
  font-family: var(--font-mono);
  background: rgba(2, 132, 199, 0.1);
  color: #0369A1;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 600;
}

/* File Note Callout Box */
.file-note-callout {
  background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
  border: 1.5px solid #38BDF8;
  border-left: 5px solid #0284C7;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 14px 0;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.file-note-callout .callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.file-note-callout .callout-text {
  font-size: 0.95rem;
  line-height: 1.62;
  color: #0C4A6E;
  font-weight: 500;
}
.bubble-content code {
  font-family: var(--font-mono);
  background: rgba(2, 132, 199, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
  color: #0369A1;
}
.bubble-content pre {
  background: #0F172A;
  color: #F8FAFC;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin: 10px 0;
}
.bubble-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}
.bubble-content blockquote {
  border-left: 4px solid var(--dawn-gold);
  background: rgba(245, 158, 11, 0.08);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 10px 0;
  font-style: italic;
}

/* Action Drawer on Assistant Responses */
.response-action-bar {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-chip-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.action-chip-btn:hover, .action-chip-btn:active {
  background: var(--primary-azure);
  color: #FFFFFF;
  border-color: var(--primary-azure);
}

.action-chip-btn.email-work {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  border-color: #0284C7;
}

.action-chip-btn.add-task {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Upload Drop Card */
.upload-card-preview {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-card-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
}

.upload-card-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-deep);
}

.upload-card-info p {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ========================================================
   BOTTOM ACTION DOCK & BIG RECORD BUTTON
   ======================================================== */
.action-dock-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(240, 249, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-soft);
  padding: 10px 16px calc(var(--safe-bottom) + 8px) 16px;
  box-shadow: 0 -8px 24px rgba(2, 132, 199, 0.08);
}

.dock-content {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dock-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  color: var(--primary-deep);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.dock-icon-btn:hover, .dock-icon-btn:active {
  background: var(--surface-tinted);
  border-color: var(--primary-azure);
  transform: scale(1.05);
}

.input-pill-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-input-field {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-full);
  padding: 12px 48px 12px 18px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text-main);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
  outline: none;
  transition: all 0.2s ease;
}

.chat-input-field:focus {
  border-color: var(--primary-azure);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.send-btn-inside {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-azure);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.send-btn-inside:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* THE PROMINENT "BIG RECORD BUTTON" */
.big-record-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #EA580C);
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4), 0 0 0 3px rgba(245, 158, 11, 0.2);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.big-record-btn:hover {
  transform: scale(1.08);
}

.big-record-btn.recording {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.6), 0 0 0 6px rgba(239, 68, 68, 0.3);
  animation: pulseRecord 1.2s infinite ease-in-out;
}

@keyframes pulseRecord {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ========================================================
   MODAL DIALOGS (To-Dos, Pitch Calc, Settings)
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-backdrop.active {
  display: flex;
}

.modal-sheet {
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px 20px calc(var(--safe-bottom) + 20px) 20px;
  animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: var(--surface-tinted);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--primary-deep);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form controls */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: #F8FAFC;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-azure);
  background: #FFFFFF;
}

/* Primary Button */
.btn-solid-primary {
  width: 100%;
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-solid-primary:hover, .btn-solid-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

/* Claim To-Do Item Card */
.task-item-card {
  background: #F8FAFC;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s ease;
}

.task-item-card.completed {
  opacity: 0.6;
  background: #F1F5F9;
}

.task-item-card.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  accent-color: var(--primary-azure);
  cursor: pointer;
  margin-top: 2px;
}

.task-content {
  flex: 1;
}

.task-claim-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-deep);
  background: var(--surface-tinted);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
}

.task-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.4;
}

.task-date {
  font-size: 0.7rem;
  color: var(--text-subtle);
  margin-top: 4px;
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  top: calc(var(--safe-top) + 70px);
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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