/* PAR Intelligence Demo — App Styles
   Platform UI design language: clean, restrained, functional
   ========================================== */

/* ========== SHELL ========== */

html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: linear-gradient(160deg, #e3e6ee 0%, #d4d8e4 40%, #c9cede 70%, #bfc5d6 100%);
}

#app {
  height: 100%;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

/* ========== BROWSER FRAME ========== */

.browser-frame {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.browser-chrome {
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.browser-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
}

/* ========== PAGE FRAME ========== */

.demo-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--background);
}

/* ========== TOPBAR ========== */

.demo-topbar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  gap: 12px;
  flex-shrink: 0;
}

.demo-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

.demo-topbar-brand svg { border-radius: 5px; flex-shrink: 0; }

.demo-topbar-brand-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.demo-topbar-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.demo-topbar-chips::-webkit-scrollbar { display: none; }

.demo-chip {
  padding: 5px 14px;
  border-radius: var(--r-md);
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}

.demo-chip:hover {
  color: var(--text-primary);
  background: var(--surface-low);
}

.demo-chip.active {
  color: var(--text-primary);
  font-weight: 600;
  background: none;
}

.demo-chip.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--par-violet);
  border-radius: 1px;
}

/* ========== MAIN AREA ========== */

.demo-main {
  flex: 1 1 0;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── Chat ── */

.demo-chat {
  width: 440px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--card);
}

.demo-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: flex-end;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.demo-chat-messages::-webkit-scrollbar { width: 3px; }
.demo-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Once content overflows, switch to normal top-aligned scrolling */
.demo-chat-messages.has-overflow {
  justify-content: flex-start;
}

.demo-chat-input { flex-shrink: 0; }

/* ── Viz ── */

.demo-viz {
  flex: 1;
  overflow-y: auto;
  background: var(--canvas);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.demo-viz::-webkit-scrollbar { width: 3px; }
.demo-viz::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.viz-pane-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 8px;
}

/* ========== ANIMATIONS ========== */

.content-enter { animation: fade-up 0.25s ease; }
.viz-enter { animation: fade-up 0.35s ease; }

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

/* ========== TYPING ========== */

.typing-indicator { display: flex; gap: 5px; align-items: center; }

.typing-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
}

/* ========== SUGGESTION PILLS ========== */

.suggestion-pill {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 14px;
  cursor: pointer;
  background: var(--card);
  font-family: inherit;
  transition: all 0.15s ease;
}

.suggestion-pill:hover {
  border-color: var(--par-navy);
  color: var(--text-primary);
}

/* ========== CHAT MESSAGES ========== */

.chat-msg-ai { display: flex; gap: 10px; }

.ai-avatar {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  background: var(--par-navy);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-avatar svg { width: 13px; height: 13px; }

.ai-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.ai-bubble {
  background: var(--canvas);
  border-radius: var(--r-lg);
  border-top-left-radius: 4px;
  padding: 12px 14px;
}

.ai-bubble p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.ai-bubble p + p { margin-top: 8px; }

.chat-msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-bubble {
  background: var(--par-navy);
  color: #fff;
  border-radius: var(--r-lg);
  border-top-right-radius: 4px;
  padding: 10px 14px;
  max-width: 85%;
}

.user-bubble p { font-size: 14px; line-height: 1.6; }

/* ========== ACTION CHIP ========== */

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--canvas);
  color: var(--par-navy);
  border-radius: var(--r-full);
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.action-chip:hover {
  background: var(--surface-high);
  border-color: var(--par-navy);
}

.action-chip .material-symbols-outlined { font-size: 14px; }

/* ========== INPUT BAR ========== */

.chat-input-bar {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-subtle);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px 12px;
  background: var(--card);
  transition: border-color 0.15s ease;
}

.chat-input-wrap:focus-within {
  border-color: var(--par-navy);
}

.chat-input-wrap input {
  flex: 1; border: none; background: none;
  font-family: inherit; font-size: 14px;
  color: var(--text-primary); outline: none;
}

.chat-input-wrap input::placeholder { color: var(--text-muted); }
.chat-input-wrap input:disabled { opacity: 0.3; }

.send-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-md);
  background: var(--par-navy);
  color: #fff; border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.send-btn:hover { background: var(--par-navy-deep); }

.chat-input-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.send-btn-disabled {
  background: var(--surface-high);
  color: var(--text-muted);
}

/* ========== VIZ GRID ========== */

.viz-grid { display: grid; gap: 12px; }

/* ========== BAR CHART ========== */

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 140px; font-size: 12px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 20px; background: var(--surface-low); border-radius: var(--r-sm); overflow: hidden; }
.bar-fill { height: 100%; background: var(--par-navy); border-radius: var(--r-sm); transition: width 0.6s ease; }
.bar-value { width: 60px; font-size: 13px; font-weight: 600; text-align: right; flex-shrink: 0; color: var(--text-primary); }

/* ========== DATA TABLE ========== */

.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { background: var(--canvas); font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table tbody td { font-size: 13px; color: var(--text-primary); padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
.data-table tbody tr:hover { background: var(--surface-low); }

/* ========== RECOMMENDATION BOX ========== */

.recommendation-box {
  background: var(--par-violet-tint);
  border: 1px solid rgba(104, 100, 209, 0.15);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px; line-height: 1.6; color: var(--text-primary);
}

.recommendation-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--par-violet);
  display: block; margin-bottom: 6px;
}

/* ========== DEMO MODE ========== */

.demo-guided { opacity: 1 !important; pointer-events: none; }

.demo-guiding-indicator {
  display: flex; align-items: center; justify-content: center;
  gap: 5px; padding: 5px 0;
  font-size: 10px; color: var(--text-muted); font-weight: 500;
}

.demo-guiding-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--par-violet);
  animation: pulse 2s ease infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.demo-cta-bar { border-top: 1px solid var(--border); padding: 20px 16px; text-align: center; }
.demo-cta-heading { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 14px; }
.demo-cta-buttons { display: flex; align-items: center; justify-content: center; gap: 10px; }

.demo-cta-primary {
  padding: 10px 22px; border-radius: var(--r-full);
  background: var(--par-navy); color: #fff; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  text-decoration: none; transition: background 0.15s ease;
}
.demo-cta-primary:hover { background: var(--par-navy-deep); }

.demo-cta-secondary {
  padding: 10px 22px; border-radius: var(--r-full);
  border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: inherit;
  text-decoration: none; transition: all 0.15s ease; background: none;
}
.demo-cta-secondary:hover { color: var(--text-primary); border-color: var(--par-navy); }

/* ========== WIDGETS ========== */

.widget-offer { border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; background: var(--card); }
.widget-offer-image { height: 90px; background: var(--canvas); position: relative; display: flex; align-items: center; justify-content: center; }
.widget-offer-emoji { width: 48px; height: 48px; border-radius: 12px; background: var(--par-violet-tint); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.widget-offer-badge { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: var(--r-full); background: var(--par-navy); color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.widget-offer-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.widget-offer-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.widget-offer-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.widget-offer-meta { display: flex; align-items: center; justify-content: space-between; }
.widget-offer-time { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); }
.widget-offer-compliance { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--success); }
.widget-offer-signals { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }

.widget-journey { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--card); overflow: hidden; }
.widget-journey-header { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.widget-journey-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--par-violet); animation: pulse 2s ease infinite; }
.widget-journey-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-primary); }
.widget-journey-flow { display: flex; justify-content: center; padding: 14px; overflow-x: auto; }

.widget-surface { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--card); overflow: hidden; }
.widget-surface-header { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }

.widget-automation { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--card); overflow: hidden; }

/* ========== LEGACY COMPONENTS ========== */

.offer-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; }
.offer-card-hero { height: 100px; background: linear-gradient(135deg, #FF6B35, #FF8F61); display: flex; align-items: center; justify-content: center; text-align: center; color: white; }
.offer-card-hero-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.offer-card-hero-unit { font-size: 12px; font-weight: 600; opacity: 0.9; }
.offer-card-body { padding: 16px; }
.offer-card-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--par-violet); letter-spacing: 0.06em; margin-bottom: 4px; }
.offer-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.offer-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; }
.offer-card-stats { display: flex; gap: 12px; }
.offer-card-stat { flex: 1; }
.offer-card-stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.offer-card-stat-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.offer-card-stat-value.success { color: var(--success); }

.journey-diagram { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.journey-title { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; margin-bottom: 14px; }
.journey-node { display: flex; align-items: flex-start; gap: 10px; }
.journey-node-track { display: flex; flex-direction: column; align-items: center; }
.journey-node-icon { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.journey-node-icon .material-symbols-outlined { font-size: 14px; }
.journey-node-line { width: 1px; height: 16px; background: var(--border); }
.journey-node-body { padding-top: 3px; }
.journey-node-label { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.journey-node-sub { font-size: 11px; color: var(--text-muted); }

.phone-mockup { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 20px; }
.phone-mockup-body { width: 260px; border-radius: 36px; background: #1a1a1a; padding: 9px; box-shadow: 0 25px 60px rgba(0,0,0,0.15); position: relative; }
.phone-mockup-screen { width: 100%; min-height: 500px; border-radius: 28px; background: #f7f7f8; overflow: hidden; position: relative; }
.phone-screen-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.phone-dynamic-island { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 72px; height: 22px; background: #1a1a1a; border-radius: var(--r-full); z-index: 20; }
.phone-live-label { margin-top: 12px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.phone-live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); animation: pulse 2s ease infinite; }

/* ========== MOBILE SCENARIO SELECT ========== */

.mobile-scenario-wrap {
  display: none;
  position: relative;
  align-items: center;
  flex: 1;
}

.mobile-scenario-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 6px 32px 6px 12px;
  cursor: pointer;
  outline: none;
}

.mobile-scenario-chevron {
  position: absolute;
  right: 8px;
  font-size: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
  .demo-chat { width: 360px; min-width: 300px; }
}

@media (max-width: 768px) {
  .browser-frame {
    background: var(--background);
    backdrop-filter: none;
  }
  .browser-chrome { display: none; }

  /* Compact topbar: brand + chips on one line, chips scroll */
  .demo-topbar {
    height: 44px;
    padding: 0 10px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .demo-topbar-brand-text { display: none; }
  .demo-topbar-brand { padding-right: 8px; border-right: 1px solid var(--border); }

  .demo-topbar-chips { display: none; }
  .mobile-scenario-wrap { display: flex; }

  /* Canvas-first stacked layout: viz on top, chat pinned below */
  .demo-main { flex-direction: column; }

  .demo-viz {
    order: 1;
    flex: 0 0 44%;
    border-bottom: 1px solid var(--border);
    overflow-y: auto;
  }

  .demo-chat {
    order: 2;
    width: 100%;
    min-width: 0;
    border-right: none;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .demo-chat-messages { padding: 12px 14px; gap: 10px; }
  .ai-bubble p { font-size: 13px; }
  .user-bubble p { font-size: 13px; }
  .suggestion-pill { font-size: 12px; padding: 6px 12px; }
  .metric-card .metric-value { font-size: 20px; }
  .metric-card { padding: var(--sp-3); }
}
