/* 
 * Preview Styles
 * Extracted from main styles for CMS Live Preview
 * Contains only variables and dialogue rendering styles
 */

@import url("https://fonts.googleapis.com/css2?family=Padauk:wght@400;700&family=Inter:wght@400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Cal+Sans&display=swap");

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #f0abfc;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --card-bg: #01031f;
  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --highlight-bg: rgba(99, 102, 241, 0.3);
  --bubble-bd: black;
  --glass: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  /* Reset body for the preview iframe context if needed, 
     though usually this runs in a div within the CMS */
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text-primary);
}

/* Dialogue Container */
.dialogue-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.dialogue-line {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

/* Alignment */
.dialogue-line.other-speaker {
  align-self: flex-start;
}

.dialogue-line.main-speaker {
  align-self: flex-end;
}

/* Group Spacing */
.dialogue-line.group-start {
  margin-top: 24px;
}
.dialogue-line.group-inner,
.dialogue-line.group-last {
  margin-top: -18px;
}

/* Speech Bubbles */
.speech-bubble {
  padding: 20px 24px;
  font-size: 1.25rem;
  line-height: 1.8;
  position: relative;
  min-width: 300px;
}

/* Other Speaker Styles */
.other-speaker .speech-bubble {
  border-radius: 40px 40px 40px 0;
  border: 6px solid var(--bubble-bd);
  background: #020422;
}

.other-speaker.group-start .speech-bubble {
  border-radius: 40px 40px 40px 6px;
}
.other-speaker.group-inner .speech-bubble {
  border-radius: 6px 40px 40px 6px;
}
.other-speaker.group-last .speech-bubble {
  border-radius: 6px 40px 40px 40px;
}

/* Main Speaker Styles */
.main-speaker .speech-bubble {
  border-radius: 40px 40px 0 40px;
  border: 6px solid #0000005c;
  background: #12122c;
}

.main-speaker.group-start .speech-bubble {
  border-radius: 40px 40px 6px 40px;
}
.main-speaker.group-inner .speech-bubble {
  border-radius: 40px 6px 6px 40px;
}
.main-speaker.group-last .speech-bubble {
  border-radius: 40px 6px 40px 40px;
}

/* Speaker Info */
.speaker-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.chat-layout .main-speaker .speaker-info {
  flex-direction: row-reverse;
}

.speaker-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-card);
}

.speaker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.speaker-name {
  font-weight: 500;
  font-size: 1.05rem;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* Content */
.speech-content {
  display: flex;
  flex-direction: column;
}

.dialogue-text {
  display: none;
}
.dialogue-text.active {
  display: block;
}
.dialogue-text.mm {
  font-family: "Padauk", sans-serif;
  line-height: 2;
}

/* Expressions */
.expression {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.expression:hover {
  background: var(--highlight-bg);
  text-decoration-color: var(--accent);
}

/* Script Layout Overrides */
.script-layout .speech-content {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: flex-start;
  flex-direction: row;
}

/* Mobile Responsive */
@media (max-width: 513px) {
  .dialogue-container {
    padding: 0;
    gap: 20px;
  }
  .dialogue-line {
    max-width: 90%;
  }
  .speech-bubble {
    padding: 16px 18px;
    font-size: 1.1rem;
    min-width: auto;
  }
}
