/* ==========================================================================
   Dental Practice WhatsApp AI Assistant Demo - Styles
   Clean, Clinical, WhatsApp-Authentic & Responsive (Desktop-First)
   ========================================================================== */

:root {
  /* WhatsApp Authentic Palette */
  --wa-teal-dark: #075E54;
  --wa-teal: #128C7E;
  --wa-green: #25D366;
  --wa-bg-chat: #EFEAE2;
  --wa-bubble-in: #FFFFFF;
  --wa-bubble-out: #DCF8C6;
  --wa-text-primary: #111B21;
  --wa-text-secondary: #667781;
  --wa-tick-blue: #34B7F1;
  --wa-input-bg: #FFFFFF;
  --wa-chat-border: #D1D7DB;

  /* Clinical Practice Theme */
  --clinical-bg: #F8FAFC;
  --clinical-surface: #FFFFFF;
  --clinical-border: #E2E8F0;
  --clinical-border-subtle: #EDF2F7;
  --clinical-navy: #0F172A;
  --clinical-slate: #334155;
  --clinical-muted: #64748B;
  --clinical-accent: #0284C7;
  --clinical-success: #15803D;
  --clinical-success-bg: #DCFCE7;
  --clinical-warning: #B45309;
  --clinical-warning-bg: #FEF3C7;
  --clinical-urgent-border: #F59E0B;

  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-phone: 28px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
  --transition-fast: 0.18s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-system);
  background-color: var(--clinical-bg);
  color: var(--clinical-navy);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.top-header {
  background-color: var(--clinical-surface);
  border-bottom: 1px solid var(--clinical-border);
  padding: 16px 28px;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.badge-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--wa-teal-dark);
  background-color: #E6F4EA;
  padding: 3px 8px;
  border-radius: 4px;
}

.main-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--clinical-navy);
  letter-spacing: -0.3px;
}

.sub-title {
  font-size: 14px;
  color: var(--clinical-muted);
  font-weight: 500;
}

/* ==========================================================================
   Main Split Layout (Desktop First: 58% Left / 42% Right)
   ========================================================================== */
.main-wrapper {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 28px;
}

.split-layout {
  display: flex;
  gap: 28px;
  align-items: stretch;
}

.panel-left {
  flex: 0 0 56%;
  display: flex;
  justify-content: center;
}

.panel-right {
  flex: 0 0 44%;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Left Panel: WhatsApp Phone Mockup
   ========================================================================== */
.phone-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* Overlay at top-right of phone: DEMO badge + Reset demo button */
.phone-top-bar-overlay {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.watermark-badge {
  background-color: rgba(15, 23, 42, 0.55);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 7px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.phone-reset-btn {
  background-color: rgba(255, 255, 255, 0.92);
  color: var(--clinical-navy);
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.18);
  transition: all var(--transition-fast);
}

.phone-reset-btn:hover {
  background-color: #FFFFFF;
  color: var(--clinical-accent);
  transform: translateY(-1px);
}

.phone-screen {
  background-color: var(--wa-bg-chat);
  border: 10px solid #1E293B;
  border-radius: var(--radius-phone);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: 690px;
  position: relative;
}

/* WhatsApp Header (#25D366 or dark teal #075E54) */
.wa-header {
  background-color: var(--wa-teal-dark);
  color: #FFFFFF;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 10;
  user-select: none;
}

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

.wa-icon-btn {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color var(--transition-fast);
}

.wa-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #264e43;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #FFFFFF;
}

.avatar-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  background-color: var(--wa-green);
  border: 2px solid var(--wa-teal-dark);
  border-radius: 50%;
}

.wa-contact-info {
  display: flex;
  flex-direction: column;
}

.wa-contact-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.wa-contact-status {
  font-size: 11px;
  color: #C8E6C9;
  font-weight: 400;
  transition: color var(--transition-fast);
}

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

/* WhatsApp Chat Area */
.wa-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 10px 14px;
  background-color: var(--wa-bg-chat);
  background-image: 
    radial-gradient(#d3cbbd 1.1px, transparent 1.1px), 
    radial-gradient(#d3cbbd 1.1px, var(--wa-bg-chat) 1.1px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.wa-chat-area::-webkit-scrollbar {
  width: 5px;
}
.wa-chat-area::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.wa-system-pill,
.wa-date-divider {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}

.wa-system-pill span {
  background-color: #FFEECD;
  color: #54656F;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
  text-align: center;
  max-width: 90%;
  line-height: 1.35;
}

.wa-date-divider span {
  background-color: #FFFFFF;
  color: #667781;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Messages Stream */
.messages-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-message-row {
  display: flex;
  width: 100%;
}

.wa-message-row.inbound {
  justify-content: flex-start;
}

.wa-message-row.outbound {
  justify-content: flex-end;
}

.wa-bubble {
  max-width: 82%;
  padding: 8px 12px 6px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.12);
  position: relative;
  word-wrap: break-word;
  animation: messageIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.wa-bubble.inbound {
  background-color: var(--wa-bubble-in);
  color: var(--wa-text-primary);
  border-top-left-radius: 2px;
}

.wa-bubble.outbound {
  background-color: var(--wa-bubble-out);
  color: var(--wa-text-primary);
  border-top-right-radius: 2px;
}

.bubble-text {
  font-size: 13.5px;
  line-height: 1.42;
  white-space: pre-line;
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
  margin-left: 12px;
  float: right;
}

.bubble-time {
  font-size: 10.5px;
  color: var(--wa-text-secondary);
  line-height: 1;
}

.double-ticks {
  display: inline-flex;
  color: var(--wa-tick-blue);
}

/* Typing Indicator (3 animated dots in bot bubble) */
.typing-bubble-container {
  display: flex;
  margin: 2px 0;
}

.typing-bubble {
  background-color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.12);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #8696A0;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

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

/* Starter Shortcut Chips */
.chips-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-left: 2px;
}

.chips-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--clinical-muted);
  letter-spacing: 0.4px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background-color: #FFFFFF;
  color: var(--wa-teal-dark);
  border: 1px solid #CBD5E1;
  padding: 7px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  background-color: #F0FDF4;
  border-color: var(--wa-green);
  transform: translateY(-1px);
}

/* WhatsApp Input Bar */
.wa-input-bar {
  background-color: #F0F2F5;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--wa-chat-border);
  z-index: 10;
}

.wa-action-icon {
  background: none;
  border: none;
  color: #54656F;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color var(--transition-fast);
}

.wa-action-icon:hover {
  color: var(--wa-teal-dark);
}

.message-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-input {
  flex: 1;
  background-color: var(--wa-input-bg);
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--wa-text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.message-input:focus {
  border-color: var(--wa-teal);
  box-shadow: 0 0 0 2px rgba(18, 140, 126, 0.15);
}

.message-input::placeholder {
  color: #8696A0;
}

.wa-send-btn {
  width: 36px;
  height: 36px;
  background-color: var(--wa-teal);
  border: none;
  border-radius: 50%;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wa-send-btn:hover {
  background-color: var(--wa-teal-dark);
  transform: scale(1.04);
}

/* ==========================================================================
   Right Panel: Practice Dashboard
   ========================================================================== */
.dashboard-card {
  background-color: var(--clinical-surface);
  border: 1px solid var(--clinical-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--clinical-border-subtle);
  padding-bottom: 12px;
}

.dashboard-pretitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--clinical-accent);
}

.dashboard-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--clinical-navy);
  letter-spacing: -0.2px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ECFDF5;
  color: var(--clinical-success);
  border: 1px solid #A7F3D0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: #10B981;
  border-radius: 50%;
  animation: livePing 1.8s infinite cubic-bezier(0, 0, 0.2, 1);
}

@keyframes livePing {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0.9); opacity: 1; }
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background-color: #F8FAFC;
  border: 1px solid var(--clinical-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: #CBD5E1;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--clinical-muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--clinical-navy);
  margin: 3px 0 2px 0;
  line-height: 1.1;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.stat-value.text-accent {
  color: var(--clinical-accent);
}

.stat-value.text-success {
  color: var(--clinical-success);
}

.stat-foot {
  font-size: 11px;
  color: var(--clinical-muted);
}

/* Practice Brief Banner */
.clinic-brief-banner {
  background-color: #F8FAFC;
  border: 1px solid var(--clinical-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--clinical-slate);
}

.banner-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-check {
  color: var(--clinical-success);
  font-weight: 800;
}

/* Dashboard Two Feeds Container */
.dashboard-lists-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 250px;
}

.dashboard-subpanel {
  background-color: #F8FAFC;
  border: 1px solid var(--clinical-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

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

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--clinical-navy);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.count-badge-success {
  background-color: #DCFCE7;
  color: var(--clinical-success);
}

.count-badge-warning {
  background-color: #FEF3C7;
  color: var(--clinical-warning);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  text-align: center;
  color: var(--clinical-muted);
}

.empty-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--clinical-slate);
}

.empty-sub {
  font-size: 11.5px;
  color: var(--clinical-muted);
  max-width: 340px;
  margin-top: 2px;
}

/* Feed Lists */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 145px;
  overflow-y: auto;
  padding-right: 2px;
}

.feed-item {
  background-color: #FFFFFF;
  border: 1px solid var(--clinical-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: cardFadeIn 0.25s ease-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.feed-item.booked-item {
  border-left: 4px solid var(--clinical-success);
}

.feed-item.flagged-item {
  border-left: 4px solid var(--clinical-urgent-border);
  background-color: #FFFDF9;
}

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

.item-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-primary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--clinical-navy);
}

.item-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-confirmed {
  background-color: var(--clinical-success-bg);
  color: var(--clinical-success);
}

.badge-urgent {
  background-color: var(--clinical-warning-bg);
  color: var(--clinical-warning);
}

.item-row-mid {
  font-size: 12px;
  color: var(--clinical-slate);
}

.item-row-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--clinical-muted);
  border-top: 1px dashed var(--clinical-border);
  padding-top: 3px;
  margin-top: 2px;
}

/* Diary Sync Status Footer */
.diary-sync-footer {
  border-top: 1px solid var(--clinical-border-subtle);
  padding-top: 10px;
}

.diary-sync-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--clinical-muted);
}

.sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-ping {
  width: 6px;
  height: 6px;
  background-color: var(--clinical-success);
  border-radius: 50%;
}

.sync-mode {
  font-weight: 600;
  color: var(--clinical-slate);
  background-color: #F1F5F9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   Bottom Agency Footer
   ========================================================================== */
.bottom-footer {
  background-color: var(--clinical-surface);
  border-top: 1px solid var(--clinical-border);
  padding: 16px 24px;
  text-align: center;
  font-size: 13.5px;
  color: var(--clinical-slate);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.agency-link {
  color: var(--wa-teal-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.agency-link:hover {
  color: var(--wa-teal);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .split-layout {
    flex-direction: column;
    gap: 30px;
  }

  .panel-left, .panel-right {
    flex: 0 0 100%;
    width: 100%;
  }

  .phone-container {
    max-width: 520px;
  }
}

@media (max-width: 640px) {
  .top-header {
    padding: 12px 16px;
  }

  .main-wrapper {
    padding: 14px;
  }

  .phone-screen {
    height: 620px;
    border-radius: 18px;
    border-width: 6px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
