/**
 * Voice Input Component Styles
 * Reusable across Dream and Debrief pages
 */

:root {
    --voice-cosmic-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --voice-color-primary: #6c63ff;
    --voice-color-border: #6c63ff;
    --voice-color-border-muted: rgba(108, 99, 255, 0.4);
    --voice-color-danger: #dc3545;
    --voice-color-warning: #ffc107;
    --voice-color-bg-solid: rgba(26, 26, 46, 0.95);
}

.voice-input-container { position: relative; width: 100%; margin-bottom: 1.5rem; }
.voice-input-wrapper { position: relative; }

.voice-textarea {
    width: 100%; 
    min-height: 200px; 
    padding: 1.25rem; 
    padding-right: 60px; 
    padding-bottom: 48px;
    background: var(--voice-color-bg-solid); 
    border: 2px solid var(--voice-color-border); 
    border-radius: 16px;
    color: #fff; 
    font-size: 1.1rem; 
    line-height: 1.6;
    resize: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.voice-textarea::placeholder { color: rgba(255,255,255,0.5); }
.voice-textarea:focus { outline: none; border-color: #8b7dff; box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3); }

/* Debrief-specific taller textarea */
.voice-input-container.debrief-size .voice-textarea {
    min-height: 400px;
}

/* Mic button */
.mic-button {
    position: absolute; 
    bottom: 12px; 
    right: 12px; 
    width: 40px; 
    height: 40px;
    border: none; 
    border-radius: 50%; 
    background: var(--voice-cosmic-gradient);
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 10;
}
.mic-button:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
.mic-button:active:not(:disabled) { transform: scale(0.95); }
.mic-button .mic-icon { width: 20px; height: 20px; color: white; }
.mic-button-faded { opacity: 0.5; }
.mic-button-faded:hover:not(:disabled) { opacity: 0.8; }

/* Permission denied */
.mic-button.permission-denied { background: #4a4a5a; cursor: not-allowed; }
.mic-button.permission-denied .mic-icon { color: #6b6b7b; }
.mic-button.permission-denied:hover { transform: none; box-shadow: none; }
.mic-denied-slash { display: none; position: absolute; width: 32px; height: 2px; background: var(--voice-color-danger); border-radius: 2px; transform: rotate(45deg); pointer-events: none; }
.mic-button.permission-denied .mic-denied-slash { display: block; }

/* Char counter */
.voice-char-counter { position: absolute; bottom: 14px; left: 1.25rem; font-size: 0.85rem; color: rgba(255,255,255,0.5); pointer-events: none; z-index: 5; }
.voice-char-counter.warning { color: var(--voice-color-warning); }
.voice-char-counter.error { color: var(--voice-color-danger); }

/* Stop button */
.stop-button {
    position: absolute; 
    bottom: 12px; 
    right: 12px; 
    width: 40px; 
    height: 40px;
    border: none; 
    border-radius: 50%; 
    background: var(--voice-color-danger);
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 10;
}
.stop-button:hover { background: #c82333; transform: scale(1.05); }
.stop-button:active { transform: scale(0.95); }
.stop-button svg { width: 20px; height: 20px; color: white; }

/* Overlays base */
.recording-overlay, .transcribing-overlay, .error-overlay {
    display: none; 
    position: absolute; 
    inset: 0;
    background: var(--voice-color-bg-solid); 
    border-radius: 16px;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    z-index: 20;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Recording state */
.voice-input-container.recording .recording-overlay { display: flex; border: 2px solid var(--voice-color-danger); }
.voice-input-container.recording .voice-textarea,
.voice-input-container.recording .mic-button,
.voice-input-container.recording .voice-char-counter { visibility: hidden; }
.recording-indicator { display: flex; align-items: center; gap: 12px; }
.recording-dot { width: 12px; height: 12px; background: var(--voice-color-danger); border-radius: 50%; animation: voice-pulse 1s ease-in-out infinite; }
.recording-timer { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 2rem; font-weight: 500; color: #fff; }
.recording-content { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 20px; }
.recording-label { font-size: 0.9rem; color: rgba(255,255,255,0.7); }

@keyframes voice-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Transcribing state */
.voice-input-container.transcribing .transcribing-overlay { display: flex; border: 2px solid var(--voice-color-border); }
.voice-input-container.transcribing .voice-textarea,
.voice-input-container.transcribing .mic-button,
.voice-input-container.transcribing .voice-char-counter { visibility: hidden; }
.transcribing-content { text-align: center; }
.transcribing-dots { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.transcribing-dots .dot { width: 10px; height: 10px; background: var(--voice-color-primary); border-radius: 50%; animation: voice-bounce 0.6s ease-in-out infinite; }
.transcribing-dots .dot:nth-child(2) { animation-delay: 0.1s; }
.transcribing-dots .dot:nth-child(3) { animation-delay: 0.2s; }
.transcribing-label { font-size: 1rem; color: #fff; }
.transcribing-duration { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-top: 8px; }

@keyframes voice-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Error state */
.voice-input-container.error .error-overlay { display: flex; border: 2px solid var(--voice-color-warning); }
.voice-input-container.error .voice-textarea,
.voice-input-container.error .mic-button,
.voice-input-container.error .voice-char-counter { visibility: hidden; }
.error-content { text-align: center; }
.error-icon { width: 48px; height: 48px; background: rgba(255, 193, 7, 0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.error-icon svg { width: 24px; height: 24px; color: var(--voice-color-warning); }
.error-message { font-size: 1rem; color: #fff; margin-bottom: 16px; max-width: 280px; }
.retry-button { padding: 10px 24px; border: none; border-radius: 24px; background: var(--voice-cosmic-gradient); color: white; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.retry-button:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
.error-overlay .mic-button-faded { position: absolute; bottom: 14px; right: 14px; }

/* Permission denied state */
.voice-input-container.permission_denied .voice-textarea { border-color: var(--voice-color-border-muted); }
.voice-input-container.permission_denied .mic-button { background: #4a4a5a; cursor: not-allowed; }
.voice-input-container.permission_denied .mic-button .mic-icon { color: #6b6b7b; }
.voice-input-container.permission_denied .mic-button:hover { transform: none; box-shadow: none; }
