:root {
  --cor-primaria: #2563eb;
  --cor-primaria-escura: #1d4ed8;
  --cor-fundo: #f3f4f6;
  --cor-branco: #ffffff;
  --cor-texto: #1f2937;
  --cor-texto-claro: #6b7280;
  --cor-borda: #e5e7eb;
  --cor-sucesso: #10b981;
  --cor-perigo: #ef4444;
  --cor-aviso: #f59e0b;
  --sombra: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --raio: 12px;
}

/* ===== MODO ESCURO ===== */
.dark-mode {
  --cor-fundo: #111827;
  --cor-branco: #1f2937;
  --cor-texto: #f9fafb;
  --cor-texto-claro: #9ca3af;
  --cor-borda: #374151;
  --sombra: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

.dark-mode .login {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.dark-mode .login-box {
  background: #1f2937;
  color: #f9fafb;
}

.dark-mode .login-box p {
  color: #9ca3af;
}

.dark-mode .erro-msg {
  background: #7f1d1d;
  color: #fecaca;
}

.dark-mode .campo input[type="text"],
.dark-mode .campo input[type="password"],
.dark-mode .campo input[type="date"],
.dark-mode .campo textarea,
.dark-mode .campo select {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark-mode .campo input:focus,
.dark-mode .campo textarea:focus,
.dark-mode .campo select:focus {
  border-color: var(--cor-primaria);
}

.dark-mode .recado {
  background: #1f2937;
}

.dark-mode .recado h2 {
  color: #f9fafb;
}

.dark-mode .sem-recados {
  background: #1f2937;
}

.dark-mode .sem-recados p {
  color: #9ca3af;
}

.dark-mode .btn-icone,
.dark-mode .btn-admin {
  background: #374151;
  color: #f9fafb;
  border-color: #4b5563;
}

.dark-mode .btn-icone:hover,
.dark-mode .btn-admin:hover {
  background: #4b5563;
}

.dark-mode .tabela-recados tr:hover {
  background: #374151;
}

.dark-mode .modal-conteudo {
  background: #1f2937;
  color: #f9fafb;
}

.dark-mode .btn-cancelar {
  background: #374151;
  color: #f9fafb;
}

.dark-mode .btn-cancelar:hover {
  background: #4b5563;
}

.dark-mode .form-section,
.dark-mode .lista-section {
  background: #1f2937;
}

.dark-mode .form-section h2,
.dark-mode .lista-section h2 {
  color: #f9fafb;
}

.dark-mode .atualizacao {
  color: #9ca3af;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--cor-fundo);
  color: var(--cor-texto);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ===== LOGIN ===== */
.login {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 1rem;
}

.login-box {
  background: var(--cor-branco);
  border-radius: var(--raio);
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.login-box h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-box p {
  color: var(--cor-texto-claro);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.erro-msg {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: var(--cor-primaria);
  color: var(--cor-branco);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn-login:hover {
  background: var(--cor-primaria-escura);
}

.link-voltar {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--cor-texto-claro);
  text-decoration: none;
  font-size: 0.9rem;
}

.link-voltar:hover {
  color: var(--cor-primaria);
}

/* ===== PÁGINA PÚBLICA ===== */
.publico header {
  text-align: center;
  margin-bottom: 2rem;
}

.publico h1 {
  font-size: 2.5rem;
  color: var(--cor-primaria);
  margin-bottom: 0.5rem;
}

.publico .data {
  font-size: 1.1rem;
  color: var(--cor-texto-claro);
  text-transform: capitalize;
}

.recado {
  background: var(--cor-branco);
  border-radius: var(--raio);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--sombra);
  border-left: 5px solid #2563eb;
  animation: entrar 0.5s ease-out;
  transition: background 0.3s;
}

/* Cores por categoria */
.recado.categoria-geral { border-left-color: #2563eb; }
.recado.categoria-urgente { border-left-color: #dc2626; }
.recado.categoria-aviso { border-left-color: #d97706; }
.recado.categoria-comemoracao { border-left-color: #059669; }
.recado.categoria-reuniao { border-left-color: #7c3aed; }

.recado-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

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

.recado.novo {
  animation: pulse 1.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { box-shadow: var(--sombra); }
  50% { box-shadow: 0 0 25px rgba(245, 158, 11, 0.5); }
}

.recado h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--cor-texto);
  transition: color 0.3s;
}

.recado p {
  color: var(--cor-texto-claro);
  font-size: 1.05rem;
}

.recado time {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.sem-recados {
  text-align: center;
  padding: 3rem;
  background: var(--cor-branco);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  transition: background 0.3s;
}

.sem-recados p {
  font-size: 1.3rem;
  color: var(--cor-texto-claro);
}

footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--cor-borda);
}

.botoes-footer {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.btn-icone,
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--cor-borda);
  background: var(--cor-branco);
  color: var(--cor-texto);
  transition: all 0.2s;
}

.btn-icone:hover,
.btn-admin:hover {
  background: var(--cor-fundo);
  border-color: var(--cor-texto-claro);
}

.btn-icone.ativo {
  background: var(--cor-sucesso);
  color: var(--cor-branco);
  border-color: var(--cor-sucesso);
}

.atualizacao {
  color: var(--cor-texto-claro);
  font-size: 0.85rem;
}

/* ===== PAINEL ADMIN ===== */
.admin header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin h1 {
  font-size: 1.8rem;
}

.header-botoes {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-voltar,
.btn-sair {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn-voltar {
  background: var(--cor-primaria);
  color: var(--cor-branco);
}

.btn-voltar:hover {
  background: var(--cor-primaria-escura);
}

.btn-sair {
  background: var(--cor-perigo);
  color: var(--cor-branco);
}

.btn-sair:hover {
  background: #dc2626;
}

.form-section,
.lista-section {
  background: var(--cor-branco);
  border-radius: var(--raio);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--sombra);
  transition: background 0.3s;
}

.form-section h2,
.lista-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--cor-texto);
  transition: color 0.3s;
}

.campo {
  margin-bottom: 1rem;
  flex: 1;
}

.campo label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.campo input[type="text"],
.campo input[type="password"],
.campo input[type="date"],
.campo textarea,
.campo select {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--cor-borda);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
  background: var(--cor-branco);
  color: var(--cor-texto);
}

.campo input:focus,
.campo textarea:focus,
.campo select:focus {
  outline: none;
  border-color: var(--cor-primaria);
}

.campo-linha {
  display: flex;
  gap: 1rem;
}

.checkbox-campo label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-campo input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
}

.btn-salvar {
  padding: 0.75rem 1.5rem;
  background: var(--cor-sucesso);
  color: var(--cor-branco);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-salvar:hover {
  background: #059669;
}

.tabela-recados {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tabela-recados th,
.tabela-recados td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--cor-borda);
}

.tabela-recados th {
  font-weight: 600;
  color: var(--cor-texto-claro);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.tabela-recados td {
  color: var(--cor-texto);
}

.tabela-recados tr:hover {
  background: #f9fafb;
}

.tag-categoria {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.btn-editar,
.btn-excluir {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
}

.btn-editar:hover {
  transform: scale(1.1);
}

.btn-excluir:hover {
  transform: scale(1.1);
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.ativo {
  display: flex;
}

.modal-conteudo {
  background: var(--cor-branco);
  padding: 2rem;
  border-radius: var(--raio);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transition: background 0.3s, color 0.3s;
}

.modal-conteudo h3 {
  margin-bottom: 1rem;
}

.modal-botoes {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-cancelar {
  padding: 0.75rem 1.5rem;
  background: var(--cor-borda);
  color: var(--cor-texto);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancelar:hover {
  background: #d1d5db;
}

/* ===== FULLSCREEN ===== */
.publico:fullscreen {
  background: var(--cor-fundo);
  padding: 2rem;
  overflow-y: auto;
}

.publico:fullscreen .container {
  max-width: 1200px;
}

.publico:fullscreen h1 {
  font-size: 3.5rem;
}

.publico:fullscreen .recado {
  padding: 2rem;
}

.publico:fullscreen .recado h2 {
  font-size: 2rem;
}

.publico:fullscreen .recado p {
  font-size: 1.4rem;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 640px) {
  .publico h1 {
    font-size: 1.8rem;
  }

  .admin header {
    flex-direction: column;
    align-items: flex-start;
  }

  .campo-linha {
    flex-direction: column;
    gap: 0;
  }

  .tabela-recados {
    font-size: 0.85rem;
  }

  .tabela-recados th,
  .tabela-recados td {
    padding: 0.5rem;
  }

  .login-box {
    padding: 1.5rem;
  }
}
