/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f3f4f6;
  color: #1f2937;
  line-height: 1.6;
}

/* ===== HEADER ===== */
header {
  background: linear-gradient(135deg, #f9730d 0%, #ea6600 100%);
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 1rem;
}

.header-content img {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
}

/* ===== ADMIN LOGIN LINKS ===== */
.admin-login-link {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-admin-login,
.btn-logout {
  background-color: rgba(255, 255, 255, 0.95);
  color: #f9730d;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-admin-login:hover {
  background-color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-logout {
  background-color: rgba(255, 255, 255, 0.9);
  color: #dc2626;
}

.btn-logout:hover {
  background-color: #dc2626;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.text-center {
  text-align: center;
}

/* ===== ADMIN CONTROLS ===== */
.admin-controls,
.lista-eventos-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== BOTÕES ===== */
button,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:focus,
.btn-primary:focus,
.btn-secondary:focus {
  outline: 3px solid rgba(249, 115, 13, 0.3);
  outline-offset: 2px;
}

.btn-primary,
#toggle-form-btn {
  background-color: #f9730d;
  color: white;
}

.btn-primary:hover,
#toggle-form-btn:hover {
  background-color: #ea6600;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(249, 115, 13, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary,
#reload-calendar-btn,
#toggle-lista-btn {
  background-color: #6b7280;
  color: white;
}

.btn-secondary:hover,
#reload-calendar-btn:hover,
#toggle-lista-btn:hover {
  background-color: #4b5563;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

button:disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== CALENDÁRIO ===== */
#calendar {
  max-width: 100%;
  margin: 2rem auto;
}

.fc-event {
  cursor: pointer;
  color: white !important;
  font-weight: 500;
  border: none !important;
  padding: 4px 6px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fc-event:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.fc-event:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* ===== CORES DOS EVENTOS ===== */
.event-feriado_nacional { background-color: #dc2626 !important; }
.event-feriado_judaico { background-color: #2563eb !important; }
.event-comemorativo { background-color: #059669 !important; }
.event-data_administrativa { background-color: #7c3aed !important; }
.event-profissional { background-color: #d97706 !important; }
.event-familiar { background-color: #db2777 !important; }
.event-religioso { background-color: #4f46e5 !important; }
.event-municipal { background-color: #6b7280 !important; }
.event-personalizado { background-color: #f97316 !important; }

/* ===== FORMULÁRIO ===== */
.form-container {
  background: #f9fafb;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

form#form-evento {
  max-width: 600px;
  margin: 0 auto;
}

form#form-evento h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: #1f2937;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #374151;
  font-weight: 500;
  font-size: 0.95rem;
}

.required {
  color: #dc2626;
  margin-left: 2px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #f9730d;
  box-shadow: 0 0 0 3px rgba(249, 115, 13, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== LISTA DE EVENTOS ===== */
.eventos-list {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 12px;
}

.eventos-list h3 {
  text-align: center;
  color: #1f2937;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}

.eventos-list-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.evento-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border-left: 4px solid #f9730d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.evento-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.evento-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.evento-info strong {
  color: #1f2937;
  font-size: 1rem;
}

.evento-meta {
  font-size: 0.875rem;
  color: #6b7280;
}

.evento-acao {
  font-size: 0.85rem;
  color: #4b5563;
  font-style: italic;
  margin-top: 0.25rem;
}

.btn-excluir {
  background-color: #dc2626;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-size: 0.9rem;
}

.btn-excluir:hover {
  background-color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.btn-excluir:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

/* ===== MODAIS ===== */
#modal-evento,
#modal-confirmacao {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

#modal-evento .modal-content,
.modal-content-confirm {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  text-align: left;
  animation: modalFadeIn 0.3s ease;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#modal-evento .modal-content h2 {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  color: #1f2937;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f3f4f6;
}

.modal-info {
  margin: 0.75rem 0;
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.6;
}

.modal-info strong {
  color: #1f2937;
  display: inline-block;
  min-width: 120px;
}

#modal-evento .btn-fechar-modal {
  background: #f9730d;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 1.5rem;
  width: 100%;
  font-size: 1rem;
}

#modal-evento .btn-fechar-modal:hover {
  background: #ea6600;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(249, 115, 13, 0.3);
}

/* Modal de Confirmação */
.modal-content-confirm {
  text-align: center;
}

.confirm-message {
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.modal-confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-confirmar,
.btn-danger {
  background-color: #dc2626;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn-confirmar:hover,
.btn-danger:hover {
  background-color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* ===== TOASTS ===== */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 10000;
  max-width: 400px;
}

.toast {
  background-color: #1f2937;
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateX(100%);
  animation: toastSlideIn 0.4s forwards;
  max-width: 100%;
  word-wrap: break-word;
}

.toast-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.toast-error {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.toast-hide {
  animation: toastFadeOut 0.3s forwards;
}

/* ===== LOADING INDICATOR ===== */
#loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  text-align: center;
}

.spinner {
  border: 4px solid #f3f4f6;
  border-top: 4px solid #f9730d;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* ===== ANIMAÇÕES ===== */
@keyframes toastSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .header-title {
    font-size: 1.2rem;
  }

  .admin-login-link {
    position: static;
    flex-direction: column;
  }

  .container {
    margin: 1rem;
    padding: 1rem;
  }

  .admin-controls,
  .lista-eventos-controls {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
  }

  .evento-item {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .btn-excluir {
    width: 100%;
  }

  #toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: calc(100% - 2rem);
  }

  .modal-confirm-buttons {
    flex-direction: column;
  }

  .btn-confirmar,
  .btn-cancelar {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 1rem;
  }

  .header-content img {
    width: 48px;
    height: 48px;
  }

  button,
  .btn-primary,
  .btn-secondary {
    font-size: 0.9rem;
    padding: 0.625rem 1.25rem;
  }

  #modal-evento .modal-content,
  .modal-content-confirm {
    padding: 1.5rem;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  header,
  .admin-controls,
  .lista-eventos-controls,
  .form-container,
  .btn-excluir,
  #toast-container,
  #loading-indicator {
    display: none !important;
  }

  .container {
    box-shadow: none;
    max-width: 100%;
  }

  #calendar {
    page-break-inside: avoid;
  }
}