/* ==========================================================================
   INTERVIEW WIDGET — Quick Interview With Joy
   Premium recruiter assistant, vanilla CSS, no dependencies.
   ========================================================================== */

/* ---------- DESIGN TOKENS (scoped to widget) ---------- */
.iw-root {
  --iw-bg:           #FFFFFF;
  --iw-bg-soft:      #FAFAF7;
  --iw-surface:      rgba(255, 255, 255, 0.78);
  --iw-border:       rgba(10, 10, 10, 0.08);
  --iw-border-hover: rgba(43, 67, 255, 0.28);
  --iw-text:         #0A0A0A;
  --iw-text-soft:    #555;
  --iw-text-mute:    #888;
  --iw-accent:       #2B43FF;
  --iw-accent-soft:  rgba(43, 67, 255, 0.08);
  --iw-shadow-sm:    0 4px 12px -4px rgba(10, 10, 10, 0.08);
  --iw-shadow-md:    0 18px 40px -16px rgba(10, 10, 10, 0.18);
  --iw-shadow-lg:    0 32px 64px -24px rgba(10, 10, 10, 0.28);
  --iw-radius:       20px;
  --iw-radius-sm:    12px;
  --iw-ease:         cubic-bezier(0.2, 0.8, 0.2, 1);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--iw-text);
}

/* ---------- FLOATING LAUNCHER (visible when widget minimized) ---------- */
.iw-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: var(--iw-text);
  color: #FFFFFF;
  border: none;
  border-radius: 100px;
  font: 500 13px/1 'Inter', sans-serif;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: var(--iw-shadow-md);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.4s var(--iw-ease), opacity 0.4s var(--iw-ease), background 0.25s;
}
.iw-launcher.iw-visible {
  display: inline-flex;
  transform: translateY(0);
  opacity: 1;
}
.iw-launcher:hover { background: var(--iw-accent); }
.iw-launcher-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.iw-launcher-ico svg {
  width: 15px;
  height: 15px;
  display: block;
}
.iw-title-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--iw-accent);
}
.iw-title-ico svg {
  width: 16px;
  height: 16px;
  display: block;
}
@keyframes iw-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ---------- WIDGET PANEL ---------- */
.iw-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--iw-bg);
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-radius);
  box-shadow: var(--iw-shadow-lg);
  overflow: hidden;
  transform-origin: bottom right;
  transition:
    transform 0.45s var(--iw-ease),
    opacity 0.35s var(--iw-ease);
}
.iw-panel.iw-hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
}

/* ---------- HEADER ---------- */
.iw-header {
  position: relative;
  padding: 20px 22px 18px;
  background:
    linear-gradient(135deg, rgba(43, 67, 255, 0.04), rgba(43, 67, 255, 0) 60%),
    var(--iw-bg);
  border-bottom: 1px solid var(--iw-border);
  flex-shrink: 0;
}
.iw-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.iw-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.iw-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--iw-text);
  margin: 0;
}
.iw-status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  background: var(--iw-accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.iw-status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--iw-accent);
  opacity: 0;
  animation: iw-ring 2.4s var(--iw-ease) infinite;
}
@keyframes iw-ring {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(2);   opacity: 0; }
}
.iw-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.iw-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--iw-text-mute);
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--iw-ease);
}
.iw-icon-btn:hover {
  background: var(--iw-accent-soft);
  border-color: var(--iw-border);
  color: var(--iw-accent);
}
.iw-icon-btn:active { transform: scale(0.94); }
.iw-icon-btn svg { width: 14px; height: 14px; display: block; }
.iw-subtitle {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--iw-text-soft);
  margin: 0;
  letter-spacing: 0;
}

/* ---------- BODY (scrollable list) ---------- */
.iw-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px 14px;
  scroll-behavior: smooth;
}
.iw-body::-webkit-scrollbar { width: 6px; }
.iw-body::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.12);
  border-radius: 3px;
}
.iw-body::-webkit-scrollbar-thumb:hover { background: rgba(10, 10, 10, 0.22); }

/* ---------- ACCORDION ITEM ---------- */
.iw-item {
  border-bottom: 1px solid var(--iw-border);
}
.iw-item:last-child { border-bottom: none; }

.iw-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  text-align: left;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--iw-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.iw-question:hover {
  background: var(--iw-accent-soft);
  color: var(--iw-accent);
}
.iw-question:focus-visible {
  outline: 2px solid var(--iw-accent);
  outline-offset: 2px;
}
.iw-q-text {
  flex: 1;
  min-width: 0;
}
.iw-q-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--iw-bg-soft);
  border: 1px solid var(--iw-border);
  color: var(--iw-text-mute);
  transition: transform 0.4s var(--iw-ease), background 0.25s, border-color 0.25s, color 0.25s;
}
.iw-q-icon svg { width: 10px; height: 10px; }
.iw-item.iw-open .iw-q-icon {
  transform: rotate(45deg);
  background: var(--iw-accent);
  border-color: var(--iw-accent);
  color: #FFFFFF;
}
.iw-item.iw-open .iw-question {
  color: var(--iw-accent);
  font-weight: 600;
}

/* ---------- ANSWER (collapses via max-height) ---------- */
.iw-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s var(--iw-ease), opacity 0.3s ease;
  opacity: 0;
}
.iw-item.iw-open .iw-answer { opacity: 1; }

.iw-answer-inner {
  padding: 4px 10px 18px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--iw-text-soft);
}
.iw-answer-inner p { margin: 0 0 12px; }
.iw-answer-inner p:last-child { margin-bottom: 0; }
.iw-answer-inner strong { color: var(--iw-text); font-weight: 600; }

/* Video container */
.iw-video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 12px 0;
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  border-radius: var(--iw-radius-sm);
  overflow: hidden;
  box-shadow: var(--iw-shadow-sm);
}
.iw-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--iw-radius-sm);
}
.iw-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.iw-video-placeholder .iw-play-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.iw-video-placeholder .iw-play-icon::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 12px solid #FFFFFF;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 3px;
}

/* Optional image */
.iw-image {
  width: 100%;
  margin: 12px 0;
  border-radius: var(--iw-radius-sm);
  display: block;
  box-shadow: var(--iw-shadow-sm);
}

/* Optional CTA */
.iw-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 16px;
  background: var(--iw-text);
  color: #FFFFFF;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background 0.25s, transform 0.25s var(--iw-ease);
}
.iw-cta:hover { background: var(--iw-accent); transform: translateY(-1px); }
.iw-cta-arrow { transition: transform 0.25s; }
.iw-cta:hover .iw-cta-arrow { transform: translateX(2px); }

/* ---------- FOOTER ---------- */
.iw-footer {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  background: var(--iw-bg-soft);
  border-top: 1px solid var(--iw-border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--iw-text-mute);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.iw-footer-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.iw-footer-typing span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--iw-accent);
  opacity: 0.4;
  animation: iw-typing 1.4s infinite ease-in-out;
}
.iw-footer-typing span:nth-child(2) { animation-delay: 0.18s; }
.iw-footer-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes iw-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ---------- MINIMIZED STATE (compact bar) ---------- */
.iw-panel.iw-minimized .iw-body,
.iw-panel.iw-minimized .iw-footer,
.iw-panel.iw-minimized .iw-subtitle {
  display: none;
}
.iw-panel.iw-minimized {
  width: auto;
  max-width: 380px;
}
.iw-panel.iw-minimized .iw-header {
  padding: 14px 18px;
  border-bottom: none;
}
.iw-panel.iw-minimized .iw-header-top { margin-bottom: 0; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .iw-panel,
  .iw-launcher,
  .iw-answer,
  .iw-q-icon,
  .iw-icon-btn,
  .iw-cta,
  .iw-status-dot::after,
  .iw-footer-typing span,
  .iw-launcher-dot {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .iw-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 12px;
    max-height: calc(100vh - 24px);
    border-radius: 18px;
  }
  .iw-launcher {
    right: 12px;
    bottom: 12px;
  }
  .iw-header { padding: 18px 18px 16px; }
  .iw-body { padding: 8px 8px 12px; }
  .iw-question { padding: 13px 8px; font-size: 13px; }
  .iw-answer-inner { padding: 4px 8px 16px; }
}

@media (max-width: 380px) {
  .iw-title { font-size: 14px; }
  .iw-subtitle { font-size: 12px; }
}
