/* ========================================================
   POCKET COPILOT | "Sunburst Daylight" Design System
   Lively, High-Visibility, Zero-Bloat Outdoor Field Aesthetic
   ======================================================== */

:root {
  /* High-Visibility Daylight Palette */
  --bg-sky: #F0F9FF;
  --bg-mesh: radial-gradient(at 0% 0%, rgba(224, 242, 254, 0.9) 0px, transparent 50%),
             radial-gradient(at 100% 0%, rgba(254, 243, 199, 0.75) 0px, transparent 50%),
             radial-gradient(at 50% 100%, rgba(240, 253, 244, 0.85) 0px, transparent 50%),
             #F8FAFC;
  --surface-card: rgba(255, 255, 255, 0.94);
  --surface-glass: rgba(255, 255, 255, 0.85);
  --surface-tinted: #E0F2FE;
  
  /* Vibrant Accents */
  --primary-azure: #0284C7;
  --primary-deep: #0369A1;
  --primary-light: #38BDF8;
  --sun-gold: #F59E0B;
  --sun-amber: #D97706;
  --sun-glow: rgba(245, 158, 11, 0.35);
  --accent-emerald: #10B981;
  --accent-emerald-dark: #059669;
  --accent-rose: #F43F5E;
  --accent-purple: #8B5CF6;
  
  /* Text & Contrast (Engineered for Outdoor Sun Glare) */
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-subtle: #64748B;
  --border-soft: rgba(2, 132, 199, 0.18);
  --border-card: rgba(255, 255, 255, 0.9);
  --border-strong: rgba(2, 132, 199, 0.35);
  --border-gold: rgba(245, 158, 11, 0.4);
  
  /* Shadows with Warm Ambient Glow */
  --shadow-sm: 0 2px 8px rgba(2, 132, 199, 0.08);
  --shadow-md: 0 8px 24px rgba(2, 132, 199, 0.12), 0 2px 6px rgba(245, 158, 11, 0.06);
  --shadow-lg: 0 16px 36px rgba(2, 132, 199, 0.18), 0 4px 14px rgba(245, 158, 11, 0.1);
  --shadow-gold: 0 8px 25px rgba(245, 158, 11, 0.4);
  --shadow-emerald: 0 8px 25px rgba(16, 185, 129, 0.35);
  
  /* Typography & Geometry */
  --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-mesh);
  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(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1.5px 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;
  border: 1.5px solid #FFF;
}

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

.zero-pii-pill {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFF;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

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

.header-btn {
  background: #FFF;
  border: 1px solid var(--border-soft);
  color: var(--primary-deep);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.header-btn:active {
  transform: scale(0.95);
  background: var(--surface-tinted);
}

.sync-pill {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
}

/* ========================================================
   LIVELY SCENARIO CHIPS BAR
   ======================================================== */
.chips-scroll-container {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

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

.scenario-chip {
  flex-shrink: 0;
  background: #FFF;
  border: 1.5px solid var(--border-soft);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}

.scenario-chip:active {
  transform: scale(0.95);
}

.chip-brittle {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  color: #B45309;
}

.chip-drip {
  border-color: rgba(2, 132, 199, 0.5);
  background: linear-gradient(135deg, #F0F9FF, #E0F2FE);
  color: #0369A1;
}

.chip-ice {
  border-color: rgba(14, 165, 233, 0.5);
  background: linear-gradient(135deg, #F0FDFA, #CCFBF1);
  color: #0F766E;
}

.chip-shingle {
  border-color: rgba(244, 63, 94, 0.5);
  background: linear-gradient(135deg, #FFF1F2, #FFE4E6);
  color: #BE123C;
}

.chip-testsquare {
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  color: #6D28D9;
}

.chip-water {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  color: #047857;
}

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

.welcome-hero {
  background: linear-gradient(135deg, #FFFFFF 0%, #F0F9FF 60%, #FEF3C7 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
}

.welcome-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 6px;
}

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

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

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

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 3px;
}

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

/* Chat Bubbles */
.chat-bubble {
  display: flex;
  gap: 10px;
  width: 100%;
  animation: fadeInBubble 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(8px); }
  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;
  background: #FFF;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.chat-bubble.user .bubble-avatar {
  background: var(--primary-azure);
  color: #FFF;
  border: none;
}

.bubble-content {
  max-width: 86%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.55;
  box-shadow: var(--shadow-md);
}

.chat-bubble.user .bubble-content {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant .bubble-content {
  background: #FFFFFF;
  color: var(--text-main);
  border: 1.5px solid var(--border-card);
  border-bottom-left-radius: 4px;
  width: 100%;
}

/* Markdown Rendering Inside Assistant Bubbles */
.md-body p { margin-bottom: 10px; }
.md-body p:last-child { margin-bottom: 0; }
.md-h1, .md-h2, .md-h3 {
  font-family: var(--font-heading);
  color: var(--primary-deep);
  margin: 14px 0 6px 0;
}
.md-h2 { font-size: 1.15rem; }
.md-h3 { font-size: 1.02rem; }
.md-bold { font-weight: 700; color: #0F172A; }
.md-ul { margin: 8px 0 10px 18px; }
.md-li { margin-bottom: 4px; }
.md-code {
  font-family: var(--font-mono);
  background: #F1F5F9;
  padding: 2px 5px;
  border-radius: 4px;
  color: #0284C7;
  font-size: 0.85em;
}

.file-note-callout {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-left: 5px solid var(--sun-gold);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0;
  display: flex;
  gap: 10px;
}

.callout-icon { font-size: 1.2rem; flex-shrink: 0; }
.callout-text { font-size: 0.9rem; color: #78350F; line-height: 1.5; }

/* Response Action Buttons (Lively & Action-Oriented) */
.response-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #F1F5F9;
}

.action-chip-btn {
  background: #FFF;
  border: 1.5px solid var(--border-soft);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.action-chip-btn:active { transform: scale(0.95); }

.action-chip-btn.bridge-scope {
  background: linear-gradient(135deg, #10B981, #059669);
  border-color: #059669;
  color: #FFFFFF;
  box-shadow: var(--shadow-emerald);
}

.action-chip-btn.copy-f9 {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border-color: #D97706;
  color: #FFFFFF;
  box-shadow: var(--shadow-gold);
}

.action-chip-btn.email-work {
  background: #F0F9FF;
  border-color: var(--primary-azure);
  color: var(--primary-deep);
}

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

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

.dock-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #FFF;
  border: 1.5px solid var(--border-soft);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.dock-icon-btn:active { transform: scale(0.92); }

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

.chat-input-field {
  width: 100%;
  background: #F8FAFC;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-full);
  padding: 12px 42px 12px 16px;
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input-field:focus {
  border-color: var(--primary-azure);
  background: #FFF;
}

.send-btn-inside {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-azure);
  color: #FFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Big Glowing Record Button */
.big-record-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border: 2px solid #FFF;
  box-shadow: var(--shadow-gold);
  color: #FFF;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.big-record-btn:active {
  transform: scale(0.9);
}

.big-record-btn.recording {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  animation: pulseRecording 1.2s infinite ease-in-out;
}

@keyframes pulseRecording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ========================================================
   MODALS & SLIDE-UP SHEETS
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

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

.modal-sheet {
  background: #FFFFFF;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 24px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

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

.modal-close-btn {
  background: #F1F5F9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form Controls inside Modals */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

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

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

.btn-solid-primary {
  width: 100%;
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFF;
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.btn-solid-primary:active { transform: scale(0.98); }

/* Task Items */
.task-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F8FAFC;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
}

.task-item-card.completed {
  opacity: 0.55;
  text-decoration: line-through;
}

.task-claim-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(2, 132, 199, 0.12);
  color: var(--primary-deep);
  padding: 2px 6px;
  border-radius: 4px;
}

.task-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

.task-date {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* Toast */
.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: #FFF;
  backdrop-filter: blur(10px);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 200;
}

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