/* Floating Recorder - Global recording widget */

.floating-recorder {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    font-family: inherit;
}

/* ── Main FAB button ──────────────────────────────────────────────────── */
.recorder-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.recorder-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.recorder-fab.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: pulse-recording 1.5s ease-in-out infinite;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.recorder-fab.paused {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.recorder-fab.processing {
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0.7;
    pointer-events: none;
}

@keyframes pulse-recording {
    0%, 100% { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(239, 68, 68, 0.7); }
}

/* ── Expanded panel ───────────────────────────────────────────────────── */
.recorder-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 340px;
    overflow: hidden;
    display: none;
    border: 1px solid #e2e8f0;
}

.recorder-panel.visible {
    display: block;
    animation: slideUp 0.2s ease;
}

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

/* Panel header */
.recorder-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.recorder-panel-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.recorder-panel-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.recorder-panel-close:hover { color: white; }

/* Patient info */
.recorder-patient {
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.82rem;
    color: #64748b;
}

.recorder-patient strong {
    color: #1e293b;
}

.recorder-no-patient {
    color: #ef4444;
    font-style: italic;
}

/* Timer area */
.recorder-timer-area {
    padding: 1rem;
    text-align: center;
}

.recorder-timer {
    font-size: 2.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #1e293b;
    letter-spacing: 1px;
}

.recorder-timer.recording { color: #ef4444; }
.recorder-timer.paused { color: #f59e0b; }

.recorder-alarm-info {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Controls */
.recorder-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.recorder-ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: white;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #64748b;
}

.recorder-ctrl-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #eef2ff;
}

.recorder-ctrl-btn.record-btn {
    width: 52px;
    height: 52px;
    border-color: #667eea;
    background: #667eea;
    color: white;
    font-size: 1.3rem;
}

.recorder-ctrl-btn.record-btn:hover {
    background: #5a67d8;
}

.recorder-ctrl-btn.record-btn.active {
    border-color: #ef4444;
    background: #ef4444;
}

.recorder-ctrl-btn.record-btn.active:hover {
    background: #dc2626;
}

.recorder-ctrl-btn.stop-btn {
    border-color: #ef4444;
    color: #ef4444;
}

.recorder-ctrl-btn.stop-btn:hover {
    background: #fef2f2;
}

.recorder-ctrl-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Transcription preview */
.recorder-transcription {
    max-height: 150px;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #475569;
    border-top: 1px solid #e2e8f0;
    background: #fafbfc;
}

.recorder-transcription:empty {
    display: none;
}

.recorder-transcription-placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* Alarm overlay */
.recorder-alarm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.1);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.recorder-alarm-overlay.active {
    display: flex;
    animation: flashRed 1s ease-in-out infinite;
}

@keyframes flashRed {
    0%, 100% { background: rgba(239, 68, 68, 0.05); }
    50% { background: rgba(239, 68, 68, 0.15); }
}

.recorder-alarm-box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
    border: 2px solid #ef4444;
}

.recorder-alarm-box h3 {
    color: #ef4444;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.recorder-alarm-box p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.recorder-alarm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.recorder-alarm-actions button {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.alarm-snooze-btn {
    background: #f59e0b;
    color: white;
}

.alarm-snooze-btn:hover { background: #d97706; }

.alarm-stop-btn {
    background: #ef4444;
    color: white;
}

.alarm-stop-btn:hover { background: #dc2626; }

/* Summary review */
.recorder-summary {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

.recorder-summary h4 {
    font-size: 0.85rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.recorder-summary textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    color: #1e293b;
}

.recorder-summary textarea:focus {
    outline: none;
    border-color: #667eea;
}

.recorder-summary-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.recorder-summary-actions button {
    flex: 1;
    padding: 0.5rem;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.summary-save-btn {
    background: #667eea;
    color: white;
}

.summary-save-btn:hover { background: #5a67d8; }

.summary-discard-btn {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.summary-discard-btn:hover { background: #e2e8f0; }

/* Status badge on FAB */
.recorder-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    line-height: 1;
}

/* Processing spinner */
.recorder-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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