/* ============================================
   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: #FF1B8D;
  --renatus-purple: #FF38B2;
  --renatus-orange: #FF8C42;
  --text-primary: #0F0F0F;
  --text-secondary: #64748B;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-user-message: #F1F3F9;
  --border-color: #E4E4E4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

* {
  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.3rem;
}

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

.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: var(--renatus-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.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-purple);
  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-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-purple);
  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;
  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;
}

/* ============================================
   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-purple);
  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-purple), 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;
  }
  
  .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%;
  }
  
  .typing-indicator {
    display: flex;
  }
}

/* ============================================
   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; }
}
