/* ============================================
   CHAT INTERFACE STYLES - RENATUS BRAND
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --renatus-navy: #0F0F0F;
  --renatus-pink: #FF38B2;
  --renatus-orange: #FFAD2D;
  --text-primary: #0F0F0F;
  --text-secondary: #848484;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F2F2F2;
  --bg-user-message: #F2F2F2;
  --border-color: #E4E4E4;
  --shadow: 0 1px 3px #0F0F0F;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  font-weight: 300;
  font-size: 1em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

strong, b {
  font-weight: 400;
}

/* ============================================
   HEADER
   ============================================ */

.chat-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(12px, 4vw, 38px);
  z-index: 1000;
}

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

.logo {
  height: 28px;
  width: auto;
}

.title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.desktop-title {
  display: inline;
}

.mobile-title {
  display: none;
}

.breadcrumb-divider {
  color: var(--text-secondary);
  font-weight: 400;
}

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

.header-right .menu-btn {
  margin-left: 3px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.header-btn:hover {
  background: var(--bg-secondary);
}

.menu-btn {
  padding: 8px;
}

/* ============================================
   CHAT CONTAINER
   ============================================ */

.chat-container {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  bottom: 0;
  overflow: hidden;
  padding: 0 24px;
  transition: all 0.4s ease-out;
}

/* Expand to full width when report is open */
.chat-container.with-report {
  left: 0;
  transform: none;
  max-width: 100%;
  padding: 0;
}

/* ============================================
   WELCOME SCREEN
   ============================================ */

.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
}

.welcome-content {
  max-width: 800px;
  width: 100%;
  text-align: center;
}

.welcome-title {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.5;
}

.welcome-subtitle {
  font-size: 1.8rem;
  font-weight: 350;
  color: #0F0F0F;
  margin-top: 0;
  margin-bottom: 3rem;
  line-height: 1.5;
}

.centered-input-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.input-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 20px 12px 12px 10px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  height: 100px;
}

.input-wrapper:focus-within {
  border-color: #CCCCCC;
}

.input-icon {
  color: var(--text-secondary);
  font-size: 18px;
  margin-right: 8px;
}

.initial-input,
.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 300;
  color: #848484;
  padding: 0 8px;
  align-self: flex-start;
  margin-top: 0;
}

.initial-input::placeholder,
.message-input::placeholder {
  color: #848484;
}

.submit-btn,
.send-btn {
  width: 56px;
  height: 36px;
  border-radius: 16px;
  border: none;
  background: var(--renatus-navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.submit-btn:hover,
.send-btn:hover {
  background: var(--renatus-pink);
  transform: scale(1.05);
}

.submit-btn:active,
.send-btn:active {
  transform: scale(0.95);
}

/* ============================================
   CHAT INTERFACE - 2 Panel Layout (Chat + Report)
   ============================================ */

.chat-interface {
  display: grid;
  grid-template-columns: 1fr 0fr;
  height: calc(100vh - 50px);
  position: relative;
  transition: grid-template-columns 0.4s ease-out;
}

/* When report opens: 3% left + 34% chat + 60% report + 3% right */
.chat-interface.with-report {
  grid-template-columns: 3% 34% 60% 3%;
}

.chat-interface.with-report .chat-pane {
  grid-column: 2;
}

.chat-interface.with-report .report-panel {
  grid-column: 3;
}

/* Chat Pane - contains messages + input, centered */
.chat-pane {
  grid-column: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  overflow: hidden;
}

/* ============================================
   MESSAGES AREA
   ============================================ */

.messages-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 140px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message Row - 2 Column Layout (ChatGPT style) */
.message {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  animation: messageSlideIn 0.3s ease-out;
  padding: 8px 0;
}

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

/* AI message appears in left column */
.message.ai-message .message-content {
  grid-column: 1;
}

/* User message appears in right column */
.message.user-message {
  grid-template-columns: 1fr 1fr;
}

.message.user-message .message-content {
  grid-column: 2;
}

.message-avatar {
  display: none;
}

.assistant-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.assistant-message .message-avatar {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.assistant-message .message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.assistant-message .message-content {
  flex: 1;
  max-width: 600px;
}

.message-content {
  background: var(--bg-primary);
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.6;
  color: #0F0F0F;
}

.message-content p {
  margin: 0 0 0.2rem 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.ai-message .message-content {
  background: transparent;
  border: none;
}

.user-message .message-content {
  background: #F2F2F2;
  color: var(--text-primary);
}

.message-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* When report is visible: stack messages vertically */
.chat-interface.with-report .message {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
}

.chat-interface.with-report .message.ai-message .message-content,
.chat-interface.with-report .message.user-message .message-content {
  grid-column: auto;
  align-self: flex-start;
}

.chat-interface.with-report .typing-indicator {
  display: flex;
  grid-template-columns: none;
}

/* Chat divider line */
.chat-divider {
  padding: 16px 0;
  width: 100%;
}

.chat-divider hr {
  border: none;
  border-top: 1px solid #E0E0E0;
  margin: 0;
}

.chat-interface.with-report .typing-dots {
  grid-column: auto;
}

/* Typing Indicator - 2 column layout */
.typing-indicator {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  padding: 8px 0;
}

.typing-dots {
  grid-column: 1;
  background: transparent;
  padding: 16px 20px;
  border-radius: 16px;
  display: flex;
  gap: 6px;
  width: fit-content;
}

.typing-dots span {
  width: 10px;
  height: 10px;
  background: var(--renatus-pink);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* ============================================
   REPORT PANEL
   ============================================ */

.report-panel {
  grid-column: 2;
  position: relative;
  height: calc(100vh - 50px);
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.report-panel::-webkit-scrollbar {
  display: none;
}

.report-panel.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Report Navigation Footer */
.report-nav-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 48px;
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
  border-top: 1px solid var(--border-color);
  z-index: 10;
}

.report-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: color 0.2s ease;
}

.report-nav-link:hover {
  color: var(--text-primary);
}

.report-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--renatus-pink);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.report-nav-btn:hover {
  background: #e62e9e;
  transform: translateY(-1px);
}

.report-nav-btn svg {
  stroke: white;
}

@media (max-width: 768px) {
  .report-nav-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 12px;
  }
  
  .report-nav-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   PROGRESSIVE REVEAL ANIMATIONS
   ============================================ */

/* CSS-based progressive reveal using animation */
.progressive-reveal {
  animation: fadeSlideIn 0.4s ease-out forwards;
  opacity: 0;
}

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

/* Framework sections get nice fade-in */
.framework-section > * {
  animation: fadeSlideIn 0.35s ease-out forwards;
  opacity: 0;
}

/* Stagger children within framework sections */
.framework-section > *:nth-child(1) { animation-delay: 0ms; }
.framework-section > *:nth-child(2) { animation-delay: 60ms; }
.framework-section > *:nth-child(3) { animation-delay: 120ms; }
.framework-section > *:nth-child(4) { animation-delay: 180ms; }
.framework-section > *:nth-child(5) { animation-delay: 240ms; }
.framework-section > *:nth-child(6) { animation-delay: 300ms; }
.framework-section > *:nth-child(7) { animation-delay: 360ms; }
.framework-section > *:nth-child(8) { animation-delay: 420ms; }
.framework-section > *:nth-child(9) { animation-delay: 480ms; }
.framework-section > *:nth-child(10) { animation-delay: 540ms; }
.framework-section > *:nth-child(n+11) { animation-delay: 600ms; }

.report-content {
  padding: 48px;
  max-width: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0F0F0F;
  font-size: 1em;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Report Title */
.report-content h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 24px 0;
  color: #0F0F0F;
}

.report-content hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 24px 0;
}

/* Framework Headers - Black, uppercase */
.report-content h2 {
  font-size: 1.1rem;
  font-weight: 550;
  margin: 64px 0 0 0;
  color: #0F0F0F;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Framework name - directly under framework header - Pink */
.report-content h2 + h3 {
  font-size: 1.1rem;
  font-weight: 400;
  margin: -2px 0 24px 0;
  color: #FF38B2;
}

/* Sub-headers */
.report-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 24px 0 12px 0;
  color: #0F1F54;
}

.report-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 8px 0;
  color: #0F0F0F;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.report-content p {
  margin: 0 0 12px 0;
  line-height: 1.6;
  font-size: 1em;
  font-weight: 300;
}

/* Pink bullet points */
.report-content ul {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}

.report-content ul li {
  margin: 8px 0;
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
  font-size: 1em;
  font-weight: 300;
}

.report-content ul li::before {
  content: "•";
  color: #FF38B2;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.report-content strong {
  font-weight: 500;
}

/* Sources */
.report-content p.sources {
  font-size: 0.8rem;
  color: #0F0F0F;
  font-style: italic;
}

/* Callout */
.report-content p.callout {
  border-left: 3px solid #FF38B2;
  border-right: 3px solid #FF38B2;
  border-radius: 20px;
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 350;
}

/* Tables */
.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.85rem;
}

.report-content th {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid #e5e5e5;
  font-weight: 600;
  font-size: 0.8rem;
  color: #0F0F0F;
  background: #fafafa;
}

.report-content td {
  padding: 10px 12px;
  border: 1px solid #e5e5e5;
  vertical-align: top;
}

/* Impact Tags */
.report-content .impact-high {
  font-weight: 700;
  color: #0F0F0F;
}

.report-content .impact-medium {
  font-weight: 600;
  color: #666;
}

/* Key Insight Box */
.report-content .key-insight {
  background: #f8f8f8;
  border-left: 3px solid #FF38B2;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 0.9rem;
}

/* Report Footer */
.report-content .report-footer {
  text-align: center;
  padding: 24px 0 0;
  margin-top: 40px;
  border-top: 1px solid #E4E4E4;
  color: #888;
  font-size: 0.8rem;
}

.report-meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 32px;
}

/* ============================================
   INPUT AREA (FIXED AT BOTTOM)
   ============================================ */

.input-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px 20px;
  background: linear-gradient(to top, var(--bg-primary) 80%, transparent);
}

.input-area .input-wrapper {
  width: 100%;
  max-width: 600px;
  height: 100px;
  border-radius: 24px;
  padding: 20px 12px 12px 10px;
  align-items: flex-end;
}

.input-area .message-input {
  align-self: flex-start;
  padding-top: 0;
}

.input-area .send-btn {
  margin-bottom: 0;
}

/* ============================================
   LOADING INDICATOR
   ============================================ */

.loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  padding: 24px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 2000;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 12px;
  height: 12px;
  background: var(--renatus-pink);
  border-radius: 50%;
  animation: loadingBounce 1.4s infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingBounce {
  0%, 60%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  30% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

/* ============================================
   ANALYSIS STATUS
   ============================================ */

.analysis-status {
  background: linear-gradient(135deg, var(--renatus-pink), var(--renatus-pink));
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin: 16px 0;
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

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

@media (max-width: 1024px) {
  /* On smaller screens, stack chat and report vertically */
  .chat-interface.with-report {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  
  .chat-interface.with-report .chat-pane {
    grid-row: 1;
  }
  
  .chat-interface.with-report .report-panel {
    grid-column: 1;
    grid-row: 2;
  }
}

@media (max-width: 768px) {
  .desktop-title {
    display: none;
  }
  
  .mobile-title {
    display: inline;
  }
  
  .welcome-screen {
    padding: 0.4rem 0.3rem;
  }
  
  .welcome-content {
    padding: 0 0.2rem;
  }
  
  .centered-input-container {
    max-width: 100%;
    padding: 0 16px;
  }
  
  .welcome-title {
    font-size: 2rem;
  }
  
  .welcome-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
  }
  
  .header-btn span {
    display: none;
  }
  
  .submit-btn,
  .send-btn {
    width: 44px;
    height: 32px;
  }
  
  .report-content {
    padding: 24px;
  }
  
  /* Mobile: stack messages vertically */
  .message {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  
  .message.user-message {
    align-items: flex-end;
  }
  
  .message.ai-message {
    align-items: flex-start;
  }
  
  .message.user-message .message-content,
  .message.ai-message .message-content {
    max-width: 85%;
    padding: 10px 16px;
  }
  
  .typing-indicator {
    display: flex;
  }
  
  /* Mobile keyboard fix - ensure input stays visible */
  .chat-interface {
    height: auto;
    min-height: calc(100vh - 50px);
    display: flex;
    flex-direction: column;
  }
  
  .chat-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* Space for fixed input */
  }
  
  .messages-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
  
  /* Add padding to messages to prevent overlap with fixed input */
  .messages-scroll {
    padding: 16px 12px 20px 12px;
  }
  
  /* Mobile: Fixed input at bottom */
  .input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
  }
  
  /* When keyboard is open on iOS, switch to absolute positioning */
  body.keyboard-open .input-area {
    position: absolute;
  }
  
  .chat-pane {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    overflow-y: auto;
    padding-bottom: 80px;
  }
  
  .messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .input-area .input-wrapper {
    height: 56px;
    padding: 10px 12px;
    border-radius: 28px;
  }
  
  .input-area .message-input {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
  
  /* Welcome screen input adjustments */
  .welcome-screen .input-wrapper {
    height: 80px;
    padding: 16px 12px 12px 10px;
  }
  
  /* MOBILE REPORT MODE: When report is open, show report full-width and hide chat */
  .chat-interface.with-report {
    display: block;
  }
  
  .chat-interface.with-report .chat-pane {
    display: none;
  }
  
  .chat-interface.with-report .report-panel {
    display: block;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    z-index: 100;
    border-left: none;
  }
  
  .chat-interface.with-report .report-panel.visible {
    opacity: 1;
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

/* Hide scrollbar for chat messages */
.messages-scroll {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.messages-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Keep scrollbar visible for report panel */
.report-panel::-webkit-scrollbar {
  width: 8px;
}

.report-panel::-webkit-scrollbar-track {
  background: transparent;
}

.report-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.report-panel::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ============================================
   FRAMEWORK REVEAL ANIMATIONS
   ============================================ */

.framework-placeholder {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.framework-revealed {
  animation: frameworkFadeIn 0.6s ease-out forwards;
}

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

/* Shimmer animation for placeholders */
.shimmer-line {
  background: linear-gradient(90deg, #F2F2F2 25%, #E8E8E8 50%, #F2F2F2 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   TABLE MODAL (Mobile tap-to-expand)
   ============================================ */

.table-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.table-modal {
  background: var(--bg-primary);
  border-radius: 12px;
  max-width: 95vw;
  max-height: 85vh;
  overflow: auto;
  padding: 20px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.table-modal-overlay.visible .table-modal {
  transform: scale(1);
}

.table-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  z-index: 10;
}

.table-modal-close:hover {
  background: var(--border-color);
}

.table-modal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-modal th,
.table-modal td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table-modal th {
  font-weight: 600;
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
}

/* Mobile: Make tables tappable */
@media (max-width: 768px) {
  .report-content table {
    cursor: pointer;
    position: relative;
  }
  
  .report-content table::after {
    content: 'Tap to expand';
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
  }
  
  .report-content table:active {
    opacity: 0.8;
  }
}

/* ============================================
   HISTORY DOTS BUTTON
   ============================================ */

.history-dots-btn {
  position: fixed;
  top: calc(50px + 16px);
  right: 24px;
  z-index: 150;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: none;
}

.history-dots-btn.visible {
  display: block !important;
}

.history-dots-btn:hover {
  background: var(--bg-secondary);
}

@media (max-width: 768px) {
  .history-dots-btn.visible {
    display: block !important;
    top: calc(50px + 12px);
    right: 16px;
    padding: 6px 10px;
    font-size: 18px;
  }
}

/* ============================================
   REPORT HEADER (Mobile + Desktop)
   ============================================ */

.report-header-mobile {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  .report-header-mobile {
    display: flex;
  }
  
  .report-content {
    padding-top: 0;
  }
}

.back-to-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  margin-left: -12px;
  border-radius: 8px;
}

.back-to-chat-btn:hover {
  background: var(--bg-secondary);
}

.back-to-chat-btn svg {
  color: var(--renatus-pink);
}

.report-header-actions {
  display: flex;
  gap: 4px;
}

.report-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
}

.report-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.report-action-btn:active {
  background: var(--border-color);
}

/* ============================================
   HISTORY PANEL
   ============================================ */

.history-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.history-panel-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.history-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--bg-primary);
  z-index: 1600;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.history-panel-overlay.visible .history-panel {
  transform: translateX(0);
}

.history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.history-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.history-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
}

.history-close-btn:hover {
  background: var(--bg-secondary);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.history-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.history-item:hover {
  background: var(--bg-secondary);
}

.history-item.active {
  background: var(--bg-secondary);
  border-color: var(--renatus-pink);
}

.history-item-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.history-item-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.history-new-btn {
  margin: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--renatus-pink), var(--renatus-orange));
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ============================================
   STANDALONE REPORT PREVIEW STYLES
   Used by /preview/* routes for marketing previews
   ============================================ */

/* Report Container - standalone pages only */
.report-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0F0F0F;
  background: #fff;
}

/* Report Logo */
.report-logo {
  text-align: right;
  margin-bottom: 62px;
}

.report-logo img {
  height: 32px;
  width: auto;
}

/* Report Header */
.report-header {
  margin-bottom: 24px;
}

.report-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: #0F0F0F;
  text-transform: uppercase;
}

.report-header p {
  font-size: 1.1rem;
  margin: 0 0 12px 0;
}

.report-header p:last-child {
  font-size: 0.95rem;
  font-style: italic;
  margin: 0;
  color: #0F0F0F;
}

/* Pink Divider */
.divider,
hr.divider {
  width: 50px;
  height: 2px;
  background-color: #FF38B2;
  border: none;
  margin-left: 0;
}

/* Report Intro */
.report-intro {
  margin-bottom: 32px;
}

.report-intro p {
  font-weight: 300;
  line-height: 1.6;
  margin: 0 0 16px 0;
  color: #0F0F0F;
}

.report-intro strong {
  font-weight: 500;
  color: #0F0F0F;
}

/* Framework Headers */
.framework-header,
h2.framework-header {
  font-size: 1.1rem;
  font-weight: 550;
  margin: 64px 0 0 0;
  color: #0F0F0F;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Framework Subtitles - Pink */
.framework-subtitle,
h3.framework-subtitle {
  font-size: 1.1rem;
  font-weight: 400;
  margin: -2px 0 24px 0;
  color: #FF38B2;
}

/* Framework Explanation Text */
.framework-explanation p,
.framework-prose p {
  margin: 0 0 12px 0;
  line-height: 1.6;
  font-weight: 300;
  color: #0F0F0F;
}

/* Custom Bullet Lists */
.framework-explanation ul,
.framework-prose ul {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}

.framework-explanation ul li,
.framework-prose ul li {
  margin: 8px 0;
  padding-left: 20px;
  position: relative;
  font-weight: 300;
}

.framework-explanation ul li::before,
.framework-prose ul li::before {
  content: "•";
  color: #FF38B2;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.framework-explanation ul li strong,
.framework-prose ul li strong {
  font-weight: 500;
}

/* Chart Containers */
.chart-container {
  margin: 24px 0;
  background: #f9f9f9;
  border-radius: 12px;
  padding: 24px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder {
  text-align: center;
  color: #848484;
}

.chart-placeholder svg {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
}

.data-table th {
  background: #f5f5f5;
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  border-bottom: 2px solid #E4E4E4;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #E4E4E4;
}

/* CTA Box */
.unlock-cta {
  background: linear-gradient(135deg, #FF38B2 0%, #FF6B9D 100%);
  color: white;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  margin: 48px 0;
}

.unlock-cta h3 {
  margin: 0 0 12px 0;
  font-weight: 600;
}

.unlock-cta p {
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.unlock-btn {
  display: inline-block;
  background: white;
  color: #FF38B2;
  padding: 12px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.unlock-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Shimmer Loading Animation */
.shimmer-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.shimmer-block {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Redacted/Hidden Text */
.redacted {
  background: #0F0F0F;
  color: #0F0F0F;
  padding: 0 4px;
  border-radius: 2px;
  user-select: none;
}

/* Key Takeaways Section */
.key-takeaways {
  margin-top: 64px;
  padding: 24px;
  background: #F8F8F8;
  border-radius: 12px;
}

.key-takeaways h2 {
  font-size: 1.1rem;
  font-weight: 550;
  margin: 0 0 16px 0;
  color: #0F0F0F;
  text-transform: uppercase;
}

.key-takeaways ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.key-takeaways li {
  margin: 12px 0;
  padding-left: 20px;
  position: relative;
  font-weight: 300;
  line-height: 1.6;
}

.key-takeaways li::before {
  content: "•";
  color: #FF38B2;
  font-weight: bold;
  position: absolute;
  left: 0;
}
