/* ============================================================
   Interview Overlay Styles
   Full-screen overlay for immersive interview experience
   Uses app theme colors from variables.css
   ============================================================ */

/* Overlay Container */
.interview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-page);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.interview-overlay.active {
  opacity: 1;
  visibility: visible;
}

.interview-overlay.hidden {
  display: none;
}

/* Main Container */
.interview-overlay-container {
  width: 100%;
  max-width: 800px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  box-sizing: border-box;
}

/* ========== Header ========== */
.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.overlay-close-btn,
.overlay-tips-btn {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: all 0.2s;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  box-shadow: var(--shadow-sm);
}

.overlay-close-btn:hover,
.overlay-tips-btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-text-muted);
}

.overlay-close-btn svg,
.overlay-tips-btn svg {
  width: 18px;
  height: 18px;
}

/* ========== Question Section ========== */
.overlay-question-section {
  text-align: center;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.overlay-question-badge {
  display: inline-block;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.overlay-question-text {
  font-size: 28px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  margin: 0;
  font-family: var(--font-sans);
}

/* ========== Audio Indicator ========== */
.overlay-audio-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.audio-indicator {
  width: 120px;
  height: 120px;
  background: var(--color-primary-bg);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
}

.audio-indicator.speaking {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(15, 118, 110, 0);
  }
}

.audio-icon {
  font-size: 48px;
  z-index: 1;
}

.audio-waves {
  position: absolute;
  display: flex;
  gap: 4px;
  bottom: -30px;
}

.audio-waves span {
  width: 4px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.audio-waves span:nth-child(1) { animation-delay: 0s; }
.audio-waves span:nth-child(2) { animation-delay: 0.1s; }
.audio-waves span:nth-child(3) { animation-delay: 0.2s; }
.audio-waves span:nth-child(4) { animation-delay: 0.3s; }
.audio-waves span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 24px; }
}

.audio-indicator:not(.speaking) .audio-waves span {
  animation-play-state: paused;
  height: 8px;
}

.audio-status {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin: 0;
  margin-top: 16px;
  font-family: var(--font-sans);
  font-weight: 500;
}

/* Connecting tip (shown during connection) */
.overlay-connecting-tip {
  color: var(--color-text-muted, #9CA3AF);
  font-size: var(--text-xs, 12px);
  margin: 12px 0 0 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-style: italic;
  max-width: 320px;
  text-align: center;
  line-height: 1.4;
  animation: connecting-tip-fade 0.4s ease;
}

.overlay-connecting-tip.hidden {
  display: none;
}

@keyframes connecting-tip-fade {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Transcript Section ========== */
.overlay-transcript-section {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
  min-height: 150px;
  max-height: 300px;
  box-shadow: var(--shadow-sm);
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-bg-hover);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.transcript-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.transcript-toggle:hover {
  background: var(--color-bg);
}

.transcript-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.transcript-toggle.collapsed svg {
  transform: rotate(180deg);
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
  background: var(--color-bg);
}

.transcript-content.collapsed {
  display: none;
}

.transcript-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  max-width: 80%;
  font-size: var(--text-sm);
  line-height: 1.5;
  font-family: var(--font-sans);
}

.transcript-bubble.agent {
  background: var(--color-primary-bg);
  color: var(--color-text);
  border: 1px solid rgba(15, 118, 110, 0.2);
  margin-right: auto;
}

.transcript-bubble.user {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  margin-left: auto;
}

.transcript-bubble.user.current {
  opacity: 0.7;
  border-style: dashed;
}

.transcript-word-count {
  padding: 8px 16px;
  text-align: right;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  flex-shrink: 0;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg);
}

/* ========== Footer ========== */
.overlay-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.btn-end-interview {
  background: var(--color-danger);
  color: white;
  border: none;
  padding: 16px 48px;
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  min-height: var(--touch-target-min);
  box-shadow: var(--shadow-md);
}

.btn-end-interview:hover {
  background: var(--color-danger-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-end-interview:active {
  transform: translateY(0);
}

.overlay-timer {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-sans);
}

/* ========== Tips Panel ========== */
.overlay-tips-panel {
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 300px;
  box-shadow: var(--shadow-lg);
  z-index: 10001;
}

.overlay-tips-panel.hidden {
  display: none;
}

.tips-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tips-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}

.tips-header button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.tips-header button:hover {
  background: var(--color-bg-hover);
}

.tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tips-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.5;
}

.tips-list li:last-child {
  border-bottom: none;
}

/* ========== Mobile Responsive ========== */

/* Tablets and below */
@media (max-width: 768px) {
  .interview-overlay-container {
    padding: var(--mobile-padding);
    /* Safe area for notched devices */
    padding-top: max(var(--mobile-padding), env(safe-area-inset-top));
    padding-bottom: max(var(--mobile-padding), env(safe-area-inset-bottom));
  }

  .overlay-header {
    margin-bottom: 16px;
  }

  /* Maintain touch-friendly targets */
  .overlay-close-btn,
  .overlay-tips-btn {
    padding: 10px 12px;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
  }

  .overlay-question-section {
    margin-bottom: 24px;
  }

  .overlay-question-text {
    font-size: 20px;
  }

  .overlay-audio-section {
    margin-bottom: 24px;
  }

  .audio-indicator {
    width: 100px;
    height: 100px;
  }

  .audio-icon {
    font-size: 36px;
  }

  .overlay-transcript-section {
    max-height: 200px;
    min-height: 120px;
    flex: 1;
  }

  .transcript-bubble {
    max-width: 90%;
  }

  .btn-end-interview {
    width: 100%;
    padding: 14px 24px;
    min-height: var(--touch-target-min);
  }

  /* Tips Panel - Mobile Bottom Sheet */
  .overlay-tips-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* Large phones */
@media (max-width: 480px) {
  .interview-overlay-container {
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .overlay-question-badge {
    font-size: 10px;
    padding: 4px 12px;
  }

  .overlay-question-text {
    font-size: 18px;
    padding: 0 8px;
  }

  .audio-indicator {
    width: 90px;
    height: 90px;
  }

  .audio-icon {
    font-size: 32px;
  }

  .overlay-transcript-section {
    max-height: 180px;
    min-height: 100px;
  }

  .transcript-header {
    padding: 10px 12px;
  }

  .transcript-content {
    padding: 12px;
  }

  .transcript-bubble {
    padding: 8px 12px;
    font-size: var(--text-xs);
  }

  .overlay-footer {
    gap: 12px;
  }

  .btn-end-interview {
    padding: 12px 20px;
    font-size: var(--text-base);
  }
}

/* Small phones (320px) */
@media (max-width: 375px) {
  .interview-overlay-container {
    padding: 10px;
  }

  .overlay-header {
    margin-bottom: 12px;
  }

  .overlay-close-btn,
  .overlay-tips-btn {
    padding: 8px 10px;
    font-size: var(--text-xs);
  }

  .overlay-question-section {
    margin-bottom: 16px;
  }

  .overlay-question-text {
    font-size: 16px;
    line-height: 1.3;
  }

  .overlay-audio-section {
    margin-bottom: 16px;
  }

  .audio-indicator {
    width: 70px;
    height: 70px;
  }

  .audio-icon {
    font-size: 24px;
  }

  .audio-waves {
    bottom: -24px;
  }

  .audio-waves span {
    width: 3px;
    height: 16px;
  }

  .audio-status {
    font-size: var(--text-xs);
    margin-top: 12px;
  }

  .overlay-transcript-section {
    max-height: 140px;
    min-height: 80px;
    margin-bottom: 16px;
  }

  .transcript-header {
    padding: 8px 10px;
    font-size: var(--text-xs);
  }

  .transcript-content {
    padding: 10px;
  }

  .transcript-bubble {
    padding: 6px 10px;
    font-size: 11px;
    max-width: 95%;
  }

  .transcript-word-count {
    padding: 6px 10px;
    font-size: 10px;
  }

  .btn-end-interview {
    padding: 12px 16px;
    font-size: var(--text-sm);
  }

  .overlay-timer {
    font-size: var(--text-xs);
  }

  /* Tips panel adjustments for small screens */
  .overlay-tips-panel {
    padding: 16px;
    max-height: 70vh;
  }

  .tips-header h3 {
    font-size: var(--text-base);
  }

  .tips-list li {
    padding: 10px 0;
    font-size: var(--text-xs);
  }
}
