/* Importação do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Reset e Variáveis de Tema */
:root {
  --font-primary: 'Outfit', sans-serif;
  
  /* Tema Claro (Padrão) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-sidebar: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-sidebar: #f8fafc;
  --border-color: #e2e8f0;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  --sidebar-width: 280px;
}

[data-theme="dark"] {
  /* Tema Escuro */
  --bg-app: #090d16;
  --bg-surface: #121824;
  --bg-surface-hover: #1e293b;
  --bg-sidebar: #070a10;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-sidebar: #f1f5f9;
  --border-color: #1e293b;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e3a8a;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Layout Principal */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Estilo Premium */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  padding: 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  transition: width var(--transition-normal), background-color var(--transition-normal);
  overflow-y: auto;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.logo-text span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
}

/* Menu de Navegação */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item:hover, .nav-item.active {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-on-sidebar);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border-left: 3px solid #3b82f6;
  padding-left: 13px;
}

/* Seção de Filtros Rápida na Sidebar */
.sidebar-section {
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.legend-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.legend-item.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--text-on-sidebar);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: 5px; /* Compensa a borda para não quebrar alinhamento */
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Sidebar Nav Dropdowns */
.nav-dropdown {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.nav-dropdown-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  display: flex;
  flex-direction: column;
  padding-left: 12px;
  margin-left: 8px;
  border-left: 1px dashed rgba(255, 255, 255, 0.15);
  margin-top: 4px;
  transition: max-height var(--transition-normal), opacity var(--transition-normal), margin var(--transition-normal), padding var(--transition-normal);
}

.nav-dropdown.active .nav-dropdown-content {
  max-height: 600px; /* Suficiente para caber a lista e botões */
  opacity: 1;
  margin-top: 8px;
  padding-bottom: 8px;
}

.nav-dropdown.active .chevron-icon {
  transform: rotate(180deg);
}

/* Área de Conteúdo Principal */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Barra de Topo */
.top-header {
  height: 72px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 5;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-title-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.calendar-navigation {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.current-month-display {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
  text-transform: capitalize;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-container {
  position: relative;
  width: 240px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
  opacity: 0.95;
}

/* Área de Visualização Principal */
.view-panel {
  flex-grow: 1;
  padding: 24px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Painel de Filtros */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Estrutura do Calendário Mensal */
.calendar-view {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 550px;
  overflow: hidden;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background-color: var(--bg-surface-hover);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.calendar-header-day {
  padding: 12px 4px;
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 38px;
  grid-auto-rows: minmax(24px, auto);
  position: relative;
  flex-grow: 1;
  flex-basis: 0;
  border-bottom: 1px solid var(--border-color);
}

.calendar-week-row:last-child {
  border-bottom: none;
}

/* Célula do Dia */
.calendar-day-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(100% / 7);
  border-right: 1px solid var(--border-color);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color var(--transition-fast);
  z-index: 1;
}

/* Posicionamento dos dias é gerenciado dinamicamente via JS (inline style 'left') para evitar desalinhamento */

.calendar-day-bg.other-month {
  background-color: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .calendar-day-bg.other-month {
  background-color: rgba(255, 255, 255, 0.02);
}

.calendar-day-bg.today {
  background-color: rgba(59, 130, 246, 0.05);
}

.calendar-day-bg.today .day-val {
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  z-index: 3;
}

.day-number {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
}

.weekday-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.day-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.event-servers-label {
  font-weight: 400;
  opacity: 0.85;
  font-size: 9.5px;
}

.calendar-day-bg.other-month .day-val,
.calendar-day-bg.other-month .weekday-label {
  color: var(--text-muted);
}

.day-action-indicator {
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--primary);
  cursor: pointer;
}

.calendar-day-bg:hover {
  background-color: var(--bg-surface-hover);
}

.calendar-day-bg:hover .day-action-indicator {
  opacity: 1;
}

/* Eventos do Calendário */
.event-item {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #0f172a; /* Texto escuro e legível para a maioria dos fundos claros */
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-left: 3px solid rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.event-item:hover {
  transform: scale(1.02);
  filter: brightness(0.95);
  z-index: 4;
}

/* Estilo para eventos que continuam em múltiplos dias */
.event-item.span-start {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: -9px;
  z-index: 3;
}

.event-item.span-middle {
  border-radius: 0;
  margin-left: -9px;
  margin-right: -9px;
  z-index: 2;
  border-left: none;
}

.event-item.span-end {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -9px;
  z-index: 3;
  border-left: none;
}

.event-time {
  font-size: 9px;
  opacity: 0.8;
  margin-bottom: 1px;
}

/* Visualização em Lista */
.list-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
}

.list-group {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.list-group-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
}

.list-event-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  cursor: pointer;
  border-left: 4px solid var(--primary);
  margin-bottom: 8px;
}

.list-event-item:last-child {
  margin-bottom: 0;
}

.list-event-item:hover {
  background-color: var(--bg-surface-hover);
}

.list-event-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.list-event-time-col {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.list-event-info {
  flex-grow: 1;
}

.list-event-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.list-event-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.list-event-actions {
  display: flex;
  gap: 8px;
}

/* Dashboard / Estatísticas */
.dashboard-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
}

.dashboard-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.dashboard-card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dashboard-metric {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.dashboard-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.dashboard-stat-row:last-child {
  border-bottom: none;
}

.dashboard-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.dashboard-stat-value {
  font-weight: 600;
  background-color: var(--bg-surface-hover);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Modais */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.btn-secondary {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  background-color: #dc2626;
}

/* Configurações do Tema Toggle */
.theme-toggle-container {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-toggle-label {
  font-size: 13px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #475569;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Otimização de Layout Mobile/Responsividade */
/* Hamburguer e Overlay da Sidebar Mobile */
.btn-hamburger {
  background: none;
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  margin-right: 8px;
  flex-shrink: 0;
}

.btn-hamburger:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 850;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Dots e Destaques do Calendário */
.day-events-dots {
  display: none;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: auto;
  justify-content: center;
  width: 100%;
  padding-top: 4px;
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.calendar-day-bg.selected-day {
  background-color: var(--primary-light) !important;
  border: 2px solid var(--primary) !important;
  z-index: 5;
}

[data-theme="dark"] .calendar-day-bg.selected-day {
  background-color: rgba(59, 130, 246, 0.2) !important;
  border: 2px solid var(--primary) !important;
}

/* Painel de Detalhes do Dia Selecionado no Mobile */
.mobile-day-events {
  display: none; /* Oculto por padrão no desktop */
  margin-top: 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.mobile-day-events-header {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.mobile-day-events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-day-event-card {
  background-color: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.mobile-day-event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.card-category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.card-time-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.card-detail-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Otimização de Layout Mobile/Responsividade */
@media (max-width: 1024px) {
  .btn-hamburger {
    display: flex !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 900;
    box-shadow: var(--shadow-xl);
    border-right: 1px solid var(--border-color);
    transition: transform var(--transition-normal), background-color var(--transition-normal);
    overflow-y: auto;
  }

  .sidebar.mobile-active {
    transform: translateX(0);
  }

  .btn-sidebar-toggle {
    display: none !important;
  }

  .main-content {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }

  .view-panel {
    padding: 16px 20px;
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .top-header {
    flex-direction: column;
    height: auto;
    padding: 16px;
    gap: 12px;
    align-items: flex-start;
  }
  
  .header-title-container {
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .btn-hamburger {
    margin-right: 0 !important;
  }

  .header-title {
    font-size: 20px !important;
    margin: 0 !important;
  }

  .calendar-navigation {
    width: 100% !important;
    justify-content: space-between !important;
    margin-top: 4px !important;
  }

  .current-month-display {
    flex-grow: 1;
    min-width: auto;
  }
  
  .header-actions {
    width: 100%;
    gap: 8px;
  }
  
  .search-container {
    flex-grow: 1;
    width: auto;
  }
  
  .btn-primary {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Oculta as barras do calendário e mostra as bolinhas de eventos */
  .calendar-week-row .event-item {
    display: none !important;
  }

  .day-events-dots {
    display: flex;
  }

  /* Impede o colapso e a sobreposição das semanas no mobile */
  .calendar-view {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .calendar-grid {
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .calendar-week-row {
    height: 70px !important;
    min-height: 70px !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .calendar-day-bg {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 70px !important;
    min-height: 70px !important;
    padding: 6px 4px;
    cursor: pointer;
  }

  /* Abrevia os cabeçalhos de dias para Seg, Ter, etc. */
  .calendar-header-day {
    font-size: 0 !important;
    padding: 8px 0 !important;
  }

  .calendar-header-day::before {
    content: attr(data-short) !important;
    font-size: 11px !important;
    font-weight: 600;
  }
  
  .day-number {
    font-size: 11px;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    text-align: center;
  }
  
  /* Remove o nome do dia redundante dentro da célula */
  .weekday-label {
    display: none !important;
  }

  .day-val {
    font-size: 12px;
    font-weight: 700;
  }

  .day-action-indicator {
    display: none !important;
  }

  /* Exibe o painel de detalhes no mobile */
  .mobile-day-events {
    display: block;
  }

  /* Otimiza visualização da escala para caber o máximo possível */
  .schedule-table td:first-child, .schedule-table th:first-child {
    min-width: 140px !important;
    max-width: 140px !important;
    font-size: 12px;
    padding: 8px !important;
  }

  .schedule-table th, .schedule-table td {
    padding: 8px !important;
    min-width: 100px;
  }
}

@media (max-width: 576px) {
  .filters-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .filter-select {
    width: 100%;
    padding: 8px;
    font-size: 12px;
  }

  #filter-server {
    grid-column: span 2; /* Deixa o seletor de servidores centralizado em largura total */
  }

  .filters-bar button {
    grid-column: span 2;
    width: 100%;
    padding: 8px;
    font-size: 12px;
  }

  .modal-content {
    width: calc(100% - 24px);
    margin: 12px;
  }
}

/* Folha de Estilo de Impressão */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }
  
  .sidebar, .top-header, .filters-bar, .btn-primary, .theme-toggle-container, .day-action-indicator, .modal-overlay {
    display: none !important;
  }
  
  .app-container {
    height: auto !important;
    display: block !important;
  }
  
  .main-content {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .view-panel {
    padding: 0 !important;
    overflow: visible !important;
  }
  
  .calendar-view {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: block !important;
    page-break-after: always;
  }
  
  .calendar-header {
    background-color: #f1f5f9 !important;
    border-bottom: 1px solid #000 !important;
    color: black !important;
  }
  
  .calendar-header-day {
    padding: 8px 0 !important;
    border-right: 1px solid #000 !important;
  }
  .calendar-header-day:last-child {
    border-right: none !important;
  }
  
  .calendar-grid {
    grid-auto-rows: minmax(120px, auto) !important;
    border-bottom: none !important;
  }
  
  .calendar-day-bg {
    border-right: 1px solid #000 !important;
    border-bottom: 1px solid #000 !important;
    min-height: 120px !important;
    page-break-inside: avoid;
  }
  
  .calendar-day-bg.other-month {
    background-color: #fafafa !important;
  }
  
  .event-item {
    border: 1px solid #000 !important;
    color: black !important;
    background-color: transparent !important;
    box-shadow: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    margin-bottom: 4px !important;
  }
  
  /* Garantir que as barras de eventos múltiplos sejam legíveis */
  .event-item.span-start, .event-item.span-middle, .event-item.span-end {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 4px !important;
  }
}

/* Tabela de Escala de Servidores */
.schedule-view {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  flex-grow: 1;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.schedule-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.schedule-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.week-selector-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-week-toggle {
  background-color: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.btn-week-toggle:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn-week-toggle.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.schedule-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  flex-grow: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  min-width: 900px;
}

.schedule-table th, .schedule-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: top;
  min-width: 120px; /* Garante largura mínima horizontal para cada dia */
}

.schedule-table th:last-child, .schedule-table td:last-child {
  border-right: none;
}

.schedule-table th {
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 5;
}

.schedule-table td:first-child, .schedule-table th:first-child {
  position: sticky;
  left: 0;
  border-right: 2px solid var(--border-color);
  min-width: 240px; /* Primeira coluna (servidores) mais larga */
}

.schedule-table td:first-child {
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  z-index: 6; /* Acima dos tds normais */
}

.schedule-table th:first-child {
  background-color: var(--bg-surface-hover);
  z-index: 7; /* Acima de th normal (5) e td:first-child (6) */
}

[data-theme="dark"] .schedule-table td:first-child {
  background-color: var(--bg-surface);
}

.schedule-cell-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 36px;
}

.schedule-event-badge {
  padding: 5px 8px;
  border-radius: 4px;
  color: #0f172a;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  border-left: 3px solid rgba(0, 0, 0, 0.2);
  white-space: normal;
  word-break: break-word;
  transition: transform 0.1s ease, filter 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.schedule-event-badge:hover {
  transform: translateY(-1px);
  filter: brightness(0.92);
}

.schedule-cell-free {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
}

.schedule-cell-free::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
  width: 80px;
  padding: 24px 14px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .chevron-icon,
.sidebar.collapsed .nav-dropdown,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .theme-toggle-label,
.sidebar.collapsed div[style*="border-top"] {
  display: none !important;
}

.sidebar.collapsed .logo-container {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.sidebar.collapsed .logo-img {
  height: 36px;
  width: auto;
}

.sidebar.collapsed .btn-sidebar-toggle {
  margin-left: 0;
}

.sidebar.collapsed .btn-sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  border-left: none;
}

.sidebar.collapsed .nav-item.active {
  border-left: 3px solid var(--primary);
  padding-left: 0; /* Remove padding offset when collapsed */
}

.sidebar.collapsed .nav-item svg {
  margin: 0;
}

.sidebar.collapsed .theme-toggle-container {
  justify-content: center;
  padding-top: 12px;
}

/* --- LEAVE AND CONFLICT IMPROVEMENTS --- */
.leave-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--bg-surface-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  transition: background-color var(--transition-fast);
}
.leave-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.leave-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: #ef4444;
  color: white;
  align-self: flex-start;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.leave-dates {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.badge-conflict {
  background-color: #d97706; /* Amarelo Laranja Escuro */
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  box-shadow: var(--shadow-sm);
}
.badge-leave {
  background-color: #dc2626; /* Vermelho escuro */
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  box-shadow: var(--shadow-sm);
}
.schedule-cell-leave {
  font-size: 11px;
  font-weight: 600;
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
