/* ============================================
   ORCAMENTOS MODULE - SPLIT LAYOUT STYLES
   Versao limpa e simplificada
   ============================================ */

/* ============================================
   LAYOUT BASE - ESTRUTURA PRINCIPAL
   ============================================ */

/* Container principal - ocupa toda a tela */
#app-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Barra de Busca de Paciente */
.patient-search-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-container i.fa-search {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 16px;
}

.search-container input {
  width: 100%;
  padding: 15px 20px 15px 45px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.search-container input:focus {
  outline: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.patient-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  margin-top: 5px;
}

.patient-results.show {
  display: block;
}

.patient-result-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

.patient-result-item:hover {
  background: #f8fafc;
}

.patient-result-item:last-child {
  border-bottom: none;
}

.patient-result-item strong {
  display: block;
  color: #1e293b;
  font-size: 14px;
}

.patient-result-item small {
  color: #64748b;
  font-size: 12px;
}

.patient-result-item.searching {
  color: #6366f1;
  font-size: 14px;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 10px;
}

.patient-result-item.searching:hover {
  background: white;
}

/* Barra do Paciente Selecionado */
.patient-bar {
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.patient-bar-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.patient-avatar {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.patient-data strong {
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
}

.patient-details {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #94a3b8;
}

.patient-details i {
  margin-right: 5px;
}

.btn-change-patient {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-change-patient:hover {
  background: rgba(255,255,255,0.2);
}

.patient-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-refresh {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh:hover {
  background: rgba(255,255,255,0.2);
}

.btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   CONTAINER SPLIT - DOIS PAINEIS
   ============================================ */

.orc-split-container {
  display: flex;
  flex: 1;
  background: #f1f5f9;
  overflow: hidden;
  min-height: 0; /* CRUCIAL para flex + overflow */
}

/* Painel Esquerdo - Lista de Orcamentos */
.orc-panel-left {
  width: 580px;
  min-width: 500px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: white;
  border-right: 1px solid #e2e8f0;
}

/* Painel Direito - Detalhes */
.orc-panel-right {
  flex: 1;
  position: relative; /* Para posicionar filhos absolutos */
  background: white;
  min-width: 0;
  overflow: hidden;
}

/* ============================================
   PAINEL ESQUERDO - COMPONENTES
   ============================================ */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.panel-header h3 i {
  color: #8b5cf6;
}

.list-filters {
  padding: 10px 15px;
  border-bottom: 1px solid #e2e8f0;
  background: #fafafa;
  flex-shrink: 0;
}

.list-filters select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

/* Tabela de Orcamentos - com scroll */
.orc-table-wrapper {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.orc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.orc-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  font-size: 11px;
  text-transform: uppercase;
}

.orc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.orc-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.orc-table tbody tr:hover {
  background: #f8fafc;
}

.orc-table tbody tr.selected {
  background: #ede9fe;
}

.orc-table tbody tr.selected td {
  color: #5b21b6;
}

.orc-table .empty-row td {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
  cursor: default;
}

.orc-table .text-right {
  text-align: right;
}

.orc-table .cell-ellipsis {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Rodape do Painel */
.panel-footer {
  padding: 10px 15px;
  border-top: 1px solid #e2e8f0;
  background: #fafafa;
  font-size: 12px;
  color: #64748b;
  flex-shrink: 0;
}

/* Status Indicators */
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.prescrito { background: #f59e0b; }      /* Amarelo - Orçamento prescrito */
.status-dot.executado { background: #22c55e; }      /* Verde - Executado */
.status-dot.sem-interesse { background: #ef4444; }  /* Vermelho - Não tem interesse */
.status-dot.sem-dinheiro { background: #fb923c; }   /* Laranja - Sem dinheiro/cartão */
.status-dot.agendado { background: #3b82f6; }       /* Azul - Agendado */
.status-dot.pesquisa { background: #8b5cf6; }       /* Roxo - Pesquisa de preço */
.status-dot.pago { background: #4ade80; }           /* Verde claro - Pago não agendado */
.status-dot.sem-condicoes { background: #9ca3af; }  /* Cinza - Sem condições */
.status-dot.agendado-nao { background: #60a5fa; }   /* Azul claro - Agendado não executado */
.status-dot.outro-local { background: #6b7280; }    /* Cinza escuro - Indicado outro local */

/* ============================================
   PAINEL DIREITO - DETALHES DO ORCAMENTO
   ============================================ */

/* Estado vazio */
.panel-empty {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  text-align: center;
  padding: 40px;
}

.panel-empty i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.panel-empty p {
  font-size: 14px;
}

/* Painel de Detalhes */
.orc-detail-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.orc-detail-panel.active {
  display: flex;
}

/* Header do Detalhe */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.prescrito { background: #fef3c7; color: #d97706; }
.status-badge.executado { background: #dcfce7; color: #16a34a; }
.status-badge.sem-interesse { background: #fee2e2; color: #dc2626; }
.status-badge.sem-dinheiro { background: #ffedd5; color: #ea580c; }
.status-badge.agendado { background: #dbeafe; color: #2563eb; }
.status-badge.pesquisa { background: #ede9fe; color: #7c3aed; }
.status-badge.pago { background: #d1fae5; color: #059669; }
.status-badge.sem-condicoes { background: #f3f4f6; color: #6b7280; }
.status-badge.agendado-nao { background: #e0f2fe; color: #0284c7; }
.status-badge.outro-local { background: #e5e7eb; color: #4b5563; }

.detail-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.status-select {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: white;
  color: #1e293b;
  cursor: pointer;
  min-width: 140px;
}

.status-select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139,92,246,0.2);
}

.status-select:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s;
}

.btn-icon:hover { background: #f8fafc; color: #1e293b; }
.btn-icon.success:hover { background: #dcfce7; color: #16a34a; border-color: #22c55e; }
.btn-icon.info:hover { background: #dbeafe; color: #2563eb; border-color: #3b82f6; }
.btn-icon.warning:hover { background: #fef3c7; color: #d97706; border-color: #f59e0b; }
.btn-icon.purple:hover { background: #ede9fe; color: #7c3aed; border-color: #8b5cf6; }
.btn-icon.danger:hover { background: #fee2e2; color: #dc2626; border-color: #ef4444; }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-icon:disabled:hover { background: white; color: #64748b; border-color: #e2e8f0; }

.btn-icon-sm {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm:hover { background: #f1f5f9; color: #64748b; }
.btn-icon-sm.danger:hover { background: #fee2e2; color: #dc2626; }
.btn-icon-sm:disabled { opacity: 0.3; cursor: not-allowed; }

/* Grid de Informacoes */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.info-item {
  background: white;
  padding: 12px 15px;
}

.info-item label {
  display: block;
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.info-item span {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
}

/* Abas */
.detail-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  background: #fafafa;
  flex-shrink: 0;
}

.tab-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover { color: #1e293b; background: white; }
.tab-btn.active { color: #8b5cf6; border-bottom-color: #8b5cf6; background: white; }

/* Conteudo das Abas */
.tab-content {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
}

/* Tab Procedimentos */
#tabProcedimentos .proc-table-wrapper {
  /* Altura calculada: viewport - header(60) - patient(70) - detailHeader(60) - infoGrid(90) - tabs(45) - procHeader(45) - totals(100) - margem(30) */
  max-height: calc(100vh - 500px);
  overflow-y: auto;
}

/* Tab Observacoes */
#tabObservacoes .obs-content {
  max-height: calc(100vh - 400px);
  overflow-y: auto;
}

/* ============================================
   ABA DE PROCEDIMENTOS
   ============================================ */

.proc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  flex-shrink: 0;
}

.proc-header span {
  font-size: 12px;
  color: #64748b;
}

/* Tabela de Procedimentos - AQUI ESTA O SCROLL */
.proc-table-wrapper {
  overflow-y: auto;
  min-height: 0;
}

.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.proc-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  font-size: 10px;
  text-transform: uppercase;
  z-index: 1;
}

.proc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.proc-table .text-center { text-align: center; }
.proc-table .text-right { text-align: right; }

.proc-table tbody tr:hover { background: #faf5ff; }
.proc-table tbody tr.paid-row { background: #f0fdf4; }
.proc-table tbody tr.paid-row:hover { background: #dcfce7; }

.paid-badge {
  background: #22c55e;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
}

.pending-badge {
  background: #f59e0b;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
}

/* Totalizador - SEMPRE VISIVEL NO FINAL */
.proc-totals {
  padding: 15px;
  border-top: 2px solid #e2e8f0;
  background: #fafafa;
  flex-shrink: 0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  color: #64748b;
}

.total-row.final {
  font-size: 16px;
  font-weight: 600;
  color: #8b5cf6;
  border-top: 1px solid #8b5cf6;
  margin-top: 8px;
  padding-top: 10px;
}

/* ============================================
   ABA DE OBSERVACOES
   ============================================ */

.obs-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.obs-content textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  resize: vertical;
}

.obs-content textarea:focus {
  outline: none;
  border-color: #8b5cf6;
}

/* ============================================
   BOTOES
   ============================================ */

.btn-action-sm {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-action-sm:hover { background: #f8fafc; }
.btn-action-sm.primary { background: #8b5cf6; color: white; border-color: #8b5cf6; }
.btn-action-sm.primary:hover { background: #7c3aed; }

.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 10px 20px;
  background: white;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.btn-secondary:hover { background: #f8fafc; }

/* ============================================
   MODAIS
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.modal-content.modal-small {
  max-width: 380px;
}

.modal-content.modal-medium {
  max-width: 520px;
}

.modal-content.modal-wide {
  max-width: 680px;
}

.modal-content.modal-large {
  max-width: 750px;
}

/* Filtros de Procedimentos */
.proc-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.proc-filter-btn {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 20px;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.proc-filter-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.proc-filter-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #5b3aab 100%);
  color: white;
  border-color: transparent;
}

.proc-filter-btn.active i {
  color: white;
}

.proc-filter-btn i {
  font-size: 11px;
  color: #8b5cf6;
}

/* Form Row 3 columns */
.form-row-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}

/* Secao Medico inline */
.form-section-medico {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 12px;
}

.selected-medico {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 13px;
}

.selected-medico i {
  color: #7c3aed;
  font-size: 16px;
}

.selected-medico span {
  font-weight: 600;
  color: #1e293b;
}

.selected-medico small {
  color: #64748b;
  margin-left: auto;
}

.btn-remove-medico {
  width: 24px;
  height: 24px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  margin-left: 8px;
  transition: all 0.2s;
}

.btn-remove-medico:hover {
  background: #ef4444;
  color: white;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1100;
  display: none;
  margin-top: 4px;
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-item:hover {
  background: #faf5ff;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item .result-info strong {
  display: block;
  font-size: 13px;
  color: #1e293b;
}

.search-result-item .result-info small {
  font-size: 11px;
  color: #64748b;
}

/* Selected Item Card */
.selected-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ede9fe;
  border: 1px solid #8b5cf6;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 10px;
}

.selected-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selected-item-info > i {
  font-size: 20px;
  color: #8b5cf6;
}

.selected-item-info strong {
  display: block;
  color: #1e293b;
  font-size: 13px;
}

.selected-item-info small {
  color: #64748b;
  font-size: 11px;
}

.btn-remove-item {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-remove-item:hover {
  background: #ef4444;
  color: white;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: linear-gradient(135deg, #667eea 0%, #5b3aab 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i { color: white; }

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  font-size: 18px;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(255,255,255,0.3); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

/* Form Elements */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 12px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

.form-group select:disabled {
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
  opacity: 1;
}

/* Busca de Procedimentos no Modal */
.proc-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1100;
  display: none;
  margin-top: 4px;
}

.proc-results.show { display: block; }

.proc-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.proc-result-item:hover { background: #faf5ff; }
.proc-result-item:last-child { border-bottom: none; }

.proc-result-item .proc-info { flex: 1; }
.proc-result-item .proc-info strong { display: block; font-size: 13px; color: #1e293b; }
.proc-result-item .proc-info small { font-size: 11px; color: #64748b; }
.proc-result-item .proc-price { font-weight: 600; color: #8b5cf6; }

.selected-proc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ede9fe;
  border: 1px solid #8b5cf6;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.selected-proc .proc-info strong { display: block; color: #1e293b; }
.selected-proc .proc-info small { color: #64748b; }
.selected-proc .proc-value { font-size: 18px; font-weight: 600; color: #8b5cf6; }

/* Opcoes de Envio */
.send-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.send-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
}

.send-option:hover { background: #f1f5f9; }
.send-option input { width: 18px; height: 18px; }
.send-option .fa-whatsapp { color: #25d366; font-size: 20px; }
.send-option .fa-envelope { color: #3b82f6; font-size: 18px; }

/* Link de Pagamento */
.pay-link-box {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}

.pay-link-box input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  background: #f8fafc;
}

.btn-copy {
  width: 44px;
  height: 44px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
}

.btn-copy:hover { background: #8b5cf6; color: white; border-color: #8b5cf6; }

.pay-value {
  text-align: center;
  padding: 15px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border-radius: 8px;
}

.pay-value strong { font-size: 24px; display: block; margin-top: 5px; }

/* Confirm Dialog */
.confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}

.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }
.toast.warning { background: #f59e0b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
  .detail-info-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1000px) {
  .orc-split-container {
    flex-direction: column;
  }

  .orc-panel-left {
    width: 100%;
    min-width: unset;
    height: 280px;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .orc-panel-right {
    flex: 1;
    min-height: 300px;
  }

  .detail-info-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .patient-bar {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .patient-bar-info { flex-direction: column; }
  .detail-info-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-actions { flex-wrap: wrap; }
}

/* ============================================
   MODAL CARRINHO - ADICIONAR PROCEDIMENTOS
   ============================================ */

.modal-content.modal-cart {
  max-width: 950px;
  height: 85vh;
  max-height: 700px;
}

.modal-body-cart {
  display: flex;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
  flex: 1;
}

/* Lado Esquerdo: Busca e Grid */
.cart-search-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e2e8f0;
  overflow: hidden;
}

.cart-search-section .proc-filters {
  padding: 15px;
  margin: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fafafa;
}

.cart-search-input {
  position: relative;
  padding: 12px 15px;
  border-bottom: 1px solid #e2e8f0;
}

.cart-search-input i {
  position: absolute;
  left: 27px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}

.cart-search-input input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.cart-search-input input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

/* Grid de Resultados */
.proc-grid-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
}

.proc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.proc-grid-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.proc-grid-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.proc-grid-empty p {
  font-size: 14px;
}

/* Card de Procedimento */
.proc-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proc-card:hover {
  border-color: #c4b5fd;
  background: #faf5ff;
}

.proc-card.selected {
  border-color: #8b5cf6;
  background: #ede9fe;
}

.proc-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.proc-card-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.proc-card.selected .proc-card-checkbox {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.proc-card.selected .proc-card-checkbox i {
  color: white;
  font-size: 11px;
}

.proc-card-info {
  flex: 1;
  min-width: 0;
}

.proc-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.proc-card-code {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.proc-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.proc-card-price {
  font-size: 15px;
  font-weight: 700;
  color: #8b5cf6;
}

.proc-card-group {
  font-size: 10px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Lado Direito: Carrinho */
.cart-items-section {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: white;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #e2e8f0;
  background: #fafafa;
}

.cart-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-header h4 i {
  color: #8b5cf6;
}

.cart-count {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 12px;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
  padding: 30px;
}

.cart-empty i {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.cart-empty p {
  font-size: 13px;
}

/* Item do Carrinho */
.cart-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.cart-item-name {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  line-height: 1.3;
}

.cart-item-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.cart-item-remove:hover {
  background: #ef4444;
  color: white;
}

.cart-item-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-item-qty button {
  width: 24px;
  height: 24px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-qty button:hover {
  background: #f1f5f9;
}

.cart-item-qty input {
  width: 40px;
  text-align: center;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px;
  font-size: 12px;
}

.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #8b5cf6;
}

/* Total do Carrinho */
.cart-total {
  padding: 15px;
  border-top: 2px solid #8b5cf6;
  background: #ede9fe;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total span {
  font-size: 14px;
  color: #64748b;
}

.cart-total strong {
  font-size: 20px;
  color: #7c3aed;
}

/* Responsive para modal carrinho */
@media (max-width: 800px) {
  .modal-content.modal-cart {
    max-width: 95%;
    height: 90vh;
  }

  .modal-body-cart {
    flex-direction: column;
  }

  .cart-search-section {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    height: 50%;
  }

  .cart-items-section {
    width: 100%;
    height: 50%;
  }

  .proc-grid {
    grid-template-columns: 1fr;
  }
}
