:root {
  --primary: #8e44ad;
  --primary-hover: #732d91;
  --primary-bg: #f5eefb;
  --sidebar-bg: #2b2d30;
  --sidebar-hover: #3a3d42;
  --sidebar-active: #8e44ad;
  --bg: #f4f5f8;
  --panel: #ffffff;
  --border: #e2e5ec;
  --text: #2b2d30;
  --text-muted: #6b707e;
  --danger: #d93025;
  --warning: #f9ab00;
  --success: #1e8e3e;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { display: flex; height: 100vh; background-color: var(--bg); color: var(--text); overflow: hidden; }

/* Tela de Login */
.login-wrapper { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: var(--sidebar-bg); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.login-card { background: var(--panel); border-radius: 12px; width: 100%; max-width: 420px; padding: 32px; box-shadow: 0 15px 35px rgba(0,0,0,0.3); border: 1px solid var(--border); }
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h2 { color: var(--primary); font-size: 1.6rem; font-weight: 700; }
.login-header p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Modais */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(43, 45, 48, 0.5); display: none; justify-content: center; align-items: center; z-index: 1000; padding: 20px; overflow-y: auto; }
.modal-card { background: var(--panel); border-radius: 10px; width: 100%; max-width: 600px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); border: 1px solid var(--border); display: flex; flex-direction: column; max-height: 95vh; overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.modal-header { padding: 20px 24px; margin-bottom: 0; }
.modal-header h4 { color: var(--primary); font-weight: 700; }
.close-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }
.modal-body { flex: 1; overflow-y: auto; padding: 0 24px 20px 24px; }
.modal-footer { padding: 15px 24px; border-top: 1px solid var(--border); background: #f8f9fc; }

/* Sidebar */
.sidebar { width: 280px; background-color: var(--sidebar-bg); color: #ffffff; display: flex; flex-direction: column; z-index: 10; transition: width 0.3s ease; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid #3d4046; background-color: #212325; }
.sidebar-header h2 { font-size: 1.25rem; color: #ffffff; font-weight: 700; }
.sidebar-header p { font-size: 0.8rem; color: #a0a5b5; margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-header img, .therapist-header-brand img {
  max-height: 50px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1); /* Deixa a logo branca para contrastar com o fundo escuro */
}

.nav-list { list-style: none; padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-btn { width: 100%; border: none; background: none; padding: 13px 20px; text-align: left; font-size: 1.2rem; color: #c5c9d6; cursor: pointer; display: flex; align-items: center; gap: 15px; transition: all 0.2s; min-height: 44px; white-space: nowrap; }
.nav-btn:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.nav-btn.active { background-color: var(--sidebar-active); color: #ffffff; font-weight: 600; }
.admin-tag { font-size: 0.68rem; background: rgba(255, 255, 255, 0.2); color: #ffffff; padding: 2px 6px; border-radius: 4px; margin-left: auto; }

.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; transition: margin-left 0.3s ease; }
.topbar { height: 64px; background-color: var(--panel); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; }
.topbar > div:first-of-type { flex-grow: 1; }
.topbar > .profile-box { flex-shrink: 0; }
.nav-text { font-size: 0.9rem; }
.profile-box { display: flex; align-items: center; gap: 8px; background: var(--primary-bg); padding: 6px 14px; border-radius: 20px; border: 1px solid #e1d2f2; font-size:0.88rem; color: var(--primary); }

.content { flex: 1; overflow-y: auto; padding: 24px; }
.tab-content { display: none; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.tab-content.active { display: block; }

/* Formulários */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; outline: none; min-height: 44px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }

.alert-banner { padding: 12px; border-radius: 6px; margin-bottom: 15px; font-size: 0.9rem; display: none; }
.alert-danger { background: #fce8e6; border-left: 4px solid var(--danger); color: #c5221f; }
.alert-warning { background: #fef7e0; border-left: 4px solid var(--warning); color: #b06000; }

.btn-submit { background-color: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; min-height: 44px; }
.btn-submit:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: #f0f2f7; color: var(--text); border: 1px solid var(--border); padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; min-height: 44px; }
.btn-secondary:hover { background-color: #e2e5ed; }
.btn-excel { background-color: #1e8e3e; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-excel:hover { background-color: #137333; }
.btn-danger { background-color: var(--danger); color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-warning { background-color: var(--warning); color: var(--text); border: 1px solid #f29900; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-warning:hover { background-color: #f29900; }
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); padding: 0 5px; }

/* Agenda e Animações */
.week-navigation { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.week-navigation h4 { font-size: 1.1rem; color: var(--primary); font-weight: 700; }

/* ESTICA A GRADE PARA CRIAR A BARRA DE ROLAGEM NO COMPUTADOR (JANELA PEQUENA) */
.calendar-grid { min-width: 850px; display: grid; grid-template-columns: 80px repeat(5, 1fr); border: 1px solid var(--border); background: var(--panel); border-radius: 8px; overflow: hidden; }
.agenda-modo-dia .calendar-grid { min-width: 100% !important; grid-template-columns: 80px 1fr !important; }

/* DEIXA A BARRA DE ROLAGEM MAIS BONITA E VISÍVEL NO COMPUTADOR */
.agenda-scroll-container::-webkit-scrollbar { height: 10px; }
.agenda-scroll-container::-webkit-scrollbar-track { background: transparent; }
.agenda-scroll-container::-webkit-scrollbar-thumb { background-color: #c5c9d6; border-radius: 10px; }
.agenda-scroll-container::-webkit-scrollbar-thumb:hover { background-color: var(--primary); }

.calendar-header { background: #f8f9fc; padding: 12px 6px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 0.85rem; }
.time-slot { height: 60px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 0.8rem; text-align: center; color: var(--text-muted); padding-top: 5px; background: #fafbfd; }
.cell-slot { height: 60px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); cursor: pointer; padding: 2px; }
.cell-slot { display: flex; gap: 2px; }
.empty-slot:hover { background-color: #f0f2f7; } /* Efeito hover para slots vazios */
.empty-slot { cursor: pointer; }


.event-card {
  position: relative; /* Essencial para o posicionamento do checkmark */
  flex: 1;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.75rem;
  height: 100%;
  border-left: 4px solid;
  cursor: pointer;
  overflow: hidden;
}
.session-done-check {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 14px;
  color: #0d652d; /* Verde escuro */
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  padding: 2px;
  z-index: 10;
}
.status-tag { display: inline-block; padding: 2px 4px; border-radius: 3px; font-size: 0.65rem; font-weight: bold; margin-top: 2px; }
.status-completed { background: #e6f4ea; color: #137333; }
.status-missed { background: #fce8e6; color: #c5221f; }
.status-credited { background: #d2e3fc; color: #174ea6; }
.status-scheduled { background: #f1f3f4; color: #5f6368; }

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(30, 142, 62, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(30, 142, 62, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(30, 142, 62, 0); }
}
@keyframes blink-alert {
  0% { opacity: 1; box-shadow: 0 0 0px transparent; }
  50% { opacity: 0.8; box-shadow: 0 0 8px inset rgba(0, 0, 0, 0.3); filter: brightness(1.1); }
  100% { opacity: 1; box-shadow: 0 0 0px transparent; }
}
.needs-action-blink {
  animation: urgentSessionBlink 1.15s infinite !important;
  position: relative;
  z-index: 2;
}

@keyframes urgentSessionBlink {
  0%, 100% {
      box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.25);
      filter: brightness(1);
  }

  50% {
      background-color: #b71c1c !important;
      border-color: #7f0000 !important;
      color: #ffffff !important;
      box-shadow: 0 0 0 4px rgba(183, 28, 28, 0.35);
      filter: brightness(1.12);
  }
}

/* Aviso de sessões vencidas ainda sem atenção */
.alerta-sessoes-pendentes {
  margin: 0 0 16px 0;
  padding: 14px 16px;
  background: #fff3f3;
  border: 1px solid #e57373;
  border-left: 5px solid #c62828;
  border-radius: 8px;
  color: #8e1b1b;
  line-height: 1.4;
}

.alerta-sessoes-pendentes strong {
  display: block;
  margin-bottom: 4px;
}

.alerta-sessoes-pendentes span {
  font-size: 0.86rem;
}

/* Footer da Marca */
.footer-brand {
  position: fixed;
  bottom: 10px;
  right: 15px;
  z-index: 100;
  color: #a0a5b5;
  text-align: right;
}
.sync-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.65rem;
  margin-bottom: 5px;
}
.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}
.brand-text { font-family: 'Roboto', 'Inter', sans-serif; font-weight: 900; text-transform: uppercase; font-style: italic; line-height: 1; }
.main-brand { font-size: 0.9rem; }
.sub-brand { font-size: 0.5rem; display: block; letter-spacing: 0.5px; }
@keyframes blinkAlert { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }
.blink-pending { animation: blinkAlert 1.2s infinite; background-color: #fce8e6 !important; color: #c5221f !important; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 1px solid #d93025; }

.report-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.report-table th, .report-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.report-table th { background-color: #f8f9fc; font-weight: 600; }

/* --- NOVA INTERFACE DO TERAPEUTA --- */
.therapist-header {
  height: 70px;
  width: 100%;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  flex-shrink: 0;
}
.therapist-header-brand h3 { color: var(--primary); }
.therapist-header-brand p { font-size: 0.8rem; color: var(--text-muted); }
.therapist-header-profile { display: flex; align-items: center; gap: 15px; }
.therapist-header-profile .profile-info { text-align: right; }
.therapist-header-profile .profile-info strong { display: block; font-size: 0.9rem; }
.therapist-header-profile .profile-info span { font-size: 0.8rem; color: var(--text-muted); }

.therapist-main-content {
  flex: 1;
  overflow-y: auto;
  background: #f8f9fa;
  padding: 30px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.action-card {
  background: var(--panel);
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.action-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.action-card-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.action-card-label { font-size: 1rem; font-weight: 600; color: var(--text); }

.therapist-tab-content { display: none; }
.therapist-tab-content.active { display: block; }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }
.kpi-card { background: var(--panel); border: 1px solid var(--border); border-left: 5px solid var(--kpi-color, var(--primary)); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; }
.kpi-icon { font-size: 1.5rem; margin-bottom: 8px; }
.kpi-value { font-size: 2.2rem; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-label { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* Estilos para o Módulo Financeiro */
.sub-nav { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.sub-nav-btn { background: none; border: none; padding: 10px 20px; cursor: pointer; font-size: 1rem; font-weight: 600; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.sub-nav-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.financial-sub-tab { display: none; }
.financial-sub-tab.active { display: block; }
.filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; margin-bottom: 20px; background: #f8f9fc; padding: 12px; border-radius: 6px; border: 1px solid var(--border); align-items: flex-start; }
.filter-grid label { font-size: 0.8rem; font-weight: 600; display: block; margin-bottom: 4px; }
.filter-grid select, .filter-grid input { width: 100%; padding: 6px; }
.patient-billing-block { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 15px; }
.patient-billing-header { background: #f8f9fc; padding: 10px 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.patient-billing-header h5 { color: var(--primary); }
.patient-billing-footer { background: #f8f9fc; padding: 10px 15px; border-top: 1px solid var(--border); text-align: right; font-weight: bold; }

/* --- ESTILOS PARA A NOVA ABA DE COBRANÇA --- */
.cobranca-filters-container { display: flex; gap: 20px; margin-bottom: 15px; background: #f8f9fc; padding: 15px; border-radius: 8px; border: 1px solid var(--border); }
.cobranca-filter-group { flex: 1; }
.cobranca-filter-group label { font-size: 0.85rem; font-weight: 600; display: block; margin-bottom: 5px; }
.cobranca-filter-group input, .cobranca-filter-group select { width: 100%; padding: 8px; }

.patient-search-container-cobranca { position: relative; }
.search-results-dropdown { position: absolute; background: var(--panel); border: 1px solid var(--border); border-top: none; width: 100%; max-height: 200px; overflow-y: auto; z-index: 100; display: none; }
.search-results-dropdown .search-result-item { padding: 10px; cursor: pointer; }
.search-results-dropdown .search-result-item:hover { background: var(--primary-bg); }

.selected-tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.patient-tag-cobranca { background: var(--primary-bg); color: var(--primary); padding: 5px 10px; border-radius: 15px; font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 8px; border: 1px solid #e1d2f2; }
.remove-tag-cobranca { cursor: pointer; font-weight: bold; }

.cobranca-view-options { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; margin-top: 10px; }
.cobranca-view-options > label { font-weight: 600; }
.checkbox-group { display: flex; align-items: center; gap: 5px; }
.checkbox-group input[type="checkbox"] { width: auto; }
.checkbox-group label { font-weight: normal; font-size: 0.9rem; }

#cobrancaResultArea .report-table th, #cobrancaResultArea .report-table td {
  transition: all 0.3s ease;
}
.col-hidden {
  visibility: collapse;
  width: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0;
}
.cobranca-subtotals { margin-top: 15px; font-size: 1rem; }
.cobranca-subtotals span { margin-right: 15px; }
.cobranca-total { margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--primary); font-size: 1.3rem; font-weight: bold; color: var(--primary); }




.dashboard-block { margin-top: 25px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.dashboard-block h4 { color: var(--primary); margin-bottom: 15px; }
.dashboard-agenda-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.dashboard-agenda-item:last-child { border-bottom: none; }
.dashboard-agenda-item .time { font-weight: 600; }
.dashboard-agenda-item .patient { color: var(--text-muted); }
.dashboard-agenda-item .actions { display: flex; gap: 6px; }

/* --- MEDIA QUERIES PARA RESPONSIVIDADE (MOBILE) --- */
@media (max-width: 768px) {
  body { flex-direction: row; } /* Mantém a direção para a sidebar funcionar */
  .sidebar {
    position: fixed;
    left: -280px; /* Começa escondida fora da tela */
    height: 100%;
    z-index: 1100;
    transition: left 0.3s ease;
  }
  .sidebar.show-mobile {
    left: 0; /* Mostra a sidebar ao adicionar a classe */
    box-shadow: 5px 0 15px rgba(0,0,0,0.2);
  }

  .main-wrapper {
    height: 100%;
    width: 100%; /* Ocupa toda a largura */
    margin-left: 0 !important; /* Remove a margem da sidebar desktop */
  }
  .content { padding: 12px; }
  .login-card { margin: 15px; padding: 24px; }

  /* Ajustes no Topbar */
  .topbar { padding: 0 12px; flex-wrap: wrap; height: auto; min-height: 64px; gap: 10px; }
  .topbar > div:first-child { display: none !important; } /* Esconde filtros da agenda */
  .profile-box {
    flex-grow: 1;
    justify-content: flex-end;
    background: none;
    border: none;
    padding: 0;
  }

  /* Ajustes gerais de espaçamento e botões */
  .tab-content { padding: 16px; }
  .btn-submit, .btn-secondary, .btn-danger, .btn-warning, .btn-excel {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
  }
  .modal-card { max-width: 95%; margin: auto; }

  /* Empilhamento de formulários e filtros (Protegendo a Agenda e o Planejamento) */
  div[style*="grid-template-columns"]:not(.calendar-grid):not(.planejamento-item),
  #fichaCompletaCampos > div,
  #formTerapeuta > div[style*="grid"] {
    grid-template-columns: 1fr !important; /* Força uma única coluna */
    gap: 0 !important;
  }
  #formTerapeuta > div[style*="grid"] .form-group {
    margin-bottom: 16px;
  }
  #levCustomDateGroup {
    grid-column: span 1 !important;
    flex-direction: column;
    gap: 16px !important;
  }
  #levCustomDateGroup > div { width: 100%; }

  /* Transformar Tabelas em Cards */
  .report-table {
    border: none;
    box-shadow: none;
  }
  .report-table thead {
    display: none; /* Oculta o cabeçalho da tabela */
  }
  .report-table tr {
    display: block;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  }
  .report-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
    text-align: right; /* Alinha o valor à direita */
    font-size: 0.9rem;
  }
  .report-table td:last-child {
    border-bottom: none;
    padding-top: 15px;
    justify-content: center; /* Centraliza o botão de ação */
  }
  .report-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left; /* Alinha o label à esquerda */
    margin-right: 10px;
    flex-shrink: 0;
  }
  /* Esconde o label para o botão de ação */
  .report-table td[data-label="Ações"]::before,
  .report-table td[data-label="Ação"]::before {
    display: none;
  }
  .report-table td[data-label="Ações"] button,
  .report-table td[data-label="Ação"] button {
    width: 100%;
    padding: 10px;
  }
  .report-table input[type="checkbox"] { display: none; } /* Esconde checkboxes em lote */
  .batch-actions-container { display: none !important; } /* Esconde menu de ações em lote */

    /* --- AGENDA MOBILE: ROLAGEM VERTICAL DA PÁGINA + HORIZONTAL DA GRADE --- */
  #agendaTab {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  #agendaTab .agenda-scroll-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    overflow-x: auto !important;
    overflow-y: visible !important;

    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y;

    padding-right: 0 !important;
    padding-bottom: 15px;
  }

    /* Controles compactos somente da Agenda no celular */
    #agendaTab .btn-primary,
    #agendaTab .btn-secondary,
    #agendaTab .btn-submit {
      width: auto !important;
      min-height: 36px !important;
      padding: 7px 10px !important;
      font-size: 0.78rem !important;
      line-height: 1.15 !important;
    }
  
    #agendaTab .week-navigation {
      gap: 6px;
    }
  
    #agendaTab .week-navigation .btn-secondary {
      flex-shrink: 0;
    }
  
    #agendaTab #weekRangeTitle {
      flex: 1;
      min-width: 0;
      font-size: 0.82rem !important;
      line-height: 1.2;
    }

  #toggleSidebarBtn { display: block; } /* Garante que o botão de toggle esteja visível */
}

/* Estilos para a Sidebar Recolhida */
.sidebar-collapsed .sidebar {
  width: 80px;
}
.sidebar-collapsed .sidebar-header,
.sidebar-collapsed .footer-brand {
  display: none; /* Esconde o cabeçalho e o rodapé da sidebar */
}
.sidebar-collapsed .nav-btn {
  justify-content: center; /* Centraliza o ícone */
}
.sidebar-collapsed .nav-text {
  display: none; /* Esconde o texto do botão */
}
/* ========================================================================= */
/* MOTOR DE ROLAGEM E RESPONSIVIDADE DA AGENDA (PC E CELULAR) */
/* ========================================================================= */

/* 1. O Container que abraça a agenda (Cria a barra de rolagem horizontal) */
.agenda-scroll-container {
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important; /* Rolagem suave no celular com o dedo */
  padding-bottom: 15px; /* Espaço para a barra não engolir os cartões */
}

/* 2. Estilização da barra de rolagem para ficar visível e elegante no Computador */
.agenda-scroll-container::-webkit-scrollbar {
  height: 12px;
}
.agenda-scroll-container::-webkit-scrollbar-track {
  background: #f0f2f7;
  border-radius: 8px;
}
.agenda-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--primary);
  border-radius: 8px;
  border: 3px solid #f0f2f7;
}
.agenda-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary-hover);
}

/* 3. Força a grade a ter um tamanho mínimo para NUNCA amontoar os dias */
.calendar-grid {
  min-width: 1050px !important; /* Aumentado para caber o Sábado confortavelmente */
  display: grid !important;
}

/* 4. No modo "Dia", volta a ocupar a tela normal (sem precisar de barra de rolagem) */
.agenda-modo-dia .calendar-grid {
  min-width: 100% !important;
  grid-template-columns: 80px 1fr !important;
}

/* Ajustes Finos para a tela do Celular */
@media (max-width: 768px) {
  .calendar-header {
    font-size: 0.75rem;
    padding: 6px 2px;
  }

  .time-slot {
    font-size: 0.75rem;
    padding: 4px 2px;
  }

  .cell-slot {
    min-height: 50px;
    padding: 2px;
  }

  .event-card {
    font-size: 0.7rem;
    padding: 4px;
    line-height: 1.15;
  }

  .event-card small {
    font-size: 0.65rem;
  }

  /* Semana: hora + domingo até sábado */
  .calendar-grid {
    grid-template-columns: 60px repeat(7, minmax(150px, 1fr)) !important;
    min-width: 1110px !important;
    padding-right: 0 !important;
  }

  /* Dia: somente hora + um dia */
  .agenda-modo-dia .calendar-grid {
    grid-template-columns: 60px minmax(220px, 1fr) !important;
    min-width: 100% !important;
  }
}

/* GARANTIA DE SEGURANÇA: Oculta blocos restritos (como valores financeiros) por padrão para terapeutas */
.admin-only-option { display: none; }
/* --- ESTILO DA SESSÃO CANCELADA / CRÉDITO (FANTASMA) --- */
.status-canceled { background: #fff3cd !important; color: #856404 !important; }
.event-canceled, .event-credited { opacity: 0.85; border: 2px dashed #ffc107 !important; }
/* --- ANIMAÇÕES DO SISTEMA DE AVISOS DE CONTAS --- */
@keyframes blink-aviso-yellow {
  0%, 100% { background-color: #fef7e0; border-color: #f9ab00; color: #b06000; box-shadow: 0 0 4px rgba(249, 171, 0, 0.4); }
  50% { background-color: #f9ab00; border-color: #d48806; color: #ffffff; box-shadow: 0 0 14px rgba(249, 171, 0, 0.9); }
}
@keyframes blink-aviso-red {
  0%, 100% { background-color: #fce8e6; border-color: #d93025; color: #c5221f; box-shadow: 0 0 4px rgba(217, 48, 37, 0.4); }
  50% { background-color: #d93025; border-color: #a51d24; color: #ffffff; box-shadow: 0 0 16px rgba(217, 48, 37, 0.95); }
}
@keyframes blink-aviso-black {
  0%, 100% { background-color: #e2e5ec; border-color: #2b2d30; color: #2b2d30; box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); }
  50% { background-color: #111111; border-color: #000000; color: #ffffff; box-shadow: 0 0 16px rgba(0, 0, 0, 0.95); }
}

.aviso-blink-yellow { animation: blink-aviso-yellow 1.6s infinite ease-in-out !important; font-weight: bold !important; }
.aviso-blink-red { animation: blink-aviso-red 1.1s infinite ease-in-out !important; font-weight: bold !important; }
.aviso-blink-black { animation: blink-aviso-black 0.9s infinite ease-in-out !important; font-weight: bold !important; }
/* ========================================================================= */
/* MÓDULO DE DOCUMENTOS E MOTOR DE IMPRESSÃO A4 */
/* ========================================================================= */
.doc-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 25px 15px; text-align: center; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.doc-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); border-color: var(--primary); }
.doc-card-icon { font-size: 2.5rem; display: block; }
.doc-card-title { font-weight: 700; font-size: 0.95rem; color: var(--primary); line-height: 1.2; }

#printDocumentArea { display: none; }

@media print {

  /*
    O layout físico da folha, margens do conteúdo
    e papel timbrado são controlados pelo
    motor novo definido no index.html.
    Aqui cuidamos somente de preparar
    a aplicação para impressão.
  */

  html {
    width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body {
    display: block !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* Esconde a interface normal do sistema */
  body * {
    visibility: hidden !important;
  }

  /* Mostra somente o documento e tudo que existe dentro dele */
  #printDocumentArea,
  #printDocumentArea * {
    visibility: visible !important;
  }

  #printDocumentArea {
    display: block !important;
  }

  #printContent {
    display: block !important;
    visibility: visible !important;
    color: #000 !important;
    opacity: 1 !important;
  }

  #printContent * {
    visibility: visible !important;
    opacity: 1 !important;
  }

  @page {
    size: A4;
    margin: 0;
  }
}