/* ═══════════════════════════════════════════════════════════════════════
   NOVA CONSULTA - Recording page styles (TranscriMed-identical)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Recording Section ─────────────────────────────────────────────── */
.recording-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 15px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.recording-section h3 {
    margin-bottom: 5px;
    font-size: 16px;
}

/* ── Mic Button ─────────────────────────────────────────────────────── */
.recording-btn-container {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 5px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recording-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid white;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
}

.recording-btn:hover {
    transform: scale(1.05);
    background: rgba(255,255,255,0.3);
}

.recording-btn.recording {
    background: #dc3545;
    border-color: white;
    box-shadow: 0 0 30px rgba(220, 53, 69, 0.6);
    animation: micPulse 1.5s ease-in-out infinite;
}

.recording-btn.paused {
    background: #ffc107;
    border-color: white;
}

.recording-btn.paused::before { display: none; }
.recording-btn-container.paused .sound-waves { opacity: 0; }
.recording-btn.paused .audio-bars .audio-bar { animation: none; opacity: 0.5; }

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 40px rgba(220, 53, 69, 0.8); }
}

/* ── Sound Waves ─────────────────────────────────────────────────────── */
.sound-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.recording-btn-container.active .sound-waves { opacity: 1; }

.sound-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    opacity: 0;
}

@keyframes waveExpand {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.recording-btn-container.active .sound-wave { animation: waveExpand 2s ease-out infinite; }
.recording-btn-container.active .sound-wave:nth-child(1) { animation-delay: 0s; }
.recording-btn-container.active .sound-wave:nth-child(2) { animation-delay: 0.35s; }
.recording-btn-container.active .sound-wave:nth-child(3) { animation-delay: 0.7s; }
.recording-btn-container.active .sound-wave:nth-child(4) { animation-delay: 1.05s; }
.recording-btn-container.active .sound-wave:nth-child(5) { animation-delay: 1.4s; }
.recording-btn-container.active .sound-wave:nth-child(6) { animation-delay: 1.75s; }

/* ── Audio Bars ──────────────────────────────────────────────────────── */
.audio-bars {
    display: none;
    gap: 4px;
    align-items: center;
    height: 35px;
}

.recording-btn.recording .audio-bars { display: flex; }
.recording-btn.recording > .mic-icon { display: none; }

.audio-bar {
    width: 5px;
    background: white;
    border-radius: 3px;
}

.audio-bar:nth-child(1) { height: 12px; animation: barPulse 0.6s ease-in-out infinite; animation-delay: 0s; }
.audio-bar:nth-child(2) { height: 22px; animation: barPulse 0.6s ease-in-out infinite; animation-delay: 0.1s; }
.audio-bar:nth-child(3) { height: 30px; animation: barPulse 0.6s ease-in-out infinite; animation-delay: 0.2s; }
.audio-bar:nth-child(4) { height: 22px; animation: barPulse 0.6s ease-in-out infinite; animation-delay: 0.3s; }
.audio-bar:nth-child(5) { height: 12px; animation: barPulse 0.6s ease-in-out infinite; animation-delay: 0.4s; }

@keyframes barPulse {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1.2); }
}

/* ── Timer & Status ──────────────────────────────────────────────────── */
.recording-time {
    font-size: 32px;
    font-weight: 700;
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.recording-status {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 10px;
    min-height: 18px;
}

/* ── Finish Button ───────────────────────────────────────────────────── */
.btn-finish-recording {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-finish-recording:hover {
    background: rgba(76, 175, 80, 0.8);
    border-color: #4CAF50;
}

/* ── Time Warning ────────────────────────────────────────────────────── */
.time-warning {
    background: rgba(255, 193, 7, 0.25);
    border: 2px solid rgba(255, 193, 7, 0.6);
    padding: 12px 20px;
    border-radius: 10px;
    margin-top: 15px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.time-warning.active {
    display: flex;
    animation: warningPulse 2s infinite;
}

@keyframes warningPulse {
    0%, 100% { border-color: rgba(255, 193, 7, 0.6); }
    50% { border-color: rgba(255, 193, 7, 1); }
}

.time-warning-text { font-weight: 600; font-size: 14px; }

/* ── Transcription Box ───────────────────────────────────────────────── */
.transcription-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}

.transcription-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.transcription-header h3 { font-size: 14px; font-weight: 600; }

.transcription-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.badge-recording { background: #fff3cd; color: #856404; }
.badge-done { background: #d4edda; color: #155724; }

.transcription-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    margin: 15px;
}

.transcription-box:empty::before {
    content: 'A transcricao aparecera aqui...';
    color: #999;
}

.transcription-actions {
    padding: 0 15px 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.transcription-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.transcription-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-review {
    background: #ffc107;
    color: #333;
}

.btn-review:hover:not(:disabled) { background: #e0a800; }

.btn-generate {
    background: var(--primary);
    color: white;
}

.btn-generate:hover:not(:disabled) { background: var(--primary-dark); }

.btn-copy {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border) !important;
}

.btn-copy:hover { background: var(--border); }

.review-hint {
    font-size: 11px;
    color: #888;
    padding: 0 15px 12px;
}

/* ── Doctor Notes ────────────────────────────────────────────────────── */
.doctor-notes-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s;
}

.doctor-notes-card:focus-within { border-color: var(--primary); }

.doctor-notes-header {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.doctor-notes-header .notes-icon { color: var(--primary); font-size: 16px; }
.doctor-notes-header .notes-title { font-weight: 600; font-size: 14px; color: var(--text); }
.doctor-notes-header .notes-hint { margin-left: auto; font-size: 11px; color: #999; font-weight: 400; }

.doctor-notes-input {
    width: 100%;
    border: none;
    padding: 12px 15px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 50px;
    max-height: 120px;
    outline: none;
    border-radius: 0 0 10px 10px;
}

.doctor-notes-input::placeholder { color: #aaa; }

.notes-list {
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    max-height: 100px;
    overflow-y: auto;
    display: none;
}

.notes-list.has-notes { display: block; }

.note-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.note-item:last-child { border-bottom: none; }

.note-item .note-text { flex: 1; color: #555; }

.note-item .note-time {
    font-size: 10px;
    color: #aaa;
    margin: 0 8px;
    white-space: nowrap;
}

.note-item .note-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

/* ═══════════════════════════════════════════════════════════════════════
   AI Summary - Structured editable sections
   ═══════════════════════════════════════════════════════════════════════ */
.ai-summary-container {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.ai-summary-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-summary-header h4 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    margin: 0;
}

.ai-summary-actions {
    display: flex;
    gap: 8px;
}

.ai-summary-actions button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.ai-summary-actions button:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.05);
}

.ai-summary-body { padding: 25px; }

.ai-summary-section {
    margin-bottom: 20px;
    padding: 18px;
    border-radius: 12px;
    border-left: 4px solid;
}

.ai-summary-section:last-child { margin-bottom: 0; }

.ai-summary-section.queixa { background: #fff3e0; border-color: #ff9800; }
.ai-summary-section.resumo { background: #e3f2fd; border-color: #2196f3; }
.ai-summary-section.diagnostico { background: #fce4ec; border-color: #e91e63; }
.ai-summary-section.cid { background: #f3e5f5; border-color: #9c27b0; }
.ai-summary-section.tratamento { background: #e8f5e9; border-color: #4caf50; }
.ai-summary-section.prescricao { background: #e0f7fa; border-color: #00bcd4; }
.ai-summary-section.orientacao { background: #fff8e1; border-color: #ffc107; }
.ai-summary-section.observacao { background: #f5f5f5; border-color: #9e9e9e; }
.ai-summary-section.retorno { background: #e8eaf6; border-color: #3f51b5; }

.ai-summary-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
}

.ai-summary-section-title .emoji { font-size: 20px; }

.editable-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
    background: rgba(255,255,255,0.7);
    transition: border-color 0.2s;
}

.editable-field:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.cid-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cid-checkbox-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cid-checkbox-item input[type="checkbox"] { display: none; }

.cid-badge-selectable {
    background: #e1bee7;
    color: #6a1b9a;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.cid-checkbox-item input:checked + .cid-badge-selectable {
    background: #9c27b0;
    color: white;
    border-color: #7b1fa2;
}

.add-cid-input {
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    width: 70%;
}

.ai-summary-footer {
    background: #f8f9fa;
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ai-summary-footer button {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-save { background: #22c55e; color: white; }
.btn-save:hover { background: #16a34a; }

.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp:hover { background: #1fad55; }

.btn-print { background: #6c757d; color: white; }
.btn-print:hover { background: #5a6268; }

.btn-export { background: #dc3545; color: white; }
.btn-export:hover { background: #c82333; }

/* ═══════════════════════════════════════════════════════════════════════
   FLOATING RECORDING INDICATOR (shown when navigating away)
   ═══════════════════════════════════════════════════════════════════════ */
.floating-recording {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 12px 16px;
    color: white;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 1500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1);
    transition: all 0.3s;
    user-select: none;
    min-width: 280px;
    backdrop-filter: blur(10px);
}

.floating-recording.active {
    display: flex;
    animation: floatIn 0.3s ease-out;
}

.floating-recording:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.15);
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.floating-rec-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.floating-rec-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.floating-rec-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    position: relative;
    flex-shrink: 0;
}

.floating-rec-indicator.recording::before {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.4);
    animation: floatPulse 1.2s infinite;
}

.floating-rec-indicator.paused { background: #f59e0b; }
.floating-rec-indicator.paused::before { display: none; }

@keyframes floatPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0.3; }
}

.floating-rec-time {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    letter-spacing: 0.5px;
    line-height: 1;
}

.floating-rec-status {
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.floating-rec-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.floating-rec-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
    white-space: nowrap;
}

.floating-rec-btn:hover {
    background: rgba(255,255,255,0.25);
}

.floating-rec-btn-back {
    background: rgba(99, 102, 241, 0.5);
    font-size: 12px;
    padding: 6px 12px;
}

.floating-rec-btn-back:hover {
    background: rgba(99, 102, 241, 0.7);
}

@media (max-width: 480px) {
    .floating-recording {
        left: 10px;
        right: 10px;
        bottom: 10px;
        min-width: auto;
    }
    .floating-rec-btn-back span { display: none; }
}

/* ── Patient select for consulta ─────────────────────────────────────── */
.patient-select-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 20px;
}

.patient-select-card label {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.patient-select-row {
    display: flex;
    gap: 10px;
}

.patient-select-row select,
.patient-select-row input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.patient-select-row select:focus,
.patient-select-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.patient-select-row button {
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
}

.patient-select-row button:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* ── Toast ────────────────────────────────────────────────────────────── */
.consulta-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    animation: toastIn 0.3s ease-out;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.consulta-toast.success { background: #22c55e; }
.consulta-toast.error { background: #ef4444; }
.consulta-toast.warning { background: #f59e0b; }
.consulta-toast.info { background: #667eea; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Loading overlay ──────────────────────────────────────────────────── */
.consulta-loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.6);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.consulta-loading.active { display: flex; }

.consulta-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .recording-section { padding: 15px; border-radius: 12px; }
    .recording-section h3 { font-size: 14px; }
    .recording-time { font-size: 28px; }
    .transcription-box { font-size: 14px; padding: 15px; }
    .time-warning { flex-direction: column; text-align: center; }
    .ai-summary-actions { flex-wrap: wrap; gap: 8px; }
    .ai-summary-footer { flex-direction: column; }
    .ai-summary-footer button { width: 100%; justify-content: center; }
}
