/* ===================================================================
   CSS PARA PÁGINA DE GERENCIAMENTO DE AGENDA (agenda.html)
   ================================================================= */

/* ===========================================
   🔷 VARIÁVEIS GLOBAIS (Reutilizadas de style.css)
=========================================== */
:root {
  --azul: #0d6efd;
  --ciano: #00bcd4;
  --gradiente-azul: linear-gradient(90deg, var(--azul), var(--ciano));
  --texto-claro: #ffffff;
  --texto-escuro: #212529;
  --fundo-claro: #f8f9fa;
  --fundo-card-claro: #ffffff;
  --fundo-escuro: #1e1e2e;
  --fundo-card-escuro: #2a2a3b;
  --borda-suave: rgba(0, 0, 0, 0.08);
  --transicao: all 0.3s ease;
  
  /* Cores Específicas da Agenda */
  --cor-agendado: #28a745; /* Verde para agendamentos */
  --cor-bloqueado: #dc3545; /* Vermelho para bloqueios */
  --cor-disponivel: #0d6efd; /* Azul para disponível */
  --cor-passado: #6c757d; /* Cinza para horários passados */
}

/* ===========================================
   📅 AGENDA GRID (Visualização de Horários)
=========================================== */
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* 150px mínimo por coluna */
  gap: 10px;
  padding: 15px;
  max-height: 70vh; /* Limita a altura para ter scroll */
  overflow-y: auto;
}

/* Estilo para cada slot de horário */
.horario-slot {
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
}

.horario-slot:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.horario-slot strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.horario-slot small {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
}

/* --- ESTADOS DO SLOT --- */

/* 1. DISPONÍVEL (Clicável para Bloquear) */
.slot-disponivel {
  background-color: #e9f5ff; /* Azul claro */
  color: var(--cor-disponivel);
  border-color: var(--cor-disponivel);
}

.slot-disponivel:hover {
  background-color: var(--cor-disponivel);
  color: var(--texto-claro);
}

/* 2. AGENDADO (Clicável para Ver Detalhes/Editar) */
.slot-agendado {
  background-color: #e6ffed; /* Verde claro */
  color: var(--cor-agendado);
  border-color: var(--cor-agendado);
  cursor: default; /* Pode ser alterado se for para abrir modal de detalhes */
}

.slot-agendado:hover {
  background-color: #d4f8db;
}

/* 3. BLOQUEADO (Clicável para Desbloquear) */
.slot-bloqueado {
  background-color: #fde9e9; /* Vermelho claro */
  color: var(--cor-bloqueado);
  border-color: var(--cor-bloqueado);
}

.slot-bloqueado:hover {
  background-color: var(--cor-bloqueado);
  color: var(--texto-claro);
}

/* 4. PASSADO (Não Clicável) */
.slot-passado {
  background-color: #f8f9fa; /* Cinza muito claro */
  color: var(--cor-passado);
  border-color: #e9ecef;
  cursor: not-allowed;
  opacity: 0.7;
}

.slot-passado:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- TEMA ESCURO --- */
[data-tema="dark"] .agenda-grid {
  background-color: var(--fundo-card-escuro);
}

[data-tema="dark"] .slot-disponivel {
  background-color: rgba(13, 110, 253, 0.1);
  color: var(--cor-disponivel);
}

[data-tema="dark"] .slot-disponivel:hover {
  background-color: var(--cor-disponivel);
  color: var(--texto-claro);
}

[data-tema="dark"] .slot-agendado {
  background-color: rgba(40, 167, 69, 0.1);
  color: var(--cor-agendado);
}

[data-tema="dark"] .slot-bloqueado {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--cor-bloqueado);
}

[data-tema="dark"] .slot-bloqueado:hover {
  background-color: var(--cor-bloqueado);
  color: var(--texto-claro);
}

[data-tema="dark"] .slot-passado {
  background-color: rgba(108, 117, 125, 0.1);
  color: var(--cor-passado);
  border-color: rgba(108, 117, 125, 0.2);
}

/* ===========================================
   ⚙️ CALENDÁRIO (Reutilizado de agendamentos.js)
=========================================== */
.calendar-container {
  padding: 10px;
  max-width: 100%;
  width: 100%;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
}

.calendar-header button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--azul);
  padding: 5px 10px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.calendar-header button:hover {
  background-color: rgba(13, 110, 253, 0.1);
}

.calendar-header h5 {
  margin: 0;
  text-align: center;
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.calendar-weekday {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--azul);
  padding: 8px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  width: 100%;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--borda-suave);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  background-color: var(--fundo-card-claro);
  color: var(--texto-escuro);
  padding: 8px 4px;
  min-height: 40px;
}

[data-tema="dark"] .calendar-day {
  background-color: var(--fundo-card-escuro);
  color: var(--texto-claro);
}

.calendar-day:hover:not(.disabled):not(.other-month) {
  background: linear-gradient(90deg, var(--azul), var(--ciano));
  color: white;
  transform: scale(1.05);
}

.calendar-day.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.05);
}

[data-tema="dark"] .calendar-day.disabled {
  background-color: rgba(255, 255, 255, 0.05);
}

.calendar-day.other-month {
  color: var(--borda-suave);
  cursor: default;
}

.calendar-day.selected {
  background: linear-gradient(90deg, var(--azul), var(--ciano));
  color: white;
  font-weight: 600;
}

.calendar-day.today {
  border: 2px solid var(--azul);
  font-weight: 600;
}


/* Ajustes para o cabeçalho do modal em telas pequenas */
@media (max-width: 576px) {
  .modal-header {
    padding: 0.8rem 1rem;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-header .btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    opacity: 1;
  }
}


/* ===========================================
   MENSAGEM DE AGENDA FECHADA (Substitui o alerta amarelo)
=========================================== */
.mensagem-agenda-fechada {
  padding: 20px;
  border-radius: 8px;
  font-weight: 500;
  /* Removido margin: 20px; para ocupar a largura total do container */
  /* Estilo para tema claro */
  background-color: #f8f9fa; /* Fundo muito claro */
  color: #6c757d; /* Texto cinza suave */
  border: 1px solid #e9ecef;
}

/* Estilo para tema escuro */
[data-tema="dark"] .mensagem-agenda-fechada {
  background-color: var(--fundo-card-escuro); /* Fundo do card escuro */
  color: #adb5bd; /* Texto cinza claro */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===========================================
   📊 TABELA DE AGENDAMENTOS
=========================================== */

/* Adiciona bordas visíveis em todas as células */
#tabelaAgendamentos {
  border-collapse: separate;
  border-spacing: 0;
}

#tabelaAgendamentos thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Bordas nas células do corpo da tabela */
#tabelaAgendamentos tbody td {
  border: 1px solid #dee2e6;
  vertical-align: middle;
}

[data-tema="dark"] #tabelaAgendamentos tbody td {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Linha do título com gradiente */
#tabelaAgendamentos thead tr.gradiente-azul th {
  background: linear-gradient(90deg, #0d6efd, #00bcd4) !important;
  color: white !important;
  border: none !important;
  padding: 1rem !important;
}

/* Linha das colunas */
#tabelaAgendamentos thead tr.table-light th {
  background-color: #f8f9fa !important;
  color: #212529 !important;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  border-top: none;
  vertical-align: middle;
}

[data-tema="dark"] #tabelaAgendamentos thead tr.table-light th {
  background-color: #2a2a3b !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-tema="dark"] #tabelaAgendamentos thead tr.gradiente-azul th {
  background: linear-gradient(90deg, #0d6efd, #00bcd4) !important;
}

/* Badge de contagem */
#tabelaAgendamentos thead #totalAgendamentos {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0;
  background: rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  min-width: 26px;
  max-width: 26px;
  min-height: 26px;
  max-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

/* ===========================================
   📱 OTIMIZAÇÕES PARA MOBILE
=========================================== */

/* Tablets e dispositivos menores */
@media (max-width: 768px) {
  /* Reduz o padding do cabeçalho da tabela */
  #tabelaAgendamentos thead tr.gradiente-azul th {
    padding: 0.75rem 0.5rem !important;
  }
  
  /* Reduz o tamanho do título */
  #tabelaAgendamentos thead tr.gradiente-azul h5 {
    font-size: 1rem;
    margin-bottom: 0;
  }
  
  /* Reduz o tamanho do ícone */
  #tabelaAgendamentos thead tr.gradiente-azul h5 i {
    font-size: 0.9rem;
    margin-right: 0.4rem !important;
  }
  
  /* Ajusta colunas da tabela */
  #tabelaAgendamentos thead tr.table-light th {
    font-size: 0.8rem;
    padding: 0.6rem 0.4rem;
  }
  
  #tabelaAgendamentos tbody td {
    font-size: 0.85rem;
    padding: 0.6rem 0.4rem;
  }
}

/* Smartphones */
@media (max-width: 576px) {
  /* Cabeçalho ainda mais compacto */
  #tabelaAgendamentos thead tr.gradiente-azul th {
    padding: 0.6rem 0.5rem !important;
  }
  
  /* Título menor */
  #tabelaAgendamentos thead tr.gradiente-azul h5 {
    font-size: 0.9rem;
  }
  
  /* Ícone menor */
  #tabelaAgendamentos thead tr.gradiente-azul h5 i {
    font-size: 0.85rem;
    margin-right: 0.3rem !important;
  }
  
  /* Badge de contagem um pouco menor */
  #tabelaAgendamentos thead #totalAgendamentos {
    width: 24px;
    height: 24px;
    min-width: 24px;
    max-width: 24px;
    min-height: 24px;
    max-height: 24px;
    font-size: 0.75rem;
  }
  
  /* Colunas da tabela ainda mais compactas */
  #tabelaAgendamentos thead tr.table-light th {
    font-size: 0.75rem;
    padding: 0.5rem 0.3rem;
  }
  
  #tabelaAgendamentos tbody td {
    font-size: 0.8rem;
    padding: 0.5rem 0.3rem;
  }
  
  /* Reduz espaçamento da agenda grid */
  .agenda-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px;
  }
  
  /* Slots de horário mais compactos */
  .horario-slot {
    padding: 8px;
  }
  
  .horario-slot strong {
    font-size: 1rem;
  }
  
  .horario-slot small {
    font-size: 0.75rem;
  }
}

/* Smartphones muito pequenos */
@media (max-width: 375px) {
  /* Cabeçalho ultra compacto */
  #tabelaAgendamentos thead tr.gradiente-azul th {
    padding: 0.5rem 0.4rem !important;
  }
  
  /* Título ainda menor */
  #tabelaAgendamentos thead tr.gradiente-azul h5 {
    font-size: 0.85rem;
  }
  
  /* Oculta o ícone em telas muito pequenas para economizar espaço */
  #tabelaAgendamentos thead tr.gradiente-azul h5 i {
    display: none;
  }
  
  /* Badge ainda menor */
  #tabelaAgendamentos thead #totalAgendamentos {
    width: 22px;
    height: 22px;
    min-width: 22px;
    max-width: 22px;
    min-height: 22px;
    max-height: 22px;
    font-size: 0.7rem;
  }
  
  /* Tabela ultra compacta */
  #tabelaAgendamentos thead tr.table-light th {
    font-size: 0.7rem;
    padding: 0.4rem 0.2rem;
  }
  
  #tabelaAgendamentos tbody td {
    font-size: 0.75rem;
    padding: 0.4rem 0.2rem;
  }
}

/* ===========================================
   🔘 BOTÕES DE AÇÃO NA TABELA
=========================================== */

/* Botão de editar - azul */
.btn-editar-agendamento {
  background-color: #0d6efd !important;
  color: white !important;
  border: 1px solid #0d6efd !important;
  transition: all 0.3s ease;
}

.btn-editar-agendamento:hover {
  background-color: #0b5ed7 !important;
  border-color: #0b5ed7 !important;
  transform: scale(1.05);
}

/* Botão de cancelar - vermelho */
.btn-cancelar-agendamento {
  background-color: #dc3545 !important;
  color: white !important;
  border: 1px solid #dc3545 !important;
  transition: all 0.3s ease;
}

.btn-cancelar-agendamento:hover {
  background-color: #bb2d3b !important;
  border-color: #bb2d3b !important;
  transform: scale(1.05);
}

/* Container dos botões */
.acoes-agendamento {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

/* Ajuste para mobile */
@media (max-width: 576px) {
  .acoes-agendamento {
    gap: 0.3rem;
  }
  
  .btn-editar-agendamento,
  .btn-cancelar-agendamento {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Estilos para o componente de seleção de hora (Cards de Horário) no Modal
   ========================================================================== */

.horarios-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background-color: transparent;
}

[data-tema="dark"] .horarios-container {
    background-color: transparent;
    border-color: transparent;
}

.horario-card {
    padding: 12px 8px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: none;
    font-weight: 500;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-tema="dark"] .horario-card {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Estado Livre */
.horario-card.livre {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

.horario-card.livre:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Estado Ocupado/Bloqueado */
.horario-card.ocupado,
.horario-card.bloqueado {
    background-color: rgba(220, 53, 69, 0.15);
    color: rgba(220, 53, 69, 0.7);
    cursor: not-allowed;
    opacity: 0.5;
    border-color: rgba(220, 53, 69, 0.3);
}

/* Estado Selecionado */
.horario-card.selecionado {
    background: rgba(13, 110, 253, 0.8);
    color: white;
    border-color: rgba(13, 110, 253, 1);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.3);
    transform: scale(1.02);
}

/* Estilos para o conteúdo do card */
.horario-card .hora-texto {
    font-size: 1em;
    margin-bottom: 0;
    font-weight: 500;
}

.horario-card .status-texto {
    font-size: 0.75em;
    font-weight: 400;
    line-height: 1.2;
    opacity: 0.8;
}

/* Ajuste para o tema escuro */
[data-tema="dark"] .horario-card.ocupado,
[data-tema="dark"] .horario-card.bloqueado {
    color: rgba(220, 53, 69, 0.6);
    background-color: rgba(220, 53, 69, 0.1);
}

[data-tema="dark"] .horario-card.livre {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-tema="dark"] .horario-card.livre:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

.horarios-container .alert {
    grid-column: 1 / -1;
    margin: 0;
}

/* Estilos do calendário no modal */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--azul);
    padding: 8px 0;
}

.calendar-day.empty {
    border: none;
    background: transparent;
    cursor: default;
}

/* Responsividade para cards de horário */
@media (max-width: 576px) {
    .horarios-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    /* Ajusta o tamanho da fonte nos cards */
    .horario-card {
        padding: 10px 6px;
        font-size: 0.9rem;
    }
    
    .horario-card .hora-texto {
        font-size: 0.95em;
    }

    .horario-card .status-texto {
        font-size: 0.7em;
    }
}

@media (max-width: 400px) {
    .horarios-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .horario-card {
        padding: 8px 4px;
        font-size: 0.85rem;
    }
}

/* ===========================================
   📱 RESPONSIVIDADE - BOTÕES DOS MODAIS
=========================================== */
@media (max-width: 576px) {
    /* Reduz o tamanho dos botões do modal-footer em mobile */
    .modal-footer .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .modal-footer .btn i {
        font-size: 0.85rem;
    }
    
    /* Ajusta o espaçamento do modal-footer */
    .modal-footer {
        padding: 0.75rem;
        gap: 0.5rem;
    }
}

@media (max-width: 400px) {
    /* Botões ainda menores para telas muito pequenas */
    .modal-footer .btn {
        padding: 0.45rem 0.65rem;
        font-size: 0.8rem;
    }
    
    .modal-footer .btn i {
        font-size: 0.8rem;
        margin-right: 0.25rem !important;
    }
}

/* ===========================================
   🎨 AJUSTES RESPONSIVOS PARA O BOTÃO DO CALENDÁRIO
=========================================== */

/* Estilos base do botão do calendário - alinhado com o input */
#btnDataPicker {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 50px;
  padding: 0.805rem 0.75rem;
}

#btnDataPicker i.fas.fa-calendar-day {
  font-size: 1rem;
}

/* Ajustes para tablets */
@media (min-width: 768px) {
  #btnDataPicker {
    min-width: 55px;
  }
  
  #btnDataPicker i.fas.fa-calendar-day {
    font-size: 1.1rem;
  }
}

/* Ajustes para desktops - ícone maior, botão alinhado com input */
@media (min-width: 992px) {
  #btnDataPicker {
    min-width: 60px;
  }
  
  #btnDataPicker i.fas.fa-calendar-day {
    font-size: 1.25rem;
  }
}

/* Ajustes para telas grandes */
@media (min-width: 1200px) {
  #btnDataPicker {
    min-width: 55px;
  }
  
  #btnDataPicker i.fas.fa-calendar-day {
    font-size: 1.3rem;
  }
}

/* Aumenta a altura do input de data no mobile para melhor usabilidade */
@media (max-width: 767px) {
  #inputData {
    height: 48px;
    font-size: 1rem;
  }
  
  #btnDataPicker {
    min-height: 48px;
  }
}
