/* Estilos do Modal de Eventos */
.wic-modal {
	display: none; /* Oculto por padrão */
	position: fixed; /* Fica fixo na tela */
	z-index: 1000; /* Fica na frente de outros elementos */
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto; /* Adiciona scroll se necessário */
	background-color: rgba(0, 0, 0, 0.5); /* Fundo preto semi-transparente */
}

.wic-modal-content {
	background-color: #fefefe;
	margin: 15% auto; /* 15% do topo e centralizado horizontalmente */
	padding: 20px;
	border: 1px solid #888;
	width: 80%;
	max-width: 500px; /* Largura máxima */
	position: relative;
	border-radius: 5px;
}

.wic-modal-close {
	color: #aaa;
	float: right;
	font-size: 28px;
	font-weight: bold;
	position: absolute;
	top: 10px;
	right: 15px;
}

.wic-modal-close:hover,
.wic-modal-close:focus {
	color: black;
	text-decoration: none;
	cursor: pointer;
}

#wic-modal-title {
	margin-top: 0;
	margin-bottom: 15px;
	color: #333;
}

.wic-modal-info {
	line-height: 1.6;
}

.wic-modal-info p {
	margin: 8px 0;
	font-size: 14px;
}

.wic-modal-info strong {
	color: #555;
	font-weight: 600;
}

#wic-modal-description-container {
	margin-top: 15px;
}

#wic-modal-description {
	margin-top: 5px;
	padding: 10px;
	background-color: #f9f9f9;
	border-radius: 4px;
	border-left: 3px solid #E01218;
	font-size: 14px;
	line-height: 1.5;
}

/* Brand & Default Theme Variables */
:root {
	/* Brand Colors */
    --brand-red: #E01218;
    --brand-blue: #143CA1;
    --brand-green: #024A2A;
    --brand-gray: #6D6C71;
    --brand-light-gray: #EDEDED;

	/* Theme variables */
	--wic-bg: #ffffff;
	--wic-text-color: #222;
	--wic-accent-color: var(--brand-red);
	--wic-border-color: #e4e4e7;
	--wic-event-bg: var(--brand-blue);
	--wic-event-text: #ffffff;
}

.wic-filters {
	margin-bottom: 1em;
	display: flex;
	gap: 1em;
    padding: 0 1.5rem; /* Add padding to align with calendar content */
}

.wic-calendar-container {
	background-color: var(--wic-bg);
	color: var(--wic-text-color);
	border: 1px solid var(--wic-border-color);
	padding: 0;
	border-radius: 0.5rem;
    overflow: hidden;
}

/* --- Custom Header Styles --- */
.fc .fc-toolbar.fc-header-toolbar {
    background-color: var(--brand-red);
    padding: 1rem 1.5rem;
    color: var(--brand-light-gray);
    margin-bottom: 0 !important;
    display: flex;
    align-items: center; /* Alinha verticalmente todos os chunks */
}

/* Força os 3 chunks da toolbar a terem a mesma largura */
.fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk {
    flex-basis: 33.33%;
}

/* Alinha o título ao centro */
.fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
    text-align: center;
}

/* Alinha os botões de visualização à direita */
.fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk:nth-child(3) {
    text-align: right;
}

.fc .fc-toolbar-title {
  color: var(--brand-light-gray);
  font-family: 'Terminal Dosis', sans-serif;
  font-size: 1.75rem !important;
  text-transform: uppercase;
}

.fc .fc-button {
  color: var(--brand-light-gray) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  text-transform: uppercase;
  transition: background-color 0.2s ease-in-out;
  border-radius: 0.375rem !important;
}

.fc .fc-button .fc-icon {
  color: var(--brand-light-gray) !important;
}

.fc .fc-button:hover {
  background-color: hsl(359 88% 36%) !important; /* Darker red */
}

.fc .fc-button-primary {
	background-color: transparent !important;
	border-color: transparent !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background-color: hsl(359 88% 30%) !important; /* Even darker red */
  border-color: transparent !important;
}

/* --- Calendar Body Styles --- */
.fc .fc-view-harness {
  padding: 1.5rem;
}

.fc .fc-daygrid-event {
	background-color: var(--wic-event-bg);
	color: var(--wic-event-text);
	border: 1px solid var(--wic-event-bg);
    padding: 2px 4px;
    border-radius: 4px;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    height: auto !important;
    min-height: 20px !important;
}

.fc .fc-daygrid-event .fc-event-title {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.2 !important;
    font-size: 12px !important;
}

.fc .fc-daygrid-event .fc-event-main {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Melhora o espaçamento entre múltiplos eventos no mesmo dia */
.fc .fc-daygrid-day-events {
    margin-top: 1px !important;
}

.fc .fc-daygrid-event-harness {
    margin-bottom: 1px !important;
}

/* Ajusta a altura das células do calendário para acomodar mais eventos */
.fc .fc-daygrid-day-frame {
    min-height: 80px !important;
}

/* Melhora a visualização do link "+X more" */
.fc .fc-daygrid-more-link {
    font-size: 11px !important;
    padding: 1px 3px !important;
    background-color: var(--brand-red) !important;
    color: white !important;
    border-radius: 3px !important;
    text-decoration: none !important;
    margin-top: 1px !important;
}

.fc .fc-list-event-dot {
	border-color: var(--wic-accent-color);
}

/* Estilo para feriados - Força a renderização como pílula */
.fc-daygrid-day-events .fc-event-holiday {
    position: relative !important; /* Remove o posicionamento absoluto que o torna um fundo */
    display: block !important; /* Garante que seja um bloco */
    margin: 1px 4px !important; /* Adiciona espaçamento como um evento normal */
    padding: 2px 4px !important; /* Adiciona preenchimento interno */
    border-radius: 4px !important; /* Bordas arredondadas */
    background-color: var(--brand-red) !important;
    border: 1px solid var(--brand-red) !important;
    color: white !important;
    z-index: 3 !important; /* Garante que fique acima de outros elementos */
}

/* Fix for theme link color override */
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc a.fc-col-header-cell-cushion,
.fc a.fc-daygrid-day-number {
    color: var(--wic-text-color) !important;
    text-decoration: none !important;
}

/* --- Layout com Legenda --- */
.wic-main-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.wic-calendar-column {
    flex: 1;
    min-width: 0; /* Permite que o calendário encolha se necessário */
}

.wic-legend-column {
    flex: 0 0 250px; /* Largura fixa de 250px */
}

.wic-legend {
    background-color: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 0.375rem;
    padding: 1rem;
    position: sticky;
    top: 1rem;
}

.wic-legend h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-red);
    font-family: 'Terminal Dosis', sans-serif;
    text-transform: uppercase;
}

.wic-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.wic-legend-item:last-child {
    margin-bottom: 0;
}

.wic-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.wic-legend-name {
    color: #333;
    font-weight: 500;
}

/* Responsivo */
@media (max-width: 768px) {
    .wic-main-content {
        flex-direction: column;
    }
    
    .wic-legend-column {
        flex: none;
        width: 100%;
    }
    
    .wic-legend {
        position: static;
    }
}

/* --- Year View Styles --- */
#wic-year-view-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--brand-red);
    color: var(--brand-light-gray);
}

#wic-year-view-header .fc-toolbar-chunk {
    flex: 1;
}

#wic-year-view-header .fc-toolbar-chunk:nth-child(2) {
    text-align: center;
}

#wic-year-view-header .fc-toolbar-chunk:nth-child(3) {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Força os botões da visão de ano a terem EXATAMENTE o mesmo estilo da visão de mês */
#wic-year-view-header .fc-button {
    color: var(--brand-light-gray) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    text-transform: uppercase;
    transition: background-color 0.2s ease-in-out;
    border-radius: 0.375rem !important;
}

#wic-year-view-header .fc-button .fc-icon {
    color: var(--brand-light-gray) !important;
}

#wic-year-view-header .fc-button:hover {
    background-color: hsl(359 88% 36%) !important; /* Darker red */
}

#wic-year-title {
    font-size: 1.75rem;
    font-weight: bold;
    font-family: 'Terminal Dosis', sans-serif;
    text-transform: uppercase;
    margin: 0;
    color: var(--brand-light-gray);
}

#wic-year-view-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1.5rem;
}

.wic-year-month-header {
    text-align: center;
    font-size: 1.25rem;
    font-weight: bold;
    font-family: 'Terminal Dosis', sans-serif;
    text-transform: uppercase;
    padding: 0.75rem;
    background-color: var(--brand-red);
    color: var(--brand-light-gray);
}

.wic-year-month-container .fc {
    font-size: 0.8em;
    border: 1px solid var(--wic-border-color);
    border-top: none;
}

.wic-year-month-container .fc .fc-daygrid-day-number {
    padding: 2px;
}