/* =========================================================
   Self-hosted fonts (latin subset, woff2)
   Replaces the Google Fonts CDN so the module runs offline
   and inside sandboxed LMS environments.
   ========================================================= */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/montserrat-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/montserrat-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/montserrat-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/montserrat-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/opensans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/opensans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/opensans-700.woff2') format('woff2');
}

:root {
  --primary: #241D7A;
  --cyan: #68EDE6;
  --purple: #834CFC;
  --pink: #FA7A95;
  --yellow: #FFBC26;
  --bg: #F4F7FB;
  --text: #1D1D1F;
  --muted: #6B7280;
  --white: #FFFFFF;
  --success: #1FA971;
  --danger: #D64545;
  --border: #E5E7EB;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFC 100%);
  color: var(--text);
  overflow-x: hidden;
  /* Prevent iOS/Android auto-inflating text on rotate, and keep
     smooth momentum scrolling on touch devices. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

.module-shell {
  min-height: 100vh;
  min-height: 100dvh; /* dvh tracks the mobile browser chrome height */
  display: flex;
  flex-direction: column;
}

.progress-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.5);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  backdrop-filter: blur(6px);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--purple), var(--cyan));
  transition: width 0.5s ease;
}

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 70px 24px 90px;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: flex;
}

.card {
  width: 100%;
  max-width: 1100px;
  background: rgba(255,255,255,0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.7);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  min-height: 680px;
}

.hero-left {
  padding: 70px;
  background: linear-gradient(135deg, rgba(36,29,122,1) 0%, rgba(62,53,165,1) 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-left::before,
.hero-left::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}

.hero-left::before {
  width: 280px;
  height: 280px;
  background: var(--cyan);
  top: -60px;
  right: -100px;
}

.hero-left::after {
  width: 220px;
  height: 220px;
  background: var(--pink);
  bottom: -80px;
  left: -70px;
}

.hero-right {
  padding: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FCFCFF;
}

.logo {
  width: 240px;
  margin-bottom: 40px;
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
}

h1 {
  font-size: clamp(2rem, 5vw + 0.5rem, 3rem);
  line-height: 1.1;
  margin-bottom: 24px;
  font-weight: 800;
}

.hero-left p {
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 580px;
  margin-bottom: 20px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 34px;
}

.pill {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
}

.primary-btn,
.option-btn,
.secondary-btn {
  display: block;
  margin: 0 auto;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Montserrat', sans-serif;
  /* Accessible tap target on touch devices (>= 48x48). */
  min-height: 48px;
  touch-action: manipulation;
}

.primary-btn {
  background: white;
  color: var(--primary);
  padding: 18px 32px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.primary-btn:hover {
  transform: translateY(-2px);
}

.info-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(36,29,122,0.08);
}

.info-panel h3 {
  color: var(--primary);
  margin-bottom: 22px;
  font-size: 1.4rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.info-item {
  background: var(--bg);
  padding: 18px;
  border-radius: 16px;
}

.info-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(104,237,230,0.14);
  color: var(--primary);
  font-weight: 700;
}

.skill::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
}

.platform-screen {
  background: linear-gradient(180deg, #E8ECFF 0%, #F7F9FD 100%);
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.platform {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  animation: zoomIn 0.6s ease;
}

.sidebar {
  background: var(--primary);
  color: white;
  padding: 30px 24px;
  position: relative;
}

.sidebar .logo {
  width: 170px;
  margin-bottom: 40px;
}

.nav-item {
  padding: 16px 18px;
  border-radius: 14px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.08);
  font-weight: 600;
}

.nav-item.active {
  background: white;
  color: var(--primary);
}

.workspace {
  /* Extra bottom padding clears the fixed footer so the last
     response option is never hidden behind it. */
  padding: 34px 34px 80px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

.workspace-header h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  color: var(--primary);
}

.status-badge {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(250,122,149,0.16);
  color: #C83B63;
  font-weight: 700;
  font-size: 0.9rem;
}

.message-thread {
  background: white;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
}

.thread-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 10px;
  flex-wrap: wrap;
}

.thread-title h3 {
  color: var(--primary);
}

.message {
  max-width: 80%;
  padding: 16px 18px;
  border-radius: 18px;
  margin-bottom: 16px;
  line-height: 1.6;
  position: relative;
  overflow-wrap: break-word;
  word-break: break-word;
  animation: fadeUp 0.35s ease;
}

.new-message {
  animation: newMessagePop 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  border: 3px solid rgba(250,122,149,0.45);
  background: linear-gradient(135deg, rgba(250,122,149,0.18), rgba(250,122,149,0.08));
  position: relative;
}

.new-message::after {
  content: 'NEW MESSAGE';
  position: absolute;
  top: -12px;
  right: 14px;
  background: var(--pink);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  box-shadow: 0 6px 16px rgba(250,122,149,0.35);
}

.client {
  background: rgba(250,122,149,0.12);
  border-top-left-radius: 6px;
}

.agent {
  background: rgba(104,237,230,0.18);
  margin-left: auto;
  border-top-right-radius: 6px;
}

.timestamp {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.question-block {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.question-block h4 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.2rem;
  margin-bottom: 18px;
  color: var(--primary);
}

.options {
  display: grid;
  gap: 16px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: white;
  border: 2px solid #E5E7EB;
  padding: 20px;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
}

.option-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(36,29,122,0.08);
}

.feedback-modal,
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  backdrop-filter: blur(5px);
}

.feedback-modal.active,
.call-overlay.active {
  display: flex;
}

.feedback-box,
.call-box {
  width: 100%;
  max-width: 700px;
  background: white;
  border-radius: 28px;
  padding: 36px;
  box-shadow: var(--shadow);
  animation: scaleIn 0.3s ease;
  /* Keep long feedback + its button reachable on short screens:
     the box never exceeds the viewport and scrolls internally. */
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.feedback-box h3,
.call-box h3 {
  margin-bottom: 18px;
  color: var(--primary);
  font-size: 1.6rem;
  text-align: center;
}

.feedback-box p,
.call-box p {
  line-height: 1.8;
  margin-bottom: 24px;
  color: #374151;
  text-align: center;
}

.secondary-btn {
  background: var(--primary);
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

.secondary-btn:hover {
  opacity: 0.92;
}

.call-screen {
  padding: 40px;
  background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFC 100%);
}

.call-layout {
  max-width: 1100px;
  width: 100%;
  margin: auto;
}

.call-panel {
  background: white;
  border-radius: 28px;
  padding: 40px;
  box-shadow: var(--shadow);
}

.incoming-call {
  display: none;
  margin-bottom: 28px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), #4539B8);
  color: white;
  padding: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  animation: pulseCall 1.2s infinite;
}

.incoming-call.active {
  display: flex;
}

.caller-details h3 {
  color: white;
  margin-bottom: 8px;
}

.pickup-btn {
  background: white;
  color: var(--primary);
  border: none;
  padding: 16px 24px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  min-height: 48px;
  touch-action: manipulation;
}

.audio-section {
  display: none;
}

.audio-section.active {
  display: block;
}

.audio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.audio-card {
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  transition: all 0.25s ease;
}

.audio-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.audio-card h4 {
  margin-bottom: 14px;
  color: var(--primary);
  font-family: 'Montserrat', sans-serif;
}

audio {
  width: 100%;
  margin: 14px 0 18px;
}

.audio-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  min-height: 48px;
  touch-action: manipulation;
}

.insight-screen,
.takeaway-screen {
  text-align: center;
  padding: 40px;
}

.insight-card,
.takeaway-card {
  max-width: 950px;
  background: white;
  border-radius: 32px;
  padding: 70px 50px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.insight-card::before,
.takeaway-card::before {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  background: rgba(131,76,252,0.08);
  border-radius: 50%;
  top: -100px;
  right: -80px;
}

.quote {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.75rem, 5vw + 0.5rem, 3rem);
  line-height: 1.3;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 28px;
}

.quote-highlight {
  color: var(--purple);
}

.insight-text {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.8;
  max-width: 720px;
  margin: auto;
}

.takeaway-title {
  font-size: clamp(1.75rem, 4vw + 0.5rem, 2.5rem);
  color: var(--primary);
  margin-bottom: 24px;
}

.takeaway-flow {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 40px 0;
}

.takeaway-pill {
  padding: 22px 28px;
  border-radius: 20px;
  color: white;
  font-weight: 800;
  font-size: 1.15rem;
  font-family: 'Montserrat', sans-serif;
  min-width: 220px;
}

.takeaway-pill:nth-child(1) {
  background: var(--primary);
}

.takeaway-pill:nth-child(3) {
  background: var(--purple);
}

.takeaway-pill:nth-child(5) {
  background: var(--cyan);
  color: var(--primary);
}

.arrow {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
}

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 14px 20px;
  /* Respect the iOS home-indicator safe area. */
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,0.05);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  z-index: 998;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes newMessagePop {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.85);
    box-shadow: 0 0 0 rgba(250,122,149,0);
  }
  40% {
    opacity: 1;
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 0 35px rgba(250,122,149,0.45);
  }
  70% {
    transform: translateY(4px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(250,122,149,0);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(1.02);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulseCall {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   One code base, three tiers:
     <= 960px  tablets / small laptops  (stack the 2-col grids)
     <= 768px  phones (primary mobile target)
     <= 480px  small phones in portrait
   Fluid clamp() typography above handles the in-between sizes.
   ========================================================= */

/* ---- Tablet: collapse the two-column layouts to one ---- */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-left,
  .hero-right {
    padding: 40px 30px;
  }

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

  .sidebar {
    display: none;
  }

  .audio-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Phone: primary mobile experience ---- */
@media (max-width: 768px) {
  .screen {
    padding: 66px 16px 92px;
  }

  .card {
    border-radius: 22px;
  }

  .hero-left,
  .hero-right {
    padding: 34px 22px;
  }

  .logo {
    width: 190px;
    margin-bottom: 28px;
  }

  .info-panel {
    padding: 26px 22px;
  }

  /* Message screen */
  .platform-screen {
    padding: 0;
  }

  .workspace {
    padding: 22px 16px 84px;
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .message-thread {
    padding: 20px 18px;
    border-radius: 20px;
  }

  .message {
    max-width: 92%;
  }

  .option-btn {
    padding: 16px;
    font-size: 0.98rem;
  }

  /* Call screen */
  .call-screen {
    padding: 66px 16px 92px;
  }

  .call-panel {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .incoming-call {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 24px 20px;
    gap: 18px;
  }

  .pickup-btn {
    width: 100%;
  }

  /* Feedback / call modals */
  .feedback-box,
  .call-box {
    padding: 26px 22px;
    border-radius: 22px;
  }

  .feedback-box h3,
  .call-box h3 {
    font-size: 1.4rem;
  }

  /* Insight + takeaway */
  .insight-screen,
  .takeaway-screen {
    padding: 66px 16px 92px;
  }

  .insight-card,
  .takeaway-card {
    padding: 44px 24px;
    border-radius: 24px;
  }

  .takeaway-flow {
    flex-direction: column;
    gap: 14px;
  }

  .takeaway-pill {
    width: 100%;
    min-width: 0;
  }

  .arrow {
    transform: rotate(90deg);
  }

  /* Full-width primary CTAs are easier to tap one-handed */
  .primary-btn,
  .secondary-btn {
    width: 100%;
    max-width: 360px;
  }
}

/* ---- Small phones in portrait ---- */
@media (max-width: 480px) {
  .screen {
    padding: 62px 12px 90px;
  }

  .hero-left,
  .hero-right {
    padding: 28px 18px;
  }

  .logo {
    width: 160px;
  }

  .pill {
    font-size: 0.85rem;
    padding: 8px 14px;
  }

  .workspace {
    padding: 18px 12px 84px;
  }

  .message-thread {
    padding: 16px 14px;
  }

  .message {
    max-width: 100%;
  }

  .option-btn {
    padding: 14px;
  }

  .question-block h4 {
    font-size: 1.1rem;
  }

  .call-panel {
    padding: 20px 14px;
  }

  .feedback-box,
  .call-box {
    padding: 22px 18px;
  }

  .insight-card,
  .takeaway-card {
    padding: 36px 18px;
  }

  .takeaway-pill {
    padding: 18px 20px;
    font-size: 1rem;
  }
}
