/* ============================================
   MEDOCS AI Voice Entry Styles
   ============================================ */

/* Voice bar container */
.medocs-voice-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid #c3d4f7;
    border-radius: 8px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.medocs-voice-bar.medocs-recording {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-color: #f5c6cb;
}

.medocs-voice-bar.medocs-paused {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    border-color: #ffc107;
}

.medocs-voice-bar.medocs-voice-unsupported {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Brand */
.medocs-voice-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1a56db;
    white-space: nowrap;
    font-size: 14px;
}

.medocs-voice-brand i {
    font-size: 16px;
}

.medocs-recording .medocs-voice-brand {
    color: #dc3545;
}

.medocs-paused .medocs-voice-brand {
    color: #856404;
}

/* Controls */
.medocs-voice-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Record button */
.btn-medocs-record {
    background: #1a56db;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-medocs-record:hover {
    background: #1444b0;
    color: white;
    transform: scale(1.02);
}

.btn-medocs-record:active {
    transform: scale(0.98);
}

/* Pause button */
.btn-medocs-pause {
    background: #ffc107;
    color: #212529;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-medocs-pause:hover {
    background: #e0a800;
    color: #212529;
}

/* Resume button */
.btn-medocs-resume {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-medocs-resume:hover {
    background: #218838;
    color: white;
}

/* Stop button */
.btn-medocs-stop {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-medocs-stop:hover {
    background: #c82333;
    color: white;
}

/* Status area */
.medocs-voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.medocs-voice-timer {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 600;
    color: #dc3545;
    min-width: 45px;
}

.medocs-voice-chunks {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

.medocs-voice-processing {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #1a56db;
}

/* Audio level visualizer */
.medocs-voice-level {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
}

.medocs-level-bar {
    width: 3px;
    height: 4px;
    background: #ced4da;
    border-radius: 1px;
    transition: height 0.1s ease, background 0.1s ease;
}

.medocs-level-bar:nth-child(1) { height: 4px; }
.medocs-level-bar:nth-child(2) { height: 6px; }
.medocs-level-bar:nth-child(3) { height: 8px; }
.medocs-level-bar:nth-child(4) { height: 6px; }
.medocs-level-bar:nth-child(5) { height: 4px; }

.medocs-level-bar.active {
    background: #28a745;
}

.medocs-level-bar.active:nth-child(1) { height: 6px; }
.medocs-level-bar.active:nth-child(2) { height: 10px; }
.medocs-level-bar.active:nth-child(3) { height: 16px; }
.medocs-level-bar.active:nth-child(4) { height: 10px; }
.medocs-level-bar.active:nth-child(5) { height: 6px; }

/* Helper text */
.medocs-voice-helper {
    margin-left: auto;
}

.medocs-voice-helper small {
    font-size: 12px;
}

/* Error display */
.medocs-voice-error small {
    font-size: 12px;
}

/* Field update flash animation */
.medocs-field-updated {
    animation: medocsFieldFlash 0.8s ease;
}

@keyframes medocsFieldFlash {
    0% { background-color: #d4edda; box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3); }
    100% { background-color: transparent; box-shadow: none; }
}

/* Recording pulse on the bar border */
.medocs-recording {
    animation: medocsBarPulse 2s infinite;
}

@keyframes medocsBarPulse {
    0%, 100% { border-color: #f5c6cb; }
    50% { border-color: #dc3545; }
}

/* Responsive */
@media (max-width: 768px) {
    .medocs-voice-bar {
        padding: 8px 12px;
        gap: 8px;
    }

    .medocs-voice-helper {
        margin-left: 0;
        width: 100%;
        order: 10;
    }

    .medocs-voice-brand span {
        font-size: 13px;
    }
}

/* AI Disclaimer */
.medocs-voice-disclaimer {
    padding: 4px 16px 0;
    margin-top: -12px;
    margin-bottom: 12px;
}

.medocs-voice-disclaimer small {
    font-size: 11px;
    line-height: 1.4;
    color: #6c757d;
}

/* User-edited field indicator */
[data-user-edited="true"] {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.15);
}

/* ============================================
   UNIFIED VOICE BAR (Encounter Header)
   ============================================ */

.unified-voice-bar {
    margin-top: 10px;
}

.unified-voice-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8ecfe 100%);
    border: 1px solid #c3c8f7;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Recording state */
.unified-voice-bar.unified-recording .unified-voice-inner {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-color: #f5c6cb;
    animation: unifiedBarPulse 2s infinite;
}

/* Paused state */
.unified-voice-bar.unified-paused .unified-voice-inner {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    border-color: #ffc107;
}

@keyframes unifiedBarPulse {
    0%, 100% { border-color: #f5c6cb; }
    50% { border-color: #dc3545; }
}

/* Brand */
.unified-voice-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #5b4fc4;
    white-space: nowrap;
    font-size: 14px;
}

.unified-voice-brand i {
    font-size: 16px;
}

.unified-recording .unified-voice-brand {
    color: #dc3545;
}

.unified-paused .unified-voice-brand {
    color: #856404;
}

/* Controls */
.unified-voice-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Glowing Start Button */
.btn-unified-start {
    background: linear-gradient(135deg, #6c5ce7 0%, #5b4fc4 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
    animation: unifiedGlow 2s ease-in-out infinite;
}

@keyframes unifiedGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(108, 92, 231, 0.4); }
    50% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.7), 0 0 40px rgba(108, 92, 231, 0.3); }
}

.btn-unified-start:hover {
    background: linear-gradient(135deg, #5b4fc4 0%, #4a3fb3 100%);
    color: white;
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(108, 92, 231, 0.8);
}

.btn-unified-start:active {
    transform: scale(0.97);
}

/* Pause button */
.btn-unified-pause {
    background: #ffc107;
    color: #212529;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-unified-pause:hover { background: #e0a800; color: #212529; }

/* Resume button */
.btn-unified-resume {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-unified-resume:hover { background: #218838; color: white; }

/* Stop button */
.btn-unified-stop {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-unified-stop:hover { background: #c82333; color: white; }

/* Status area */
.unified-voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unified-voice-timer {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    font-weight: 600;
    color: #dc3545;
    min-width: 45px;
}

.unified-voice-processing {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #5b4fc4;
}

/* Audio level visualizer */
.unified-voice-level {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
}

.unified-level-bar {
    width: 3px;
    height: 4px;
    background: #ced4da;
    border-radius: 1px;
    transition: height 0.1s ease, background 0.1s ease;
}

.unified-level-bar:nth-child(1) { height: 4px; }
.unified-level-bar:nth-child(2) { height: 6px; }
.unified-level-bar:nth-child(3) { height: 8px; }
.unified-level-bar:nth-child(4) { height: 6px; }
.unified-level-bar:nth-child(5) { height: 4px; }

.unified-level-bar.active { background: #28a745; }
.unified-level-bar.active:nth-child(1) { height: 6px; }
.unified-level-bar.active:nth-child(2) { height: 10px; }
.unified-level-bar.active:nth-child(3) { height: 16px; }
.unified-level-bar.active:nth-child(4) { height: 10px; }
.unified-level-bar.active:nth-child(5) { height: 6px; }

/* Helper text */
.unified-voice-helper {
    margin-left: auto;
}

.unified-voice-helper small {
    font-size: 12px;
    color: #6c757d;
}

/* Finalize button */
.btn-unified-finalize {
    background: linear-gradient(135deg, #6c5ce7 0%, #5b4fc4 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-unified-finalize:hover {
    background: linear-gradient(135deg, #5b4fc4 0%, #4a3fb3 100%);
    color: white;
    transform: scale(1.03);
}

/* Finalizing state */
.unified-voice-bar.unified-finalizing .unified-voice-inner {
    background: linear-gradient(135deg, #e8f0fe 0%, #d4e4fd 100%);
    border-color: #6c5ce7;
}

/* Done state */
.unified-voice-bar.unified-done .unified-voice-inner {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

/* Transcription display area */
.unified-transcription-area {
    margin: 0 16px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.unified-transcription-scroll {
    max-height: 36px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.5;
    color: #495057;
}

.unified-transcript-segment {
    display: inline;
}

.unified-transcript-segment:last-child {
    color: #212529;
    font-weight: 500;
}

/* Disclaimer */
.unified-voice-disclaimer {
    padding: 3px 16px 0;
}

.unified-voice-disclaimer small {
    font-size: 11px;
    line-height: 1.4;
    color: #6c757d;
}

/* Sidebar AI badge */
.ew-ai-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 10px;
    color: #6c5ce7;
    margin-left: auto;
    animation: aiBadgePulse 1.5s ease-in-out 3;
}

@keyframes aiBadgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

/* Responsive */
@media (max-width: 768px) {
    .unified-voice-inner {
        padding: 6px 12px;
        gap: 8px;
    }

    .unified-voice-helper {
        margin-left: 0;
        width: 100%;
        order: 10;
    }
}
