/* ==========================================
   CALENDÁRIO DE EVENTOS - Estilos
   ========================================== */

/* Controles de Navegação do Calendário */
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #061c80 0%, #02718d 100%);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.calendar-controls h4 {
  color: white;
  margin: 0;
  font-size: 1.3em;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.calendar-controls button {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.calendar-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Grade do Calendário */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: #e0e0e0;
  border: 2px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Cabeçalho dos Dias da Semana */
.calendar-header {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Células de Dia */
.calendar-day {
  background: white;
  min-height: 110px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  position: relative;
  display: flex;
  flex-direction: column;
}

.calendar-day:hover {
  background: #f0f8ff;
  border-color: #2196F3;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
  z-index: 10;
}

.calendar-day.other-month {
  background: #fafafa;
  color: #999;
}

.calendar-day.other-month:hover {
  background: #f5f5f5;
}

.calendar-day.today {
  background: #fff3cd;
  border: 2px solid #ffc107;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.calendar-day.today:hover {
  background: #fff9e6;
}

/* Número do Dia */
.day-number {
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 1.1em;
  color: #333;
  flex-shrink: 0;
}

.calendar-day.other-month .day-number {
  color: #bbb;
}

.calendar-day.today .day-number {
  color: #f57c00;
  font-size: 1.2em;
}

/* Container de Eventos no Dia */
.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 75px;
  overflow-y: auto;
  flex: 1;
}

.day-events::-webkit-scrollbar {
  width: 4px;
}

.day-events::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.day-events::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 2px;
}

.day-events::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Badge de Evento */
.event-badge {
  background: #4CAF50;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  font-weight: 500;
}

.event-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

/* Cores por Contexto */
.event-badge.context-acampamento {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
}

.event-badge.context-reuniao {
  background: linear-gradient(135deg, #2196F3, #1976D2);
}

.event-badge.context-inscricao {
  background: linear-gradient(135deg, #FF9800, #F57C00);
}

.event-badge.context-vivencia {
  background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.event-badge.context-coordenadores {
  background: linear-gradient(135deg, #F44336, #D32F2F);
}

/* Formações - 1º, 2º e 3º Formação */
.event-badge.context-1-formacao,
.event-badge.context-2-formacao,
.event-badge.context-3-formacao {
  background: linear-gradient(135deg, #673AB7, #512DA8);
  font-weight: 600;
}

/* Legenda do Calendário */
.calendar-legend {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #555;
  padding: 5px 10px;
  background: white;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Modal de Evento - Ajustes Específicos */
#event-modal .modal-content {
  animation: slideInFromTop 0.3s ease-out;
  margin-top: 20px; /* Aproximar do topo */
  margin-bottom: 20px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

/* Formulário do Modal */
#calendar-event-form .form-group {
  margin-bottom: 6px !important; /* Reduzido de 8px */
}

#calendar-event-form .form-group label {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
  font-size: 0.82em; /* Reduzido de 0.88em */
}

#calendar-event-form .form-group label i {
  margin-right: 5px;
  color: #2196F3;
}

#calendar-event-form input[type="time"],
#calendar-event-form input[type="date"],
#calendar-event-form select,
#calendar-event-form input[type="text"],
#calendar-event-form input[type="number"] {
  width: 100%;
  padding: 5px 8px; /* Reduzido de 6px 10px */
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85em; /* Reduzido de 0.9em */
}

#event-date-display {
  font-size: 1.1em;
  font-weight: 600;
  color: #2196F3;
  padding: 8px 12px;
  background: #e3f2fd;
  border-radius: 6px;
  margin-bottom: 15px;
}

/* Linha com dois campos lado a lado */
#calendar-event-form .form-row {
  display: flex;
  gap: 10px; /* Reduzido de 12px */
  margin-bottom: 8px; /* Reduzido de 10px */
}

#calendar-event-form .form-row .form-group {
  flex: 1;
}

/* Botões do Modal - Alinhados e com espaçamento */
#calendar-event-form .modal-footer,
#calendar-event-form .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

#calendar-event-form button {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-success {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  color: white;
  border: none;
}

.btn-success:hover {
  background: linear-gradient(135deg, #388E3C, #2E7D32);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

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

.btn-secondary:hover {
  background: #5a6268;
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #F44336, #D32F2F);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #D32F2F, #C62828);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

/* Info box para contexto */
#calendar-event-form .info-box {
  background: #e3f2fd;
  border-left: 4px solid #2196F3;
  padding: 10px 12px;
  margin: 12px 0;
  border-radius: 4px;
  font-size: 0.9em;
  color: #1565C0;
}

#calendar-event-form .info-box i {
  margin-right: 8px;
}


/* Lista de Eventos do Dia no Modal - MELHORADO */
#day-events-list {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid #eee;
}

#day-events-list h4 {
  font-size: 1em;
  margin-bottom: 12px;
  color: #333;
}

#day-events-container {
  max-height: 200px; /* Reduzida para caber melhor no modal */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

#day-events-container::-webkit-scrollbar {
  width: 6px;
}

#day-events-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#day-events-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

#day-events-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}


.day-event-item {
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-left: 4px solid #4CAF50;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.day-event-item:hover {
  background: #e9ecef;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.day-event-item.context-acampamento {
  border-left-color: #4CAF50;
}

.day-event-item.context-reuniao {
  border-left-color: #2196F3;
}

.day-event-item.context-inscricao {
  border-left-color: #FF9800;
}

.day-event-item.context-vivencia {
  border-left-color: #9C27B0;
}

.day-event-item.context-coordenadores {
  border-left-color: #F44336;
}

/* Formações */
.day-event-item.context-1-formacao,
.day-event-item.context-2-formacao,
.day-event-item.context-3-formacao {
  border-left-color: #673AB7;
}

.day-event-info {
  flex: 1;
}

.day-event-time {
  font-weight: bold;
  color: #2196F3;
  margin-bottom: 5px;
  font-size: 1.05em;
}

.day-event-details {
  font-size: 0.9em;
  color: #666;
  margin-top: 3px;
}

.day-event-type {
  font-weight: 600;
  color: #333;
}

.day-event-context {
  color: #999;
  font-size: 0.85em;
  margin-left: 8px;
}

.day-event-actions {
  display: flex;
  gap: 6px;
}

.day-event-actions button {
  padding: 6px 12px;
  font-size: 0.85em;
}

/* Responsividade */
@media (max-width: 1024px) {
  .calendar-grid {
    gap: 1px;
  }
  
  .calendar-day {
    min-height: 90px;
    padding: 8px;
  }
  
  .day-number {
    font-size: 1em;
  }
  
  .event-badge {
    font-size: 0.7em;
    padding: 3px 6px;
  }
  
  .calendar-legend {
    gap: 10px;
  }
  
  .legend-item {
    font-size: 0.85em;
  }
  
  #event-modal .modal-content {
    max-width: 90%;
    margin: 20px auto;
  }
  
  .calendar-controls h4 {
    font-size: 1.1em;
  }
}

/* Smartphones e telas pequenas */
@media (max-width: 768px) {
  /* Calendário */
  .calendar-grid {
    gap: 1px;
    font-size: 0.85em;
  }
  
  .calendar-day {
    min-height: 70px;
    padding: 4px;
  }
  
  .day-number {
    font-size: 0.95em;
  }
  
  .event-badge {
    font-size: 0.65em;
    padding: 2px 5px;
  }
  
  /* Controles */
  .calendar-controls {
    flex-direction: column;
    gap: 10px;
    padding: 12px 15px;
  }
  
  .calendar-controls h4 {
    font-size: 1em;
  }
  
  .calendar-controls button {
    padding: 8px 16px;
    font-size: 0.9em;
  }
  
  /* Legenda */
  .calendar-legend {
    flex-direction: column;
    gap: 8px;
  }
  
  /* Modal */
  #event-modal .modal-content {
    max-width: 95%;
    margin: 10px auto;
    padding: 20px 15px;
  }
  
  #event-modal h3 {
    font-size: 1.2em;
  }
  
  /* Formulário em coluna no mobile */
  #calendar-event-form .form-row {
    flex-direction: column !important;
  }
  
  #calendar-event-form .form-row .form-group {
    width: 100% !important;
  }
  
  /* Lista de eventos do dia */
  .day-events-list {
    max-height: 250px; /* Aumentar espaço para lista no mobile */
    overflow-y: auto;
  }
  
  .event-item {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  
  .event-item-info {
    width: 100% !important;
  }
  
  .event-item-actions {
    width: 100% !important;
    justify-content: flex-end;
  }
}

/* Smartphones muito pequenos */
@media (max-width: 480px) {
  .calendar-day {
    min-height: 60px;
    padding: 2px;
  }
  
  .day-number {
    font-size: 0.85em;
  }
  
  .day-events {
    gap: 1px;
  }
  
  .event-badge {
    font-size: 0.6em;
    padding: 1px 3px;
    /* Mostrar apenas tipo do evento em telas muito pequenas */
  }
  
  #event-modal .modal-content {
    max-width: 98%;
    margin: 5px auto;
    padding: 15px 10px;
  }
  
  /* Botões do formulário em coluna também */
  #calendar-event-form .form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  #calendar-event-form button {
    width: 100%;
  }
}

/* ==========================================
   CORREÇÕES PARA NOVOS CONTEXTOS
   ========================================== */

/* Acampamento/Retiro - mantém a mesma cor */
.event-badge.context-acampamentoretiro {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
}

.day-event-item.context-acampamentoretiro {
  border-left-color: #4CAF50;
}

/* Reunião de Equipe - azul */
.event-badge.context-reuniao-de-equipe {
  background: linear-gradient(135deg, #2196F3, #1976D2);
}

.day-event-item.context-reuniao-de-equipe {
  border-left-color: #2196F3;
}

/* Reunião de Coordenação - vermelho */
.event-badge.context-reuniao-de-coordenacao {
  background: linear-gradient(135deg, #F44336, #D32F2F);
}

.day-event-item.context-reuniao-de-coordenacao {
  border-left-color: #F44336;
}

/* Inscrição - laranja */
.event-badge.context-inscricao {
  background: linear-gradient(135deg, #FF9800, #F57C00);
}

.day-event-item.context-inscricao {
  border-left-color: #FF9800;
}

/* Vivência - roxo */
.event-badge.context-vivencia {
  background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

.day-event-item.context-vivencia {
  border-left-color: #9C27B0;
}

/* ==========================================
   TRAVAR ANIMAÇÃO DE ÍCONES DO CALENDÁRIO
   ========================================== */

/* Remove animação de rotação dos ícones do FontAwesome no calendário */
.calendar-controls i,
#event-modal i,
.calendar-legend i,
.event-badge i,
#calendar-event-form i {
  animation: none !important;
  transform: none !important;
}

/* Específico para ícone fa-calendar-alt que pode girar */
.fa-calendar-alt,
.fa-calendar,
.fa-calendar-plus,
.fa-calendar-check {
  animation: none !important;
  transform: rotate(0deg) !important;
}

/* Garantir que ícones em botões e títulos também não girem */
.screen-title i.fa-calendar-alt,
#event-modal-title i.fa-calendar-plus,
#event-modal-title i.fa-edit {
  animation: none !important;
  transform: rotate(0deg) !important;
  transition: none !important;
}

/* Botões da seção de assinatura do calendário */
.calendar-subscribe-section i,
.calendar-subscribe-section button i {
  animation: none !important;
  transform: none !important;
}

/* Específico para ícone fa-ban (revogar) */
.fa-ban,
.fa-key,
.fa-copy,
.fa-sync-alt,
.fa-filter {
  animation: none !important;
  transform: rotate(0deg) !important;
}
