/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Estilos para a página de login */
.container {
    max-width: 800px;
    margin: auto;
    padding: 20px;
}

h1, h2, h3 {
    color: #343a40;
}

.btn {
    margin-top: 10px;
}

.mobile-close-chat-btn {
    display: none; /* Escondido por padrão, visível apenas em mobile */
}
/* ===== ESTILOS DA VIDEOCHAMADA ===== */

/* Body da videochamada */
.video-call-body {
    background: #1a1a1a;
    color: white;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: row;
}

/* Header da chamada */
.call-header {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    z-index: 10;
}

.call-info h3 {
    color: #ffffff;
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.participants {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #b3b3b3;
}

.participants span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.call-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #4CAF50;
}

/* Container principal da videochamada */
.video-call-container {
    width: 100%;
    height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
    transition: margin-left 0.3s ease;
    margin-left: 0; /* Padrão sem margem (paciente) */
}

/* Apenas médico tem espaço para barra do prontuário */
.video-call-container.has-prontuario {
    margin-left: 60px; /* Reserva espaço para barra do prontuário */
}

/* Quando prontuário está aberto */
.video-call-container.prontuario-open {
    margin-left: 400px;
}

/* Layout de duas colunas */
.video-section {
    width: calc(100% - 60px); /* Reserva espaço apenas para barra do chat */
    display: flex;
    flex-direction: column;
    position: relative;
    height: calc(100vh - 96px); /* Espaço para os controles fixos */
    transition: width 0.3s ease;
}

/* Para paciente (sem prontuário), video-section ocupa mais espaço */
.video-call-container:not(.has-prontuario) .video-section {
    width: calc(100% - 60px); /* Apenas espaço para barra do chat */
}

/* Para médico (com prontuário fechado) */
.video-call-container.has-prontuario .video-section {
    width: calc(100% - 60px); /* Espaço para barra do chat */
}

/* Quando o chat está aberto (prontuário fechado) */
.video-call-container.chat-open:not(.prontuario-open) .video-section {
    width: calc(100% - 450px); /* 450px chat */
}

/* Quando o prontuário está aberto (chat fechado) */
.video-call-container.prontuario-open:not(.chat-open) .video-section {
    width: calc(100% - 60px); /* Apenas barra do chat */
}

/* Quando ambos estão abertos */
.video-call-container.prontuario-open.chat-open .video-section {
    width: calc(100% - 450px); /* Apenas 450px chat (prontuário já está no margin-left) */
}

.chat-section {
    width: 450px;
    height: 100vh;
    background: #2d2d2d;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
}

/* Chat ativo no desktop: totalmente visível */
.chat-section.active {
    transform: translateX(0);
}

/* Chat inativo no desktop: mostra apenas barra lateral (60px) */
.chat-section:not(.active) {
    transform: translateX(calc(100% - 60px));
}

/* Barra lateral do chat quando fechado */
.chat-sidebar-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    opacity: 1;
    transition: all 0.3s ease;
    z-index: 999;
    cursor: pointer;
}

.chat-sidebar-bar:hover {
    background: linear-gradient(135deg, #5a6268 0%, #3d4349 100%);
    box-shadow: -3px 0 15px rgba(0,0,0,0.2);
    width: 65px;
}

.chat-section:not(.active) .chat-sidebar-bar {
    opacity: 1;
}

.chat-section.active .chat-sidebar-bar {
    opacity: 0;
    pointer-events: none;
}

/* Botão toggle na barra lateral */
.sidebar-toggle-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Indicador vertical */
.sidebar-indicator {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    margin-top: 20px;
    transition: all 0.3s ease;
}

/* Efeito hover nas barras laterais */
.chat-sidebar-bar:hover .sidebar-indicator,
.prontuario-sidebar-bar:hover .sidebar-indicator {
    color: rgba(255,255,255,1);
    letter-spacing: 3px;
}

.chat-sidebar-bar:hover .sidebar-toggle-btn,
.prontuario-sidebar-bar:hover .sidebar-toggle-btn {
    transform: scale(1.1);
    background: rgba(255,255,255,0.15);
}

/* ===== PRONTUÁRIO SECTION ===== */
.prontuario-section {
    position: fixed;
    left: 0;
    top: 0;
    height: 50vh;
    width: 400px;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease, height 0.3s ease;
    z-index: 998;
}

.prontuario-section.active {
    transform: translateX(0);
    height: 100vh;
    z-index: 999;
}

/* Prontuário inativo: mostra apenas barra lateral (60px) */
.prontuario-section:not(.active) {
    transform: translateX(calc(-100% + 60px));
}

/* ===== PRONTUÁRIO SIDEBAR BAR ===== */
.prontuario-sidebar-bar {
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(135deg, #555555 0%, #333333 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.prontuario-sidebar-bar:hover {
    background: linear-gradient(135deg, #666666 0%, #444444 100%);
    box-shadow: 3px 0 15px rgba(0,0,0,0.3);
    width: 65px;
}

.prontuario-section:not(.active) .prontuario-sidebar-bar {
    opacity: 1;
}

.prontuario-section.active .prontuario-sidebar-bar {
    opacity: 0;
    pointer-events: none;
}

/* Esconder barra do receituário quando prontuário está aberto */
.receituario-sidebar-bar.hidden-by-prontuario {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== RECEITUÁRIO SECTION ===== */
.receituario-section {
    position: fixed;
    left: 0;
    bottom: 0;
    height: 50vh;
    width: 400px;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease, height 0.3s ease, bottom 0.3s ease;
    z-index: 997;
}

.receituario-section.active {
    transform: translateX(0);
    height: 100vh;
    bottom: 0;
    top: 0;
    z-index: 999;
}

/* Receituário inativo: mostra apenas barra lateral (60px) */
.receituario-section:not(.active) {
    transform: translateX(calc(-100% + 60px));
}

/* ===== RECEITUÁRIO SIDEBAR BAR ===== */
.receituario-sidebar-bar {
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(135deg, #555555 0%, #333333 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    cursor: pointer;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.receituario-sidebar-bar:hover {
    background: linear-gradient(135deg, #666666 0%, #444444 100%);
    box-shadow: 3px 0 15px rgba(0,0,0,0.3);
    width: 65px;
}

.receituario-section:not(.active) .receituario-sidebar-bar {
    opacity: 1;
}

.receituario-section.active .receituario-sidebar-bar {
    opacity: 0;
    pointer-events: none;
}

/* Esconder barra do prontuário quando receituário está aberto */
.prontuario-sidebar-bar.hidden-by-receituario {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===== RECEITUÁRIO CONTENT ===== */
.receituario-sidebar {
    width: 100%;
    height: 100%;
    background: #2d2d2d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.receituario-header {
    background: linear-gradient(135deg, #555555 0%, #333333 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.receituario-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-receituario-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: absolute;
    left: 15px;
}

.close-receituario-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.receituario-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
}

/* Footer do Receituário */
.receituario-footer {
    background: #f8f9fa;
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

/* Forçar altura do Summernote no receituário */
#receituarioSummernote .note-editor .note-editing-area .note-editable {
    height: 150px !important;
    min-height: 150px !important;
}

/* Switches do Receituário */
.receituario-switches {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

/* Botões do Receituário */
.receituario-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.receituario-buttons .btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 16px;
}

.switch-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.switch-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-option {
    font-size: 12px;
    color: #6c757d;
    min-width: 55px;
    white-space: nowrap;
}

.switch-container .switch-option:first-child {
    text-align: right;
}

.switch-container .switch-option:last-child {
    text-align: left;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4a90e2;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider:hover {
    background-color: #b3b3b3;
}

input:checked + .slider:hover {
    background-color: #357abd;
}

/* Removido - substituído por .receituario-footer */

.btn-save-receituario {
    background: linear-gradient(135deg, #555555 0%, #333333 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-save-receituario:hover:not(:disabled) {
    background: linear-gradient(135deg, #666666 0%, #444444 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-save-receituario:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ver-receitas {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-ver-receitas:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}
.btn-ver-receitas:disabled {
    cursor: not-allowed; /* Cursor indicando que não é clicável */
}


/* CIDs Container */
.cids-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cids-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-add-cid {
    background: linear-gradient(135deg, #28a745 0%, #20873a 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-add-cid:hover {
    background: linear-gradient(135deg, #2dbd4e 0%, #28a745 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.4);
}

.selected-cids {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    max-height: 60px;
    overflow-y: auto;
}

.no-cids-message {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

.cid-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cid-tag .remove-cid {
    cursor: pointer;
    color: #1976d2;
    font-size: 13px;
    transition: color 0.2s;
}

.cid-tag .remove-cid:hover {
    color: #d32f2f;
}

/* Modal de CID */
#cidModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

#cidModal.active {
    display: flex;
}

/* Sobrescreve regra genérica .modal-content especificamente para CIDs */
#cidModal .modal-content.modal-cid {
    background: #2d2d2d;
    border-radius: 12px;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 80vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Fallback caso modal-cid seja elemento raiz */
.modal-cid {
    background: #2d2d2d;
    border-radius: 12px;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 80vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-cid .modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-cid .modal-header h4 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-cid .modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-cid .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
    background: #252525;
}

.cid-search {
    position: relative;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.cid-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #ffffff;
    color: #333;
}

.cid-search-input:focus {
    outline: none;
    border-color: #4a90e2;
}

.cid-search .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.cid-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.cid-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.cid-item:hover {
    background: #f8f9fa;
}

.cid-item.selected {
    background: #e3f2fd;
}

.cid-item input[type="checkbox"] {
    cursor: pointer;
}

.cid-code {
    font-weight: 700;
    color: #1976d2;
    min-width: 60px;
}

.cid-description {
    font-size: 14px;
    color: #495057;
}

.modal-cid .modal-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.modal-cid .modal-footer button:first-child {
    background: #6c757d;
    color: white;
}

.modal-cid .modal-footer button:first-child:hover {
    background: #5a6268;
}

.modal-cid .modal-footer button:last-child {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
}

.modal-cid .modal-footer button:last-child:hover {
    background: linear-gradient(135deg, #5ba3f5 0%, #4a90e2 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(74, 144, 226, 0.4);
}

/* Modal de Receitas */
#receitasModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

#receitasModal.active {
    display: flex;
}

/* Sobrescreve regra genérica .modal-content especificamente para receitas */
#receitasModal .modal-content.modal-receitas {
    background: #2d2d2d;
    border-radius: 12px;
    width: 70% !important;
    max-width: 1800px !important;
    height: 95vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Fallback caso modal-receitas seja elemento raiz */
.modal-receitas {
    background: #2d2d2d;
    border-radius: 12px;
    width: 98% !important;
    max-width: 1800px !important;
    height: 95vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-receitas .modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-receitas .modal-header h4 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-receitas .modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    gap: 0;
}

.receitas-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.receitas-list-panel {
    width: 450px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    padding: 20px;
}

.receitas-preview-panel {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #ffffff;
    display: none;
}

.receitas-preview-panel.active {
    display: block;
}

.receitas-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px;
}

.receitas-empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #666;
}

.receitas-empty-state p {
    font-size: 16px;
    margin: 0;
}

.receitas-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.loading-receitas {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.loading-receitas i {
    font-size: 24px;
    margin-bottom: 10px;
}

.receita-item {
    background: #3a3a3a;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #888888;
    transition: all 0.3s ease;
    cursor: pointer;
}

.receita-item:hover {
    background: #424242;
    transform: translateX(5px);
}

.receita-item.active {
    background: #6c757d;
    border-left-color: #ffffff;
}

.receita-item.active .receita-tipo,
.receita-item.active .receita-data,
.receita-item.active .receita-preview {
    color: #ffffff;
}

.receita-item.controlada {
    border-left-color: #ff9800;
}

.receita-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.receita-tipo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.receita-tipo.normal {
    background: #e9ecef;
    color: #495057;
}

.receita-tipo.controlada {
    background: #ffe0b2;
    color: #f57c00;
}

.receita-data {
    font-size: 13px;
    color: #999;
}

.receita-preview {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.receita-item.active .receita-preview {
    color: #fff;
}

/* Preview Panel */
.receita-full-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.receita-full-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.receita-full-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.receita-full-content {
    color: #333;
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 25px;
}

.receita-full-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.receita-full-actions {
    display: flex;
    gap: 10px;
}

.btn-receita-full-action {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-receita-full-imprimir {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-receita-full-imprimir:hover {
    background: linear-gradient(135deg, #7d8693 0%, #6c757d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.receita-cids {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.receita-cid-badge {
    background: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.receita-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.btn-receita-action {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-receita-imprimir {
    background: #6c757d;
    color: white;
}

.btn-receita-imprimir:hover {
    background: #5a6268;
}

.no-receitas {
    text-align: center;
    padding: 40px;
    color: #999;
}

.no-receitas i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ccc;
}

/* ===== PRONTUÁRIO CONTENT ===== */
.prontuario-sidebar {
    width: 100%;
    height: 100%;
    background: #2d2d2d;
    display: flex;
    flex-direction: column;
    position: relative;
}

.prontuario-header {
    background: #2d2d2d;
    color: white;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.prontuario-header h4 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-prontuario-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: block;
}

.close-prontuario-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.prontuario-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #555 #2d2d2d;
    background-color: #2d2d2d;
}

.prontuario-info {
    background: #f5f5f5;
    border-left: 4px solid #777777;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #555555;
    margin-bottom: 10px;
}

.prontuario-info i {
    margin-right: 8px;
}

.prontuario-textarea {
    flex: 1;
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    transition: border-color 0.3s;
    margin-bottom: 15px;
    height: calc(100vh - 280px);
}

.prontuario-textarea:focus {
    outline: none;
    border-color: #777777;
    box-shadow: 0 0 0 3px rgba(119, 119, 119, 0.1);
}

.prontuario-textarea::placeholder {
    color: #aaa;
}

.prontuario-input-container {
    padding: 15px 20px 20px 20px;
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background-color: #2d2d2d;
}

.btn-save-prontuario {
    width: 100%;
    background: #444;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-save-prontuario:hover {
    border-color: #007bff;
    background: #555;
}

.btn-save-prontuario:active {
    transform: translateY(0);
}

.prontuario-status {
    font-size: 13px;
    color: #b3b3b3;
    width: 100%;
    text-align: center;
    min-height: 20px;
    font-weight: 500;
    padding: 5px 0;
    transition: all 0.3s ease;
}

.prontuario-status.typing {
    color: #999999;
    font-style: italic;
}

.prontuario-status.saving {
    color: #777777;
    animation: pulse 1.5s ease-in-out infinite;
}

.prontuario-status.saved {
    color: #4CAF50;
    font-weight: 600;
}

.prontuario-status.info {
    color: #2196F3;
}

.prontuario-status.error {
    color: #ff5252;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Estilos para o Summernote */
#summernote {
    background-color: #ffffff;
    color: #333333;
    border-radius: 0;
    width: 100%;
    height: calc(100vh - 180px);
}

.note-editor.note-frame {
    border: 1px solid #ddd !important;
    background-color: #ffffff;
    margin-bottom: 0 !important;
    border-radius: 4px 4px 0 0 !important;
    width: 100% !important;
}

.note-editing-area {
    background-color: #ffffff;
}

.note-editable {
    background-color: #ffffff !important;
    color: #333333 !important;
    height: calc(100vh - 260px) !important;
    padding: 15px !important;
    font-family: Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    border: none !important;
}

.note-toolbar {
    background-color: #f5f5f5 !important;
    border-bottom: 1px solid #ddd !important;
    padding: 5px !important;
}

.note-btn {
    background-color: #ffffff !important;
    color: #333333 !important;
    border-color: #dddddd !important;
}

.note-btn:hover {
    background-color: #f0f0f0 !important;
}

.note-dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dddddd !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.note-dropdown-item {
    color: #333333 !important;
}

.note-dropdown-item:hover {
    background-color: #f0f0f0 !important;
}

.note-modal-content {
    background-color: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #dddddd !important;
}

.note-modal-header {
    border-bottom: 1px solid #dddddd !important;
    background-color: #f5f5f5 !important;
}

.note-modal-footer {
    border-top: 1px solid #dddddd !important;
    background-color: #f5f5f5 !important;
}

.note-form-label {
    color: #333333 !important;
}

.prontuario-toggle-btn {
    background: linear-gradient(135deg, #666666 0%, #444444 100%) !important;
}

.prontuario-toggle-btn.active {
    background: linear-gradient(135deg, #555555 0%, #777777 100%) !important;
}

/* ===== VÍDEOS - CONFIGURAÇÃO COMPLETA ===== */

/* Vídeo principal (remoto) - Container */
.main-video-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Vídeo principal - Elemento VIDEO com máxima especificidade */
.video-section .main-video-container video,
.main-video-container > video,
video#remoteVideo,
#remoteVideo {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
    background-color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Vídeo local (picture-in-picture) - Container */
.local-video-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 160px;
    height: 160px;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    border: none;
    z-index: 100;
    cursor: move;
    transition: all 0.3s ease;
}

.local-video-container:hover {
    transform: scale(1.02);
}

/* Vídeo local - Elemento VIDEO com máxima especificidade */
.local-video-container video,
.local-video-container > video,
video#localVideo,
#localVideo {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    background-color: #000 !important;
    border-radius: 12px !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

.local-video-container:hover video,
.local-video-container:hover > video {
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5) !important;
}

/* Overlays de vídeo */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    color: #b3b3b3;
    font-size: 14px;
    border-radius: 12px;
}

.local-video-container .video-overlay {
    border-radius: 12px;
    bottom: 0;
}

.video-overlay i {
    font-size: 48px;
    margin-bottom: 10px;
    color: #666;
}

.local-video-container .video-overlay i {
    font-size: 32px;
    margin-bottom: 5px;
}

.main-video-container .video-overlay i {
    font-size: 72px;
}

/* Labels de identificação dos vídeos */
.video-label {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 999;
    pointer-events: none;
}

.video-label i {
    font-size: 12px;
    color: #4CAF50;
}

.local-label {
  position: absolute;
  bottom: -40px;
  left: 5px;
  padding: 8px 12px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-weight: 500;
  min-width: 80px;
  z-index: 101;
}

.local-label i {
    font-size: 10px;
}

/* Chat como coluna fixa */
.chat-sidebar {
    width: 100%;
    height: 100%;
    background: #2d2d2d;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.chat-header h4 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.close-chat-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: block;
}

.close-chat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #555 #2d2d2d;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message.own {
    align-items: flex-end;
}

.chat-message .message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.own .message-bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message:not(.own) .message-bubble {
    background: #444;
    color: #ffffff;
    border-bottom-left-radius: 4px;
}

.chat-message .message-time {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    padding: 0 5px;
}

.chat-input-container {
    padding: 15px 20px 20px 20px;
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    background: #444;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#messageInput:focus {
    border-color: #007bff;
    background: #555;
}

#messageInput::placeholder {
    color: #aaa;
}

#sendMessageBtn {
    background: #007bff;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendMessageBtn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

/* Controles da chamada */
.call-controls {
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    display: flex;
    justify-content: center;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    flex-shrink: 0;
    transition: right 0.3s ease;
}

/* Ajustes dos controles baseado no estado das barras laterais */
.video-call-container .call-controls {
    left: 0; /* Padrão sem margem (paciente) */
    right: 60px; /* Sempre considera barra do chat */
}

/* Apenas médico tem espaço para barra do prontuário */
.video-call-container.has-prontuario .call-controls {
    left: 60px; /* Considera barra do prontuário */
}

.video-call-container.prontuario-open .call-controls {
    left: 400px; /* Prontuário aberto */
}

.video-call-container.chat-open .call-controls {
    right: 450px; /* Chat aberto */
}

.controls-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

/* Esconder botão mobile em desktop */
.control-btn.mobile-only {
    display: none;
}

.control-btn.active {
    background: #4CAF50;
}

.control-btn.active:hover {
    background: #45a049;
}

.audio-btn:not(.active) {
    background: #f44336;
}

.video-btn:not(.active) {
    background: #f44336;
}

.speaker-btn:not(.active) {
    background: #f44336;
}

.speaker-btn:not(.active) i {
    color: #fff;
}

.speaker-btn .fa-volume-mute {
    color: #fff !important;
}

.exit-btn {
    background: #f44336;
    width: 64px;
    height: 64px;
}

.exit-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.chat-toggle-btn {
    display: flex; /* Sempre visível para médicos poderem abrir/fechar */
}

/* Botão de configurações flutuante */
.floating-settings-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.floating-settings-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.floating-settings-btn:active {
    transform: scale(0.95);
}

/* Cronômetro da chamada flutuante */
.floating-call-timer {
    position: absolute;
    top: 26px; /* Centralizado com os botões */
    left: 80px; /* Posicionado ao lado do botão de configurações */
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 80px;
    justify-content: center;
}

.floating-call-timer:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.floating-call-timer i {
    color: #28a745;
    font-size: 12px;
}

/* Botão de gravar chamada flutuante */
.floating-record-btn {
    position: absolute;
    top: 20px;
    left: 180px; /* Posicionado ao lado do cronômetro */
    z-index: 100;
    background: rgba(220, 53, 69, 0.8); /* Vermelho para gravação */
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.floating-record-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.floating-record-btn:active {
    transform: scale(0.95);
}

.floating-record-btn.recording {
    background: #dc3545;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3); }
    50% { box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6); }
    100% { box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3); }
}

.floating-record-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    pointer-events: none;
}

.floating-record-btn:disabled.recording {
    background: #dc3545;
    opacity: 0.6 !important;
    animation: none; /* Remove animação quando desabilitado */
}

/* Notificações de gravação */
.recording-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: none;
}

.recording-notification.info {
    border-left: 4px solid #17a2b8;
}

.recording-notification.success {
    border-left: 4px solid #28a745;
}

.recording-notification.error {
    border-left: 4px solid #dc3545;
}

.recording-notification.warning {
    border-left: 4px solid #ffc107;
}

/* Modal de consentimento de gravação */
.recording-consent-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.recording-consent-content {
    background: #2d2d2d;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.recording-consent-content h4 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 18px;
}

.recording-consent-content p {
    color: #b3b3b3;
    margin-bottom: 25px;
    line-height: 1.5;
}

.recording-consent-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.recording-consent-buttons .btn {
    flex: 1;
    max-width: 120px;
}

/* Modal de confirmação para encerrar chamada */
.end-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-call-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.end-call-content {
    background: #2c2c2c;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #404040;
    text-align: center;
}

.end-call-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.end-call-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 1.3em;
    font-weight: 600;
}

.end-call-content p {
    color: #b3b3b3;
    margin-bottom: 25px;
    line-height: 1.5;
    font-size: 1.1em;
}

.end-call-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.end-call-buttons .btn {
    flex: 1;
    max-width: 140px;
    padding: 12px 20px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.end-call-buttons .btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.end-call-buttons .btn-warning:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.end-call-buttons .btn-secondary:hover {
    background: #6c757d;
    transform: translateY(-2px);
}

/* Modal de opções de saída */
.exit-options-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.exit-options-buttons .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px;
    text-align: center;
    min-height: 60px;
    justify-content: center;
}

.exit-options-buttons .btn small {
    display: block;
    font-size: 11px;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: normal;
}

/* Modal de chamada encerrada */
.call-ended-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-ended-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.call-ended-content {
    background: #2c2c2c;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #404040;
    text-align: center;
}

.call-ended-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.call-ended-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 1.3em;
    font-weight: 600;
}

.call-ended-content p {
    color: #b3b3b3;
    margin-bottom: 25px;
    line-height: 1.5;
    font-size: 1.1em;
}

.call-ended-buttons {
    display: flex;
    justify-content: center;
}

.call-ended-buttons .btn {
    padding: 12px 30px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.call-ended-buttons .btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Modal de configurações */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2d2d2d;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-body {
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    color: #ffffff;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-group select {
    width: 100%;
    background: #444;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 10px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.setting-group select:focus {
    border-color: #007bff;
    background: #555;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 2000;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #b3b3b3;
    font-size: 16px;
}

/* Responsividade */
@media (max-width: 768px) {
    .video-call-body {
        flex-direction: row;
    }
    
    .video-call-container {
        flex-direction: row;
    }
    
    .video-section {
        flex: 1;
        height: calc(100vh - 96px); /* Ajustado para controles fixos */
    }
    
    /* No mobile, controles ocupam toda a largura */
    .call-controls {
        right: 0 !important;
        left: 0 !important;
    }
    
    /* No mobile, esconder componentes específicos do chat */
    .chat-sidebar-bar,
    .prontuario-sidebar-bar,
    #chatToggleBtn2 {
        display: none !important;
    }
    
    /* Estilo para o chat em mobile */
    .chat-section {
        position: fixed;
        top: 0;
        right: -100%; /* Inicia fora da tela */
        width: 100%; /* Ocupa toda a largura */
        height: 100%;
        z-index: 9999;
        background: #2d2d2d;
        transition: right 0.3s ease;
        display: none;
    }
    
    /* Quando ativo, exibe o chat em tela cheia */
    .chat-section.active {
        right: 0;
        display: flex !important;
    }
    
    /* Botão de fechar mobile */
    .mobile-close-chat-btn {
           display: none !important; /* Escondido por padrão, reforçado para desktop */
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255,255,255,0.2);
        border: none;
        color: white;
        padding: 8px 15px;
        border-radius: 20px;
        cursor: pointer;
        font-weight: 500;
    }
    
    /* Em mobile, mostra o botão de voltar e ajusta o header */
    @media (max-width: 768px) {
            .mobile-close-chat-btn {
                display: flex !important;
                align-items: center;
                gap: 5px;
            }
        
        .close-chat-btn {
            display: none; /* Esconde o X normal */
        }
        
        .chat-header h4 {
            margin: 0 auto; /* Centraliza o título */
        }
        
        /* Garante que o chat ocupe a tela toda no mobile */
        .chat-section.active .chat-sidebar {
            width: 100%;
            height: 100%;
        }
        
        /* Ajusta a área de mensagens para ocupar mais espaço */
        .chat-messages {
            height: calc(100% - 170px);
        }
        
        /* Chat input na parte inferior */
        .chat-input-container {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: #2d2d2d;
            padding: 15px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }
    }
    
    /* Mostrar o botão de chat mobile */
    .control-btn.mobile-only {
        display: flex !important;
    }
    
    /* No mobile, video-section ocupa toda largura */
    .video-section {
        width: 100% !important;
    }
    
    /* No mobile, container não tem margem esquerda */
    .video-call-container {
        margin-left: 0 !important;
    }
    
    /* Prontuário em mobile ocupa tela toda */
    .prontuario-section {
        width: 100% !important;
        transform: translateX(-100%) !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 9998 !important;
    }
    
    .prontuario-section.active {
        transform: translateX(0) !important;
    }
    
    /* Quando prontuário está aberto em mobile, esconder video-section */
    .video-call-container.has-prontuario.prontuario-open .video-section {
        display: none;
    }
    
    /* Ajustar prontuário content para mobile */
    .prontuario-section.active .prontuario-sidebar {
        width: 100%;
        height: 100vh;
    }
    
    .prontuario-section.active .prontuario-header {
        padding: 15px;
    }
    
    .prontuario-section.active .prontuario-header h4 {
        font-size: 16px;
    }
    
    .prontuario-section.active .close-prontuario-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* Ajustar Summernote para mobile */
    .prontuario-section.active #summernote {
        height: calc(100vh - 200px) !important;
    }
    
    .prontuario-section.active .note-editable {
        height: calc(100vh - 300px) !important;
        font-size: 14px !important;
    }
    
    .prontuario-section.active .btn-save-prontuario {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
    
    /* Vídeo local (PiP) ajustado para mobile - formato quadrado */
    .local-video-container {
        width: 100px;
        height: 100px;
        top: 10px;
        right: 10px;
    }
    
    /* Ajustar PiP quando há barra do prontuário visível (médico) */
    .video-call-container.has-prontuario .local-video-container {
        right: 10px; /* Mantém na direita */
    }
    
    .local-video-container video,
    .local-video-container > video,
    video#localVideo,
    #localVideo {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
        background-color: #000 !important;
        border-width: 1.5px !important;
    }
    
    .local-label {
        margin-top: 5px;
        font-size: 9px;
        padding: 4px 8px;
        min-width: 60px;
    }
    
    .local-label i {
        font-size: 8px;
    }
    
    .floating-settings-btn {
        top: calc(20px + env(safe-area-inset-top));
    }
    
    /* Correções específicas para telas muito pequenas */
    @media (max-width: 380px) {
        /* Vídeo local ainda menor em telas muito pequenas - mantém formato quadrado */
        .local-video-container {
            width: 80px;
            height: 80px;
            top: 8px;
            right: 8px;
        }
        
        .local-video-container video,
        .local-video-container > video,
        video#localVideo,
        #localVideo {
            width: 100% !important;
            height: 100% !important;
            object-fit: contain !important;
            object-position: center !important;
            background-color: #000 !important;
            border-width: 1.5px !important;
        }
        
        .local-label {
            margin-top: 4px;
            font-size: 8px;
            padding: 3px 6px;
            min-width: 50px;
        }
        
        .local-label i {
            font-size: 7px;
        }
    }
    
    .floating-call-timer {
        top: calc(26px + env(safe-area-inset-top)); /* Centralizado com os botões */
        left: calc(75px + env(safe-area-inset-left)); /* Posicionado ao lado do config */
        padding: 6px 12px;
        font-size: 12px;
        min-width: 70px;
    }
    
    .floating-record-btn {
        top: calc(20px + env(safe-area-inset-top));
        left: calc(155px + env(safe-area-inset-left)); /* Posicionado ao lado do cronômetro */
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .local-video-container {
        width: 120px;
        height: 90px;
        top: 20px;
        right: 10px;
    }
    
    .video-label {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .local-label {
        bottom: 5px;
        left: 5px;
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .controls-group {
        gap: 10px;
    }
    
    .control-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    /* Estilo do botão de chat em dispositivos móveis */
    .control-btn.chat-toggle-btn {
        background: #007bff;
        color: white;
    }
    
    .control-btn.chat-toggle-btn:hover {
        background: #0056b3;
    }
    
    /* Ajusta a aparência quando o chat está aberto */
    .control-btn.chat-toggle-btn.active {
        background: #28a745;
    }
    
    /* Estilo do botão de prontuário em dispositivos móveis */
    .control-btn.prontuario-toggle-btn {
        background: #666666;
        color: white;
    }
    
    .control-btn.prontuario-toggle-btn:hover {
        background: #555555;
    }
    
    /* Ajusta a aparência quando o prontuário está aberto */
    .control-btn.prontuario-toggle-btn.active {
        background: #777777;
    }
    
    /* Reduzir botões para caber prontuário + chat */
    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .exit-btn {
        width: 48px;
        height: 48px;
    }
    
    .call-header {
        padding: 10px 15px;
    }
    
    /* Ajustes do modal de consentimento para mobile */
    .recording-consent-modal {
        padding: 20px;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 99999 !important;
        background: rgba(0, 0, 0, 0.95) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .recording-consent-content {
        padding: 25px 20px;
        max-width: 320px;
        width: 85%;
        margin: 0 auto;
    }
    
    .recording-consent-content h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .recording-consent-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .recording-consent-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .recording-consent-buttons .btn {
        max-width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Modal de encerrar chamada - Mobile */
    .end-call-content {
        padding: 25px 20px;
        max-width: 320px;
        width: 85%;
        margin: 0 auto;
    }
    
    .end-call-header h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .end-call-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .end-call-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .end-call-buttons .btn {
        max-width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Modal de chamada encerrada - Mobile */
    .call-ended-content {
        padding: 25px 20px;
        max-width: 320px;
        width: 85%;
        margin: 0 auto;
    }
    
    .call-ended-header h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .call-ended-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .call-ended-buttons .btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}
    
    .participants {
        flex-direction: column;
        gap: 5px;
    }

/* ========================================
   PÁGINA DE LOGIN - NBX MEET
   ======================================== */

.login-page {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #2c3e50;
    max-height: 100vh;
    display: flex;
    overflow: hidden;
}

.login-background {
    width: 100%;
    min-height: 100vh;
    display: flex;
    padding: 0;
}

.login-container {
    width: 100%;
    height: 100vh;
    display: flex;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    overflow: hidden;
}

/* Coluna da esquerda - Apresentação */
.login-presentation {
    flex: 1;
    background: #34495e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.login-presentation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #445566 100%);
    opacity: 1;
}

.presentation-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 400px;
}

.logo-container {
    margin-bottom: 40px;
    animation: fadeInUp 1s ease;
}

.logo-icon {
    font-size: 80px;
    color: #7fb3d3;
    margin-bottom: 20px;
    display: block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.brand-name {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 15px 0;
    letter-spacing: -1px;
}

.brand-subtitle {
    font-size: 18px;
    color: #bdc3c7;
    font-weight: 400;
    margin: 0;
    line-height: 1.4;
}

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

/* Coluna da direita - Formulário */
.login-form-container {
    flex: 1;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    max-width: 600px;
    min-height: 100vh;
}

.login-form-header {
    margin-bottom: 40px;
    animation: fadeInRight 0.8s ease;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.login-form-header h2 {
    font-size: 32px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.login-form-header p {
    color: #6c757d;
    margin: 0;
    font-size: 16px;
    font-weight: 400;
}

/* Alert de erro */
.login-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    border-left: 4px solid #dc3545;
    animation: slideIn 0.3s ease;
}

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

.login-alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

.login-alert i {
    font-size: 16px;
    color: #dc3545;
}

/* Formulário */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeInRight 0.8s ease 0.2s both;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-input-group label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
    margin-bottom: 5px;
}

.login-input-wrapper {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7fb3d3;
    font-size: 16px;
    z-index: 2;
}

.login-input {
    width: 100%;
    padding: 16px 16px 16px 45px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 400;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: #7fb3d3;
    box-shadow: 0 0 0 2px rgba(127, 179, 211, 0.2);
}

.login-input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

/* Botão de login */
.login-btn {
    background: #7fb3d3;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    margin-top: 16px;
    width: 100%;
}

.login-btn:hover {
    background: #6ba3c7;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn i {
    font-size: 16px;
}

/* Footer do login */
.login-footer {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #dee2e6;
    animation: fadeInRight 0.8s ease 0.4s both;
}

.login-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #28a745;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 16px;
}

.login-help {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.login-help small {
    font-size: 12px;
    color: #6c757d;
}

/* Responsividade */
@media (max-width: 768px) {
    .login-page {
        overflow-y: auto;
    }
    
    .login-background {
        min-height: 100vh;
        padding: 0;
    }
    
    .login-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .login-presentation {
        flex: none;
        min-height: 200px;
        padding: 30px 20px;
    }
    
    .logo-container {
        margin-bottom: 20px;
    }
    
    .logo-icon {
        font-size: 50px;
        margin-bottom: 10px;
    }
    
    .brand-name {
        font-size: 24px;
        margin: 0 0 5px 0;
    }
    
    .brand-subtitle {
        font-size: 14px;
    }
    
    .login-form-container {
        flex: 1;
        padding: 30px 20px;
        max-width: none;
        min-height: auto;
    }
    
    .login-form-header {
        margin-bottom: 25px;
    }
    
    .login-form-header h2 {
        font-size: 22px;
    }
    
    .login-form {
        gap: 20px;
    }
    
    .login-input {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 14px 14px 14px 40px;
    }
    
    .login-btn {
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .login-page {
        padding: 0;
    }
    
    .login-presentation {
        min-height: 160px;
        padding: 20px 15px;
    }
    
    .logo-container {
        margin-bottom: 15px;
    }
    
    .logo-icon {
        font-size: 40px;
        margin-bottom: 5px;
    }
    
    .brand-name {
        font-size: 20px;
        margin: 0 0 4px 0;
    }
    
    .brand-subtitle {
        font-size: 12px;
    }
    
    .login-form-container {
        padding: 25px 15px;
    }
    
    .login-form-header {
        margin-bottom: 20px;
    }
    
    .login-form-header h2 {
        font-size: 20px;
    }
    
    .login-form-header p {
        font-size: 14px;
    }
    
    .login-input {
        padding: 12px 12px 12px 38px;
    }
    
    .login-input-icon {
        left: 12px;
        font-size: 14px;
    }
    
    .toggle-password {
        right: 12px;
        font-size: 14px;
    }
    
    .login-btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .login-footer {
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .login-info {
        font-size: 13px;
    }
    
    .login-help {
        font-size: 13px;
    }
}
