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

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  background-color: var(--color-primary-navy);
  color: var(--color-text-dark);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

button::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

img, svg {
  vertical-align: middle;
  max-width: 100%;
}

/* App Viewport Container (Mobile-first with Desktop Card Preview) */
.app-viewport {
  width: 100%;
  max-width: 520px;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background-color: var(--wa-bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 769px) {
  .app-viewport {
    height: 94vh;
    height: 94dvh;
    max-height: 920px;
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.25);
  }
}

/* Authentic WhatsApp Textured Wallpaper with Maratha Fort SVG Overlay */
.chat-bg-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.4;
  background-color: var(--wa-bg);
  background-image: url('../assets/fort-pattern.svg');
  background-size: 200px 200px;
  background-repeat: repeat;
  pointer-events: none;
  z-index: var(--z-wallpaper);
}

/* Top Animated Progress Bar */
.progress-bar-container {
  width: 100%;
  flex-shrink: 0;
  background-color: var(--color-secondary-navy);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: var(--z-header);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.progress-text {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-light-gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  max-width: 180px;
  min-width: 60px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-left: 12px;
}

.progress-fill-bar {
  height: 100%;
  width: 12.5%;
  background: linear-gradient(90deg, var(--color-royal-gold), var(--color-saffron));
  border-radius: 3px;
  transition: width var(--transition-normal);
  -webkit-transition: width var(--transition-normal);
}

/* Header (100% WhatsApp Style) */
.wa-header {
  width: 100%;
  flex-shrink: 0;
  background-color: var(--color-primary-navy);
  height: var(--header-height);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: var(--z-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wa-contact-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.back-btn {
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  margin-right: -2px;
  flex-shrink: 0;
}

.avatar-wrapper {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--color-royal-gold);
  background-color: var(--color-secondary-navy);
  display: block;
}

.online-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background-color: var(--color-success-green);
  border: 2px solid var(--color-primary-navy);
  border-radius: 50%;
}

.contact-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.contact-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.contact-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-white);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verified-badge {
  color: var(--color-royal-gold);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.status-text {
  font-size: 11.5px;
  color: var(--color-light-gold);
  font-weight: 400;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--color-white);
  flex-shrink: 0;
}

.header-icon-btn {
  background: none;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
  -webkit-transition: color 0.2s, background-color 0.2s;
}

.header-icon-btn:hover {
  color: var(--color-white);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Chat Flow Scroll Area */
.chat-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px 24px 12px;
  z-index: var(--z-chat);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  width: 100%;
}

.chat-container::-webkit-scrollbar {
  width: 5px;
}

.chat-container::-webkit-scrollbar-thumb {
  background-color: rgba(11, 29, 58, 0.2);
  border-radius: 3px;
}

/* Date Separator Pill */
.date-separator {
  align-self: center;
  margin: 6px 0 12px 0;
  background-color: rgba(255, 255, 255, 0.94);
  color: #54656F;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: var(--wa-shadow);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Message Rows & Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.msg-row.incoming {
  align-items: flex-start;
}

.msg-row.outgoing {
  align-items: flex-end;
}

.bubble {
  max-width: 88%;
  padding: 9px 12px 6px 12px;
  border-radius: 10px;
  position: relative;
  box-shadow: var(--wa-shadow);
  font-family: var(--font-marathi);
  font-size: 14.5px;
  line-height: 1.48;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.msg-row.incoming .bubble {
  background-color: var(--wa-bubble-in);
  border-top-left-radius: 2px;
  color: var(--color-text-dark);
}

.msg-row.outgoing .bubble {
  background-color: var(--wa-bubble-out);
  border-top-right-radius: 2px;
  color: var(--color-text-dark);
}

/* WhatsApp Bubble Tails */
.msg-row.incoming .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid var(--wa-bubble-in);
  border-left: 8px solid transparent;
}

.msg-row.outgoing .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid var(--wa-bubble-out);
  border-right: 8px solid transparent;
}

.msg-meta {
  display: inline-flex;
  align-items: center;
  float: right;
  gap: 4px;
  margin-top: 4px;
  margin-left: 12px;
  font-size: 10.5px;
  color: #667781;
  font-family: var(--font-body);
}

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

/* Typing Indicator Bubble */
.typing-bubble {
  background-color: var(--wa-bubble-in);
  padding: 10px 14px;
  border-radius: 18px;
  border-top-left-radius: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  box-shadow: var(--wa-shadow);
  margin-bottom: 4px;
}

/* Interactive Option Cards & Touch Elements (Zero Typing) */
.interactive-card {
  background: #FFFFFF;
  border-radius: 14px;
  border: 1.5px solid #E2E8F0;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 100%;
}

.option-btn {
  min-height: var(--touch-target-min);
  width: 100%;
  background-color: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-marathi);
  font-size: 14px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.option-btn > span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  margin-right: 8px;
}

.option-btn > svg {
  flex-shrink: 0;
}

.option-btn.selected {
  border-color: var(--color-trust-green);
  background-color: #F0FDF4;
  color: #166534;
  font-weight: 600;
}

.option-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
}

.option-btn.selected .option-checkbox {
  background-color: var(--color-trust-green);
  border-color: var(--color-trust-green);
  color: white;
}

.submit-options-btn {
  min-height: var(--touch-target-min);
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--color-trust-green), #0D9488);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.submit-options-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  -webkit-transform: translateY(-1px);
}

/* AI Report Dashboard Card */
.report-card {
  background: linear-gradient(145deg, #FFFFFF, #F8FAFC);
  border: 1.5px solid var(--color-royal-gold);
  border-radius: 16px;
  padding: 16px;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(11, 29, 58, 0.12);
  width: 100%;
  max-width: 100%;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #FEF3C7;
  color: #92400E;
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.buruj-bar-container {
  margin-bottom: 10px;
}

.buruj-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 3px;
  gap: 6px;
}

.buruj-title-row > span:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.buruj-title-row > span:last-child {
  flex-shrink: 0;
}

.buruj-track {
  height: 7px;
  background-color: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.buruj-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
  -webkit-transition: width 1s ease-out;
}

/* CTA Choice Cards */
.cta-card-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.cta-choice-card {
  min-height: 48px;
  width: 100%;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-fast), filter var(--transition-fast);
  -webkit-transition: -webkit-transform var(--transition-fast), filter var(--transition-fast);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.cta-choice-card:hover {
  transform: translateY(-2px);
  -webkit-transform: translateY(-2px);
  filter: brightness(1.04);
}

.cta-card-green {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
}

.cta-card-gold {
  background: linear-gradient(135deg, #FDE047, #D4AF37);
  color: #713F12;
}

.cta-card-gray {
  background-color: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
}

/* FlowConnect Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  background-color: rgba(11, 29, 58, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  -webkit-transition: opacity 0.3s ease;
  padding: 16px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
}

.modal-header {
  background: linear-gradient(135deg, var(--color-primary-navy), var(--color-secondary-navy));
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body-iframe {
  width: 100%;
  height: 480px;
  max-height: 70vh;
  border: none;
  display: block;
}

.modal-footer {
  padding: 12px 16px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  text-align: center;
  flex-shrink: 0;
}

/* Footer Simulation (Zero Typing Hint) */
.wa-footer {
  width: 100%;
  flex-shrink: 0;
  height: 60px;
  background-color: var(--color-primary-navy);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: var(--z-footer);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-input-placeholder {
  flex: 1;
  min-width: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 13px;
  color: #94A3B8;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-trust-green);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  flex-shrink: 0;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-confetti);
}

