/**
 * css/pages/interview.css
 * Interview page: Header, Layout, Video panel, Chat panel, Response area
 */

/* =============================================================================
   INTERVIEW CONTAINER
   ============================================================================= */
#section-interview {
    padding: 1rem;
    padding-bottom: 1rem;
    max-width: 100%;
}

.interview-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    max-width: 1400px;
    margin: 0 auto;
}

/* =============================================================================
   INTERVIEW HEADER
   ============================================================================= */
.interview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-glass);
    flex-shrink: 0;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.int-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.int-avatar {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

.int-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.int-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.int-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.int-name-row .int-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Speaking indicator */
.speaking-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.5rem;
    background: var(--gradient-subtle);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.speaking-indicator.active {
    display: flex;
}

.speaking-indicator .dot {
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
    animation: speakingPulse 1.4s ease-in-out infinite;
}

.speaking-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.speaking-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

.int-details .int-role {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.interview-header-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.interview-header-buttons .btn {
    flex-shrink: 0;
}

.int-stats {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
}

.stat {
    text-align: center;
    min-width: 60px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.125rem;
}

.stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.interviewer-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: 0.5rem;
}

.interviewer-tab {
    padding: 0.375rem 0.875rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-base);
    color: var(--text-secondary);
}

.interviewer-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}

.interviewer-tab:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* =============================================================================
   INTERVIEW LAYOUT
   ============================================================================= */
.interview-main {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

/* =============================================================================
   VIDEO PANEL
   ============================================================================= */
.video-panel {
    width: 220px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    align-self: flex-start;
    border: 1px solid var(--border-light);
    line-height: 0;
}

.video-panel video {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1);
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.85rem;
    min-height: 165px;
    user-select: none;
    pointer-events: none;
    line-height: 1.4;
}

.video-overlay span:first-child {
    font-size: 2rem;
}

.video-panel.active .video-overlay {
    display: none;
}

/* =============================================================================
   CHAT PANEL & MESSAGES
   ============================================================================= */
.chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-glass);
    min-height: 0;
    flex: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-secondary);
    min-height: 0;
}

.message {
    max-width: 85%;
    width: fit-content;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease-out;
}

.message.interviewer {
    background: var(--bg-tertiary);
    align-self: flex-start;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.message.candidate {
    background: var(--gradient-primary);
    align-self: flex-end;
    color: white;
}

.message.skipped {
    background: var(--bg-tertiary) !important;
    border: 1px dashed var(--border-color);
    color: var(--text-muted) !important;
    font-style: italic;
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    align-self: flex-end;
}

.message.skipped .message-sender {
    color: var(--text-muted) !important;
}

.message-sender {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message.interviewer .message-sender { color: var(--text-muted); }
.message.candidate .message-sender { color: rgba(255, 255, 255, 0.85); }

/* Thinking animation */
.message.thinking {
    opacity: 0.8;
}

.thinking-dots {
    display: flex;
    gap: 5px;
    padding: 4px 0;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: thinkingPulse 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

/* =============================================================================
   RESPONSE AREA
   ============================================================================= */
.response-area {
    border-top: 1px solid var(--border-light);
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.response-controls {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
}

/* Mode toggle */
.mode-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    height: fit-content;
    align-self: flex-start;
}

.mode-btn {
    padding: 0.5rem 0.875rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-base);
    white-space: nowrap;
    text-align: center;
}

.mode-btn:hover:not(.active) {
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--bg-secondary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    pointer-events: none;
    cursor: default;
}

/* Input area */
.input-wrapper {
    display: flex;
    flex: 1;
    align-items: stretch;
    gap: 0.75rem;
    min-width: 0;
}

.input-area {
    flex: 1;
    min-width: 0;
    min-height: 76px;
}

.voice-mode,
.text-mode {
    display: none;
    min-height: 76px;
}

.voice-mode.active,
.text-mode.active {
    display: flex;
    align-items: stretch;
}

/* Record button */
.record-btn {
    position: relative;
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-primary);
    transition: var(--transition-base);
    min-height: 76px;
    overflow: hidden;
}

.record-btn:hover:not(:disabled):not(.recording) {
    border-color: var(--primary);
    background: var(--gradient-subtle);
}

.record-btn.recording {
    border-color: var(--error);
    background: var(--error-bg);
    animation: recording-pulse 1.5s infinite;
}

.record-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rec-icon {
    font-size: 1.25rem;
    position: relative;
    z-index: 2;
}

.rec-text {
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}

/* Audio visualizer */
.audio-visualizer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
    padding: 12px 0;
}

.record-btn.recording .audio-visualizer {
    opacity: 1;
}

.audio-bar {
    width: 7px;
    min-height: 5px;
    height: 5px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 4px;
    transition: height 0.05s ease-out, background-color 0.1s ease, box-shadow 0.15s ease;
}

.audio-bar[data-index="0"],
.audio-bar[data-index="4"] { max-height: 28px; }
.audio-bar[data-index="1"],
.audio-bar[data-index="3"] { max-height: 38px; }
.audio-bar[data-index="2"] { max-height: 46px; }

/* Text mode */
.text-mode textarea {
    min-height: 76px;
    max-height: 100px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.text-mode textarea:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Response buttons */
.response-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex-shrink: 0;
}

.response-buttons .btn {
    min-width: 100px;
}

.skip-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-base);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.skip-btn:hover:not(:disabled) {
    color: var(--primary);
    background: var(--gradient-subtle);
}

.skip-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}