:root {
  --font-size-system: 14px; /* base 16px - 2 */
  --bg-deep: #0a0e17;
  --bg-surface: rgba(15, 23, 42, 0.72);
  --bg-surface-hover: rgba(30, 41, 59, 0.85);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --text-primary: #f1f5f9;
  --text-secondary: rgba(241, 245, 249, 0.85);
  --text-muted: rgba(241, 245, 249, 0.6);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.25);
  --accent-strong: rgba(59, 130, 246, 0.4);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.35);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--font-size-system);
  color: var(--text-primary);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(10, 14, 23, 0.6) 0%, rgba(10, 14, 23, 0.85) 100%),
    url("/background/PILbackground.png");
  background-size: cover;
  background-position: center;
  padding: 24px;
}

/* ----- Top controls ----- */
.top-left {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
}

.language-select {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-strong);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  color: #0f172a;
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
  transition: transform var(--transition), box-shadow var(--transition);
}

.language-select:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.language-select-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.language-select select {
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
}

.language-select select:focus {
  outline: none;
}

.cc-button {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--glass-strong);
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
  transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
}

.cc-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.cc-button.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.cc-button.active:hover {
  background: var(--accent-hover);
}

/* ----- Tooltips (short descriptions on hover) ----- */
[data-tooltip] {
  position: relative;
}

/* Keep CC button in top-right; tooltip rule must not override its position */
.cc-button {
  position: absolute;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.2s;
  transition-delay: 0.35s;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.12s;
}

/* Tooltip bubble */
[data-tooltip]::after {
  content: attr(data-tooltip);
  transform: translateX(-50%) translateY(6px);
  bottom: 100%;
  margin-bottom: 10px;
  padding: 8px 14px;
  max-width: 220px;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  border-radius: 10px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

[data-tooltip]:hover::after {
  transform: translateX(-50%) translateY(0);
}

/* Tooltip arrow */
[data-tooltip]::before {
  content: "";
  transform: translateX(-50%) translateY(6px);
  bottom: 100%;
  margin-bottom: 2px;
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.95);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

[data-tooltip]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* Bottom-positioned tooltips (for top bar elements) */
[data-tooltip][data-tooltip-position="bottom"]::after {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 10px;
  transform: translateX(-50%) translateY(-6px);
}

[data-tooltip][data-tooltip-position="bottom"]:hover::after {
  transform: translateX(-50%) translateY(0);
}

[data-tooltip][data-tooltip-position="bottom"]::before {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 2px;
  border-top-color: transparent;
  border-bottom-color: rgba(15, 23, 42, 0.95);
  transform: translateX(-50%) translateY(-6px);
}

[data-tooltip][data-tooltip-position="bottom"]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* Right-positioned tooltip (e.g. CC button) */
[data-tooltip][data-tooltip-position="right"]::after {
  left: 100%;
  top: 50%;
  margin-left: 10px;
  margin-bottom: 0;
  bottom: auto;
  transform: translateY(-50%) translateX(-6px);
}

[data-tooltip][data-tooltip-position="right"]:hover::after {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip][data-tooltip-position="right"]::before {
  left: 100%;
  top: 50%;
  margin-left: 2px;
  margin-bottom: 0;
  bottom: auto;
  border: 6px solid transparent;
  border-right-color: rgba(15, 23, 42, 0.95);
  border-top-color: transparent;
  border-bottom-color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
  transform: translateY(-50%) translateX(-6px);
}

[data-tooltip][data-tooltip-position="right"]:hover::before {
  transform: translateY(-50%) translateX(0);
}

/* Left-positioned tooltip (e.g. CC button) */
[data-tooltip][data-tooltip-position="left"]::after {
  left: auto;
  right: 100%;
  top: 50%;
  margin-left: 0;
  margin-right: 10px;
  margin-bottom: 0;
  bottom: auto;
  transform: translateY(-50%) translateX(6px);
}

[data-tooltip][data-tooltip-position="left"]:hover::after {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip][data-tooltip-position="left"]::before {
  left: auto;
  right: 100%;
  top: 50%;
  margin-left: 0;
  margin-right: 2px;
  margin-bottom: 0;
  bottom: auto;
  border: 6px solid transparent;
  border-left-color: rgba(15, 23, 42, 0.95);
  border-top-color: transparent;
  border-bottom-color: transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
  transform: translateY(-50%) translateX(6px);
}

[data-tooltip][data-tooltip-position="left"]:hover::before {
  transform: translateY(-50%) translateX(0);
}

/* ----- Center stage (avatar behind transcript) ----- */
.center-stage {
  position: absolute;
  top: 51%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.avatar-block {
  position: relative;
  width: 360px;
  height: 360px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-loading-bar {
  position: relative;
  width: 216px;
  height: 56px;
  margin-top: -50px;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow: visible;
}

.center-stage.loading .avatar-loading-bar {
  opacity: 1;
}

.avatar-loading-gif {
  width: 200px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  object-position: center;
  animation: avatar-loading-move 4s ease-in-out infinite;
}

@keyframes avatar-loading-move {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  35% {
    transform: translateX(72px);
    opacity: 1;
  }
  50% {
    transform: translateX(72px);
    opacity: 0;
  }
  65% {
    transform: translateX(0);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.avatar-ring {
  position: absolute;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.22);
  transform: scale(0.7);
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: none;
}

.ring-one {
  width: 360px;
  height: 360px;
}

.ring-two {
  width: 270px;
  height: 270px;
  background: rgba(59, 130, 246, 0.26);
}

.avatar-photo {
  z-index: 2;
  width: 216px;
  height: 216px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.9);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.avatar-loading-ring {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: rgba(96, 165, 250, 0.95);
  border-right-color: rgba(59, 130, 246, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease;
}

.center-stage.loading .avatar-loading-ring {
  opacity: 1;
  animation: avatar-loading-spin 0.9s linear infinite;
}

.center-stage.loading .ring-one,
.center-stage.loading .ring-two,
.center-stage.loading .avatar-photo {
  animation: none !important;
  box-shadow: none !important;
}

@keyframes avatar-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.center-stage.glowing .ring-one {
  opacity: 0.4;
  animation: ring-pulse-outer 1.45s ease-in-out infinite;
}

.center-stage.glowing .ring-two {
  opacity: 0.58;
  animation: ring-pulse-inner 1.05s ease-in-out infinite;
}

.center-stage.glowing .avatar-photo {
  animation: avatar-bob 1.2s ease-in-out infinite, avatar-glow 2s ease-in-out infinite;
}

@keyframes avatar-glow {
  0%, 100% {
    box-shadow:
      0 0 20px 6px rgba(59, 130, 246, 0.35),
      0 0 40px 12px rgba(96, 165, 250, 0.2),
      0 0 70px 22px rgba(147, 197, 253, 0.12);
  }
  50% {
    box-shadow:
      0 0 32px 12px rgba(59, 130, 246, 0.5),
      0 0 65px 22px rgba(96, 165, 250, 0.3),
      0 0 100px 35px rgba(147, 197, 253, 0.18);
  }
}

@keyframes ring-pulse-outer {
  0% {
    transform: scale(0.82);
    opacity: 0.12;
    box-shadow: 0 0 30px 8px rgba(59, 130, 246, 0.22), 0 0 60px 18px rgba(96, 165, 250, 0.1);
  }
  50% {
    transform: scale(1.34);
    opacity: 0.52;
    box-shadow: 0 0 50px 16px rgba(59, 130, 246, 0.4), 0 0 100px 32px rgba(96, 165, 250, 0.22);
  }
  100% {
    transform: scale(0.82);
    opacity: 0.12;
    box-shadow: 0 0 30px 8px rgba(59, 130, 246, 0.22), 0 0 60px 18px rgba(96, 165, 250, 0.1);
  }
}

@keyframes ring-pulse-inner {
  0% {
    transform: scale(0.9);
    opacity: 0.16;
    box-shadow: 0 0 22px 6px rgba(59, 130, 246, 0.28), 0 0 45px 14px rgba(96, 165, 250, 0.15);
  }
  50% {
    transform: scale(1.5);
    opacity: 0.72;
    box-shadow: 0 0 38px 14px rgba(59, 130, 246, 0.45), 0 0 75px 24px rgba(96, 165, 250, 0.28);
  }
  100% {
    transform: scale(0.9);
    opacity: 0.16;
    box-shadow: 0 0 22px 6px rgba(59, 130, 246, 0.28), 0 0 45px 14px rgba(96, 165, 250, 0.15);
  }
}

@keyframes avatar-bob {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* ----- Chat zone ----- */
.chat-zone {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 48px));
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.attachment-chip {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.attachment-chip:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.attachment-chip--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-chip--file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  min-width: 64px;
  max-width: 96px;
  height: auto;
  min-height: 72px;
}

.attachment-chip-icon {
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.9;
}

.attachment-chip-name {
  font-size: 0.65rem;
  line-height: 1.2;
  text-align: center;
  word-break: break-all;
  color: var(--text-primary, #1a1a1a);
  opacity: 0.95;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-strong);
  border-radius: var(--radius-full);
  padding: 8px 12px 8px 14px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px);
  transition: box-shadow var(--transition);
}

/* Tooltip wrapper for text input so pseudo-element works */
.chat-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  position: relative;
}

.chat-bar:focus-within {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35), var(--shadow-md);
}

.menu-btn,
.mic-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
  position: relative;
}

.menu-btn {
  background: rgba(15, 23, 42, 0.08);
  color: #475569;
}

.menu-btn:hover {
  background: rgba(15, 23, 42, 0.14);
  transform: scale(1.05);
}

/* Microphone / Send action button */
.mic-btn {
  background: linear-gradient(145deg, #4f9cf9 0%, var(--accent) 50%, #2563eb 100%);
  color: #fff;
  box-shadow:
    0 4px 14px rgba(59, 130, 246, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mic-btn:hover:not(:disabled) {
  background: linear-gradient(145deg, #60a5fa 0%, var(--accent-hover) 50%, #1d4ed8 100%);
  transform: scale(1.06);
  box-shadow:
    0 6px 20px rgba(59, 130, 246, 0.5),
    0 3px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Icon swap: show mic when empty, show send when has text */
.mic-btn .btn-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  transition: opacity var(--transition), transform var(--transition);
}

.mic-btn .btn-icon-mic {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.mic-btn .btn-icon-send {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.mic-btn.has-text .btn-icon-mic {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.mic-btn.has-text .btn-icon-send {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Submit state: slight green tint when ready to send */
.mic-btn.has-text {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
  box-shadow:
    0 4px 14px rgba(34, 197, 94, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mic-btn.has-text:hover:not(:disabled) {
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
  box-shadow:
    0 6px 20px rgba(34, 197, 94, 0.5),
    0 3px 10px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Listening state: visual feedback while recording */
.action-btn.listening {
  background: linear-gradient(145deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%) !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.5);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

.action-btn.listening .btn-icon-mic {
  opacity: 1;
  transform: scale(1);
}

.action-btn.listening .btn-icon-send {
  opacity: 0;
  pointer-events: none;
}

.action-btn.listening:hover:not(:disabled) {
  background: #b91c1c !important;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.6);
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 4px 24px rgba(220, 38, 38, 0.7); }
}

.mic-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

#chatInput {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: clamp(14px, 1.8vw, 15px);
  font-family: inherit;
  font-weight: 500;
}

#chatInput::placeholder {
  color: #94a3b8;
}

#chatInput:focus {
  outline: none;
}

/* ----- Transcript panel (in front of avatar) ----- */
/* Small height when empty; grows with content up to max when there are messages */
.transcript-panel {
  position: absolute;
  right: 24px;
  top: 80px;
  width: min(380px, calc(100vw - 48px));
  min-height: 100px;
  max-height: calc(100vh - 220px);
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--glass-border);
  padding: 20px;
  display: none;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  z-index: 12;
}

.transcript-panel.show {
  display: block;
  animation: panel-in 0.25s ease-out;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.transcript-panel h3 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.transcript-message {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  line-height: 1.45;
  white-space: pre-wrap;
  font-size: 11px;
  font-weight: 500;
  transition: background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.transcript-message-time {
  font-size: 8px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.transcript-message-text {
  flex: 1;
}

.transcript-message-wrap {
  margin-bottom: 10px;
}

.transcript-message-wrap:last-child {
  margin-bottom: 0;
}

.transcript-message-wrap:last-child .transcript-message:last-child {
  margin-bottom: 0;
}

.transcript-message:last-child {
  margin-bottom: 0;
}

.transcript-message.user {
  background: var(--bg-surface-hover);
  border: 1px solid var(--glass-border);
}

.transcript-message.assistant {
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Supporting resources under assistant reply */
.transcript-supporting-resources {
  margin-top: 8px;
  padding: 0;
}

.transcript-supporting-resources-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.transcript-supporting-resources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.supporting-resource-item {
  flex: 0 0 auto;
  transition: transform var(--transition), box-shadow var(--transition);
}

.supporting-resource-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.supporting-resource-item-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.supporting-resource-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  min-height: 72px;
  max-width: 140px;
  max-height: 96px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 64, 175, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.75),
    inset 0 0 0 1px rgba(15, 23, 42, 0.75);
  position: relative;
}

.supporting-resource-item .supporting-resource-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.supporting-resource-video-icon {
  font-size: 24px;
  color: var(--text-muted);
}

.supporting-resource-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
}

.supporting-resource-file-icon-wrap {
  width: 32px;
  height: 40px;
  border-radius: 10px;
  background: radial-gradient(circle at top left, #93c5fd, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.75),
    0 8px 22px rgba(15, 23, 42, 0.9);
}

.supporting-resource-file-icon {
  font-size: 18px;
  line-height: 1;
  color: #e5f0ff;
}

.supporting-resource-file-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.supporting-resource-file-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supporting-resource-file-type {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.8);
}

.supporting-resource-view-btn {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.supporting-resource-view-btn:hover {
  background: rgba(59, 130, 246, 0.35);
  color: var(--text-primary);
}

/* Resource modal (popup in center) */
.resource-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  animation: resource-modal-fade-in 0.2s ease-out;
}

.resource-modal-overlay[hidden] {
  display: none !important;
}

body.resource-modal-open {
  overflow: hidden;
}

.resource-modal {
  position: relative;
  width: 95vw;
  max-width: 1400px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: resource-modal-scale-in 0.25s ease-out;
}

.resource-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.resource-modal-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.6);
}

.resource-modal-title {
  margin: 0;
  padding: 14px 48px 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.resource-modal-content {
  padding: 0 16px 16px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.resource-modal-img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.resource-modal-video {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  border-radius: var(--radius-sm);
}

.resource-modal-pdf {
  width: 100%;
  min-width: 320px;
  height: 70vh;
  min-height: 400px;
  border: none;
  border-radius: var(--radius-sm);
  background: #fff;
}

.resource-modal-file-link {
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  padding: 12px 20px;
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.resource-modal-file-link:hover {
  text-decoration: underline;
  background: rgba(59, 130, 246, 0.35);
}

@keyframes resource-modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes resource-modal-scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.empty-transcript {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.suggested-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.suggested-question-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.suggested-question-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text-primary);
  border-color: rgba(59, 130, 246, 0.4);
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.loading-indicator[hidden] {
  display: none !important;
}

.loading-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  width: 20px;
}

.loading-dots::before,
.loading-dots::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: loading-dot 1.4s ease-in-out infinite both;
}

.loading-dots::before {
  animation-delay: -0.32s;
}

.loading-dots::after {
  animation-delay: -0.16s;
}

.loading-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: loading-dot 1.4s ease-in-out infinite both;
}

@keyframes loading-dot {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Scrollbar styling */
.transcript-panel::-webkit-scrollbar {
  width: 8px;
}

.transcript-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
}

.transcript-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
}

.transcript-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

