@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Estedad:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&family=Vazirmatn:wght@400;500;600;700&display=swap");

:root {
  --sidebar-width: 260px;
  --ink: #49363f;
  --paper: #fbf5f0;
  --card: #fffdf9;
  --pink: #c9859b;
  --pink-light: #f1dfe2;
  --line: #e6d7d1;
  --muted: #8d777b;
  --lavender: #eee4e4;
  --dark-card: #49363f;
  --dark-section: #624750;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 85% 8%,
      #f3e1e1 0,
      transparent 25rem
    ),
    radial-gradient(
      circle at 10% 80%,
      #f4e8dc 0,
      transparent 22rem
    ),
    var(--paper);
  font-family: "Space Grotesk", Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(#8d6172 0.5px, transparent 0.5px);
  background-size: 8px 8px;
}

.chat-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--sidebar-width);
  padding: 24px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 247, 0.96);
  transition: width 0.2s ease, transform 0.25s ease;
}

#sidebar-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  z-index: 30;
  width: 10px;
  height: 100%;
  cursor: col-resize;
}

#sidebar-resizer:hover {
  background: var(--pink);
  opacity: 0.45;
}

.new-chat,
.sidebar-toggle {
  display: flex;
  width: 100%;
  margin: 0 0 18px;
  padding: 12px;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-toggle {
  margin-bottom: 18px;
  background: var(--pink-light);
  color: var(--ink);
}

.history-title {
  margin: 12px 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-list {
  display: grid;
  gap: 8px;
}

.chat-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.chat-item:hover,
.chat-item.active {
  border-color: var(--ink);
  background: var(--lavender);
}

.chat-item strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.history-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1180px, calc(100vw - var(--sidebar-width) - 80px));
  margin-left: calc(var(--sidebar-width) + 40px);
  padding: 56px 0 80px;
  position: relative;
  transition: width 0.2s ease, margin 0.2s ease;
}

header {
  margin-bottom: 30px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--ink);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.language-toggle {
  width: auto;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--pink-light);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.language-toggle:hover {
  background: var(--pink);
}

h1 {
  max-width: 900px;
  margin: 26px 0 22px;
  font: 400 clamp(45px, 8vw, 92px) / 0.9 "DM Serif Display", Georgia, serif;
  letter-spacing: -0.045em;
}

h1 em {
  color: #a96f83;
}

header p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: start;
  gap: 26px;
}

.panel {
  padding: 30px;
  border: 1px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 250, 247, 0.95);
  box-shadow: 9px 9px 0 var(--ink);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.panel-title > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--lavender);
  font-size: 12px;
  font-weight: 700;
}

h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-transform: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 13px;
  outline: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font: 15px "Space Grotesk", Arial, sans-serif;
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px #e889a833;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button,
#download-video {
  display: flex;
  width: 100%;
  margin-top: 16px;
  padding: 17px;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

button:hover,
#download-video:hover {
  background: #c9859b;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.copy {
  background: var(--pink-light);
  color: var(--ink);
}

.output-panel {
  position: sticky;
  top: 24px;
  align-self: start;
}

.empty {
  min-height: 470px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty div {
  color: var(--pink);
  font-size: 44px;
}

#agents {
  display: none !important;
}

.final-card {
  padding: 26px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--dark-card);
  color: white;
}

.final-card > small {
  color: #ffd9e7;
}

.output-sections {
  display: grid;
  gap: 12px;
}

.output-section {
  padding: 16px;
  border: 1px solid #815267;
  border-radius: 10px;
  background: var(--dark-section);
}

.output-label {
  margin-bottom: 8px;
  color: #ffd9e7;
  font-size: 12px;
  font-weight: 700;
}

.output-value {
  white-space: pre-wrap;
  color: #fff7fa;
  font: 15px/1.8 "Space Grotesk", Arial, sans-serif;
}

#video-status {
  min-height: 24px;
  margin-top: 14px;
  color: #ffd9e7;
  font-size: 13px;
}

#video-player {
  display: block;
  width: 100%;
  max-height: 560px;
  margin-top: 18px;
  border-radius: 10px;
  background: #000;
}

.show-sidebar {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 40;
  width: auto;
  margin: 0;
  padding: 10px 14px;
  background: var(--pink-light);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

body.sidebar-hidden .chat-sidebar {
  transform: translateX(-110%);
}

body.sidebar-hidden main {
  width: min(1180px, 92vw);
  margin-right: auto;
  margin-left: auto;
}

[dir="rtl"] body,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea,
[dir="rtl"] button,
[dir="rtl"] .chat-sidebar,
[dir="rtl"] .chat-item,
[dir="rtl"] #download-video {
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] label,
[dir="rtl"] .panel-title,
[dir="rtl"] .eyebrow {
  font-family: "Estedad", "Vazirmatn", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

[dir="rtl"] main {
  margin-right: calc(var(--sidebar-width) + 40px);
  margin-left: 40px;
}

[dir="rtl"] .chat-sidebar {
  right: 0;
  left: auto;
  border-right: 0;
  border-left: 1px solid var(--line);
}

[dir="rtl"] .chat-item {
  text-align: right;
}

[dir="rtl"] #sidebar-resizer {
  right: auto;
  left: -5px;
}

[dir="rtl"] .show-sidebar {
  right: 18px;
  left: auto;
}

[dir="rtl"] body.sidebar-hidden .chat-sidebar {
  transform: translateX(110%);
}

[dir="rtl"] body.sidebar-hidden main {
  margin-right: auto;
  margin-left: auto;
}

@media (max-width: 900px) {
  .chat-sidebar {
    position: static;
    width: 100% !important;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #sidebar-resizer {
    display: none;
  }

  main,
  [dir="rtl"] main {
    width: 100%;
    margin: 0;
    padding: 35px 20px 60px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .output-panel {
    position: static;
  }

  body.sidebar-hidden .chat-sidebar,
  [dir="rtl"] body.sidebar-hidden .chat-sidebar {
    display: none;
  }

  body.sidebar-hidden main,
  [dir="rtl"] body.sidebar-hidden main {
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 600px) {
  .row {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 56px;
  }
}
.chat-sidebar {
  container-type: inline-size;
}

.chat-list,
.chat-item {
  min-width: 0;
}

.chat-item {
  height: auto;
  text-align: left;
}

.chat-item strong {
  display: block;
  width: 100%;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
  font-size: 12px;
}

.chat-item small {
  white-space: normal;
  line-height: 1.4;
}

@container (max-width: 240px) {
  .chat-item {
    padding: 8px;
  }

  .chat-item strong {
    font-size: 11px;
    line-height: 1.45;
  }

  .chat-item small {
    font-size: 9px;
  }
}

@container (min-width: 360px) {
  .chat-item {
    padding: 12px;
  }

  .chat-item strong {
    font-size: 14px;
  }

  .chat-item small {
    font-size: 11px;
  }
}

[dir="rtl"] .chat-item {
  text-align: right;
ُ}
/* Final user-facing assessment is separate from copyable publishing content. */
[hidden] { display: none !important; }
.final-rating { padding: 22px; margin-bottom: 20px; border: 1px solid #d6d9cd; border-radius: 16px; background: #f4f7ee; color: #21352d; }
.final-rating h3 { margin-top: 0; }
.rating-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rating-cell { padding: 12px; border-radius: 10px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.rating-cell strong { font-size: 22px; direction: ltr; }
.output-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.copy-section { width: auto; padding: 6px 12px; font-size: 12px; margin: 0; }
.output-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.uploaded-file label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.uploaded-file input[type="checkbox"] { width: auto; }
@media(max-width: 600px) { .rating-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.social-panel { margin-top: 24px; padding: 20px; border: 1px solid #526080; border-radius: 12px; }
.social-panel label { display: block; margin: 12px 0; }
.social-panel textarea { width: 100%; box-sizing: border-box; }
.social-panel button { margin: 6px; padding: 9px 14px; }
.social-panel .social-check { display: flex; gap: 8px; align-items: center; }
.social-panel .social-check input { width: auto; }
.social-panel video { max-width: 100%; max-height: 400px; }
.social-panel [hidden] { display: none !important; }
