/* ==========================================================================
    RESET & BASE STYLES
    ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  background: linear-gradient(135deg, #f4f4f4 0%, #e8eaf6 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}
body.painel {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #f4f4f4 0%, #e8eaf6 100%);
  min-height: 100vh;
  display: block;
  justify-content: normal;
  align-items: normal;
}

/* ==========================================================================
    LAYOUT PRINCIPAL (LIGHT MODE - Base Styles)
    ========================================================================== */

#wrapper {
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* HEADER */
#header {
  height: 100px;
  background: linear-gradient(135deg, #051866 0%, #1e3a8a 100%);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: relative;
  box-shadow: 0 2px 20px rgba(5, 24, 102, 0.2);
}
#header img {
  width: 82px;
  height: 82px;
  margin-right: 16px;
}
#header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #5793fb;
  margin: 0 auto;
  letter-spacing: 1px;
}

/* USER LOGGED */
.userlogado {
  position: absolute;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.userlogado h2 {
  margin: 0;
  font-size: 16px;
  color: #fff !important;
  font-weight: 500;
}

.userlogado #theme-toggle {
  margin-right: 15px;
}

.userlogado h2 a,
.userlogado h2 a:link,
.userlogado h2 a:visited,
.userlogado h2 a:hover,
.userlogado h2 a:active,
.userlogado h2 a:focus {
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 500;
}
.toggle-user.item {
  color: #fff !important;
  text-decoration: none !important;
}
.toggle-user.item:hover {
  color: #fff !important;
  background: transparent;
}
#sair-accordion {
  list-style-type: none;
  position: relative;
}
#sair-accordion ul {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  min-width: 180px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}
#sair-accordion ul li {
  padding: 0;
  width: 100%;
  margin: 0;
}
#sair-accordion ul li a {
  text-decoration: none !important;
  display: block;
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  transition: all 0.3s ease;
  border-bottom: 1px solid #f0f0f0;
}
#sair-accordion ul li:last-child a {
  border-bottom: none;
}
#sair-accordion ul li a:hover {
  background: #5793fb;
  color: #fff;
}

/* MAIN CONTENT */
#wrap-content {
  flex: 1;
  display: flex;
  padding: 24px;
}
#wrap-content-div {
  flex: 1;
  display: flex;
  padding: 24px;
  gap: 24px;
}

/* SIDEBAR */
#sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  padding: 16px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  order: -1;
}
#accordion > li {
  list-style-type: none;
  margin-bottom: 4px;
}
#accordion > li > a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 8px;
  margin: 0 8px;
}
#accordion > li > a:hover,
#accordion > li > a.active {
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff;
  transform: translateX(4px);
}
#accordion ul.inner {
  display: none;
  background: #f8fafc;
  border-radius: 8px;
  margin: 4px 12px;
  overflow: hidden;
}
#accordion ul.inner li a {
  display: block;
  padding: 12px 20px;
  font-size: 14px;
  color: #64748b;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}
#accordion ul.inner li a:hover {
  background: #e0e7ff;
  color: #5793fb;
  border-left-color: #5793fb;
  padding-left: 24px;
}

/* CONTENT */
#content {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
#content h2 {
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}
#content p.index {
  font-size: 18px;
  color: #64748b;
  text-align: center;
  padding: 40px;
}

/* FOOTER */
#footer {
  background: #f1f5f9;
  padding: 16px 24px;
  text-align: center;
  font-size: 14px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
    ALERTS & MESSAGES (LIGHT MODE)
    ========================================================================== */
.erro,
.sucesso,
.alerta,
.pergunta {
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 8px;
  font-weight: 500;
  width: 100%;
  box-sizing: border-box;
  text-align: left; /* Ajustado para manter alinhamento em elementos não-login */
}
.sucesso {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border: 1px solid #22c55e;
  color: #166534;
}
.alerta {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  color: #92400e;
}
.erro {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border: 1px solid #ef4444;
  color: #dc2626;
}
.pergunta {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border: 1px solid #3b82f6;
  color: #1e40af;
}

/* ==========================================================================
    DATA TABLE MODERN (Used for #listausers)
    ========================================================================== */
table.dataTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: #fff;
}
table.dataTable thead th {
  padding: 16px 12px;
  background: linear-gradient(135deg, #051866, #1e3a8a);
  color: #fff;
  font-weight: 600;
  text-align: left;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
table.dataTable tbody tr {
  transition: all 0.3s ease;
}
table.dataTable tbody tr:hover {
  background: #f8fafc;
  /* Removida a escala (transform: scale(1.01);) para evitar problemas de layout em tabelas */
}
table.dataTable td {
  padding: 16px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}
table.dataTable tbody tr:nth-child(even) {
  background: #f8fafc;
}
table.dataTable tbody tr:nth-child(even):hover {
  background: #e2e8f0;
}

/* PAGINATION */
.dataTables_paginate .paginate_button {
  padding: 8px 12px !important;
  margin: 0 2px;
  border: 2px solid #e5e7eb !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #374151 !important;
  transition: all 0.3s ease;
}
.dataTables_paginate .paginate_button:hover {
  background: #5793fb !important;
  color: #fff !important;
  border-color: #5793fb !important;
  transform: translateY(-1px);
}
.dataTables_paginate .paginate_active {
  background: linear-gradient(135deg, #5793fb, #4f46e5) !important; /* Adicionado gradiente */
  color: #fff !important;
  border-color: #5793fb !important;
  box-shadow: 0 4px 12px rgba(87, 147, 251, 0.3); /* Adicionada sombra */
}


/* ==========================================================================
    LOGIN PAGE STYLES (LIGHT MODE)
    ========================================================================== */

/* Login body background (Original body.painel background is here, but since body.painel is now a container, I'll use body for the login background) */
body:not(.painel) { 
  background: linear-gradient(135deg, #051866 0%, #1e3a8a 100%); 
}

/* The main login form container */
#loginform {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.5s ease;
}

/* Logo container */
#loginform .logo-img {
  text-align: center;
  margin-bottom: 24px;
}
#loginform .logo-img img {
  max-width: 125px;
  height: auto;
}

/* Form and Fieldset reset */
#loginform .userform {
  width: 100%;
}
#loginform .userform fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

/* List styling reset */
#loginform .userform ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
#loginform .userform li {
  margin-bottom: 20px;
  position: relative;
}

/* Form labels */
#loginform .userform label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

/* Form inputs (text and password) */
#loginform .userform input[type="text"],
#loginform .userform input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #fff;
  box-sizing: border-box;
}
#loginform .userform input[type="text"]:focus,
#loginform .userform input[type="password"]:focus {
  outline: none;
  border-color: #5793fb;
  box-shadow: 0 0 0 4px rgba(87, 147, 251, 0.1);
}

/* Login button */
#loginform .userform li.center {
  text-align: center;
  margin-top: 30px;
  margin-bottom: 0;
}
#loginform .userform input[type="submit"] {
  width: 100%;
  padding: 14px 28px;
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(87, 147, 251, 0.2);
}
#loginform .userform input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(87, 147, 251, 0.3);
}

/* ==========================================================================
    Error/Success Messages (for login page)
    ========================================================================== */
/* Os estilos de cores e gradientes para .erro, .sucesso, .alerta já estão definidos no bloco de Alerts & Messages e são aplicados aqui, apenas o layout é adaptado para o login. */
.erro,
.sucesso,
.alerta {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  margin-bottom: 24px;
}

/* ==========================================================================
    CONTENT FORMS (User, Cliente, etc) (LIGHT MODE)
    ========================================================================== */

/*
* NOTE: The .btn-add styles are moved and consolidated into
* .btn-add-primary for better visual consistency.
*/

#content .userform,
#content .clienteform {
  width: 100%;
  max-width: 800px;
  margin: 20px 0;
}
#content .userform fieldset,
#content .clienteform fieldset {
  border: 2px solid #d1d5db;
  border-radius: 12px;
  padding: 24px 30px;
  background: #fdfdfd;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
#content .userform legend,
#content .clienteform legend {
  font-size: 18px;
  font-weight: 600;
  color: #1e3a8a;
  padding: 0 10px;
  margin-left: -10px;
}
#content .userform ul,
#content .clienteform ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
#content .userform li,
#content .clienteform li {
  padding: 14px 0;
  border-bottom: 1px dashed #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
#content .userform li:last-child,
#content .clienteform li:last-child {
  border-bottom: none;
  padding-top: 24px;
}

/* Nested lists (for permissions in utilizadores.php) */
#content .userform li ul {
  width: 100%;
  margin-top: 10px;
  margin-left: 20px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px;
}
#content .userform li ul li {
  border-bottom: none;
  padding: 6px 0;
  display: block;
}

/* Form Labels */
#content .userform label.user,
#content .clienteform label.user {
  font-weight: 500;
  color: #374151;
  flex-basis: 180px;
  flex-shrink: 0;
}
#content .userform li ul label.user {
  flex-basis: auto;
  margin-right: 10px;
}

/* Form Inputs */
#content .userform input[type="text"],
#content .userform input[type="text2"],
#content .userform input[type="email"],
#content .userform input[type="password"],
#content .clienteform input[type="text"],
/* Incluído textarea e select, que são comuns em outros formulários */
#content .userform textarea, 
#content .userform select {
  flex-grow: 1;
  min-width: 250px;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #fff;
  box-sizing: border-box;
}

/* Custom styles for modern-select (MOVED FROM PHP) */
#content .userform .modern-select,
#content .clienteform .modern-select {
  flex-grow: 1;
  min-width: 250px;
  /* Corresponde ao estilo anterior da input: */
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #fff;
  box-sizing: border-box;
  /* Estilos específicos do select: */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

#content .userform input[type="text"]:focus,
#content .userform input[type="text2"]:focus,
#content .userform input[type="email"]:focus,
#content .userform input[type="password"]:focus,
#content .clienteform input[type="text"]:focus,
#content .userform textarea:focus,
#content .userform select:focus,
#content .userform .modern-select:focus,
#content .clienteform .modern-select:focus {
  outline: none;
  border-color: #5793fb;
  box-shadow: 0 0 0 4px rgba(87, 147, 251, 0.1);
}
#content .userform input[type="checkbox"],
#content .clienteform input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
  accent-color: #4f46e5;
}

/* Disabled inputs */
#content .userform input:disabled,
#content .userform textarea:disabled,
#content .userform select:disabled,
#content .clienteform input:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  border-color: #f1f5f9;
}

/* Button alignment */
#content .userform li.center,
#content .clienteform li.center {
  justify-content: center;
}
#content .userform li.right,
#content .clienteform li.right {
  justify-content: flex-end;
  flex-grow: 1;
}

/* General Button Styles */
#content .userform input[type="submit"],
#content .userform input[type="button"],
#content .clienteform input[type="submit"],
#content .clienteform input[type="button"] {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 5px;
}

/* .submit2 (Cadastrar/Registar) */
#content input.submit2[type="submit"] {
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 15px rgba(87, 147, 251, 0.2);
}
#content input.submit2[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(87, 147, 251, 0.3);
}

/* .submit3 (Salvar Alterações) */
#content input.submit3[type="submit"] {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}
#content input.submit3[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

/* .submit4 (Confirmar Exclusão) */
#content input.submit4[type="submit"] {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}
#content input.submit4[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Cancelar Buttons (all types) */
#content input[value="Cancelar"].submit2,
#content input[value="Cancelar"].submit3,
#content input[value="Cancelar"].submit4 {
  background: #6b7280;
  color: #fff;
  box-shadow: 0 4px 15px rgba(107, 114, 128, 0.2);
}
#content input[value="Cancelar"]:hover {
  background: #4b5563;
  transform: translateY(-2px);
}

/* ==========================================================================
    DATA TABLE ACTIONS (for .tableuser)
    ========================================================================== */

/* Styles the <img> icons in your tables */
.tableuser td a {
  display: inline-block;
  margin: 0 4px;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.3s ease;
}
.tableuser td a:hover {
  transform: translateY(-2px);
  background: #f1f5f9;
}
.tableuser td a img {
  display: block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* ==========================================================================
    TOGGLE BUTTON STYLES
    ========================================================================== */

.theme-toggle {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    transition: color 0.3s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: #5793fb;
}

/* Moon for Dark Mode (default icon) */
.theme-toggle .icon-placeholder::before {
    content: "🌙"; 
    font-size: 20px;
    line-height: 1;
}

/* Sun for Light Mode (applied when body has .light-mode) */
.painel.light-mode .theme-toggle .icon-placeholder::before {
    content: "☀️"; 
    font-size: 20px;
    line-height: 1;
}

/* ==========================================================================
    CUSTOM BUTTON STYLES FOR LINKS (NEW)
    ========================================================================== */

/* General Button Styles for Navigation Links */
.btn-nav-mode {
  padding: 10px 16px;
  border: 2px solid #337ab7; /* Default blue border */
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none !important;
  display: inline-flex; /* Use inline-flex to align content */
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-right: 10px;
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-nav-mode.btn-default {
  background-color: #fff;
  color: #337ab7 !important; /* Force color on links */
  border-color: #d1d5db;
}
.btn-nav-mode.btn-success {
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff !important;
  border-color: #5793fb;
  box-shadow: 0 4px 15px rgba(87, 147, 251, 0.3);
}
.btn-nav-mode:hover:not(.btn-success) {
  background-color: #f1f5f9;
  border-color: #5793fb;
  transform: translateY(-1px);
}

/* Base Add Button Style (.btn-add-primary to replace .btn-add) */
.btn-add-primary {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(87, 147, 251, 0.2);
  display: inline-block;
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff !important;
  text-decoration: none !important;
  margin-top: 5px; /* Add some margin top for separation from h2 */
}
.btn-add-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(87, 147, 251, 0.3);
  color: #fff !important;
}

/* Dark Mode Overrides for custom buttons */
body.painel.dark-mode .btn-nav-mode.btn-default {
  background-color: #2d3748;
  color: #90caf9 !important;
  border-color: #4a5568;
}
body.painel.dark-mode .btn-nav-mode.btn-success {
  color: #fff !important;
  border-color: #5793fb;
}
body.painel.dark-mode .btn-nav-mode:hover:not(.btn-success) {
  background-color: #334155;
  border-color: #90caf9;
}
body.painel.dark-mode .btn-add-primary {
  color: #fff !important;
}

/* ==========================================================================
    DARK MODE OVERRIDES (The new default theme)
    ========================================================================== */

/* General Elements */
body.painel.dark-mode {
  background: #121212 !important; /* Darkest overall background */
  color: #f8fafc; /* Light text */
}

body.painel.dark-mode #wrapper {
  background: #1e1e1e;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
}

body.painel.dark-mode #wrap-content-div {
  background: #121212;
}

/* Header/Footer */
body.painel.dark-mode #header {
  background: #1a202c; /* Header slightly darker */
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

body.painel.dark-mode #header h1 {
  color: #90caf9; /* Light Blue for contrast */
}

body.painel.dark-mode #footer {
  background: #1a202c;
  color: #94a3b8;
  border-top-color: #334155;
}

/* Main Content Containers */
body.painel.dark-mode #sidebar,
body.painel.dark-mode #content {
  background: #1a202c;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.painel.dark-mode #content h2 {
  color: #f8fafc;
  border-bottom-color: #334155;
}

body.painel.dark-mode #content p.index {
  color: #94a3b8;
}

/* Sidebar Menu (DARK MODE) - Adaptado para o novo design */
body.painel.dark-mode #accordion > li > a {
  color: #94a3b8;
}
body.painel.dark-mode #accordion > li > a:hover,
body.painel.dark-mode #accordion > li > a.active {
  background: linear-gradient(135deg, #5793fb, #4f46e5);
  color: #fff;
}

body.painel.dark-mode #accordion ul.inner {
  background: #2d3748;
}
body.painel.dark-mode #accordion ul.inner li a {
  color: #94a3b8;
}
body.painel.dark-mode #accordion ul.inner li a:hover {
  background: #4a5568;
  color: #fff;
  border-left-color: #5793fb;
}

/* Alerts & Messages (DARK MODE - Adjusting contrast) */
body.painel.dark-mode .sucesso {
  background: #14532d;
  border: 1px solid #16a34a;
  color: #bbf7d0;
}
body.painel.dark-mode .alerta {
  background: #78350f;
  border: 1px solid #d97706;
  color: #fef3c7;
}
body.painel.dark-mode .erro {
  background: #7f1d1d;
  border: 1px solid #ef4444;
  color: #fecaca;
}
body.painel.dark-mode .pergunta {
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  color: #bfdbfe;
}


/* Data Table (DARK MODE) */
body.painel.dark-mode table.dataTable {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: #1a202c;
}
body.painel.dark-mode table.dataTable thead th {
  background: linear-gradient(135deg, #1a202c, #2d3748);
  color: #fff;
}
body.painel.dark-mode table.dataTable tbody tr {
  color: #f8fafc;
}
body.painel.dark-mode table.dataTable tbody tr:hover {
  background: #2d3748;
}
body.painel.dark-mode table.dataTable tbody tr:nth-child(even) {
  background: #2d3748;
}
body.painel.dark-mode table.dataTable tbody tr:nth-child(even):hover {
  background: #334155;
}
body.painel.dark-mode table.dataTable td {
  border-bottom: 1px solid #334155;
}

/* Pagination (DARK MODE) */
body.painel.dark-mode .dataTables_paginate .paginate_button {
    background: #2d3748 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
body.painel.dark-mode .dataTables_paginate .paginate_button:hover {
    background: #5793fb !important;
    color: #fff !important;
    border-color: #5793fb !important;
}
body.painel.dark-mode .dataTables_paginate .paginate_active {
    background: linear-gradient(135deg, #5793fb, #4f46e5) !important;
    color: #fff !important;
    border-color: #5793fb !important;
    box-shadow: 0 4px 12px rgba(87, 147, 251, 0.3);
}

/* Login Page (DARK MODE) */
body:not(.painel) { 
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%) !important; 
}
body:not(.painel) #loginform {
    background: #1a202c;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
body:not(.painel) #loginform .userform label {
    color: #f8fafc;
}
body:not(.painel) #loginform .userform input[type="text"],
body:not(.painel) #loginform .userform input[type="password"] {
    border: 2px solid #334155;
    background: #2d3748;
    color: #f8fafc;
}
body:not(.painel) .erro {
    background: #7f1d1d;
    border: 1px solid #ef4444;
    color: #fecaca;
}
body:not(.painel) .sucesso {
    background: #14532d;
    border: 1px solid #16a34a;
    color: #bbf7d0;
}
body:not(.painel) .alerta {
    background: #78350f;
    border: 1px solid #d97706;
    color: #fef3c7;
}

/* Content Forms (DARK MODE) */
body.painel.dark-mode #content .userform fieldset,
body.painel.dark-mode #content .clienteform fieldset {
  border: 2px solid #334155;
  background: #1a202c;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Preview Box Dark Mode */
body.painel.dark-mode .preview-box {
  background: #1a202c !important; 
  border-color: #334155 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.2) !important; 
}
body.painel.dark-mode .preview-box h4 {
    color: #90caf9 !important;
}
body.painel.dark-mode .preview-box p#preview-help {
    color: #94a3b8 !important;
}

/* TinyMCE UI Dark Mode Overrides (Toolbar, Statusbar, Menus) */
body.painel.dark-mode .tox-tinymce {
    border-color: #334155 !important;
    border-radius: 8px;
    box-shadow: none !important;
}

body.painel.dark-mode .tox .tox-editor-header,
body.painel.dark-mode .tox .tox-toolbar-overlord,
body.painel.dark-mode .tox .tox-toolbar,
body.painel.dark-mode .tox .tox-statusbar,
body.painel.dark-mode .tox-menubar {
    background-color: #1a202c !important; /* Header/Toolbar Background */
    color: #f8fafc !important; /* Text color */
    border-color: #334155 !important;
}

body.painel.dark-mode .tox .tox-tbtn,
body.painel.dark-mode .tox .tox-tbtn svg,
body.painel.dark-mode .tox .tox-icon,
body.painel.dark-mode .tox .tox-collection__item-label,
body.painel.dark-mode .tox .tox-collection__item-caret {
    color: #f8fafc !important; /* Icon and menu item color */
}

body.painel.dark-mode .tox .tox-tbtn:hover {
    background-color: #2d3748 !important; /* Hover background */
}

body.painel.dark-mode .tox .tox-tbtn--enabled {
    background-color: #4a5568 !important; /* Active button background */
}

body.painel.dark-mode .tox .tox-collection__item:hover,
body.painel.dark-mode .tox .tox-menu-nav__js:hover {
    background-color: #4a5568 !important;
}

body.painel.dark-mode .tox-statusbar__text {
    color: #94a3b8 !important; /* Status bar text color */
}

/* Fix for popups, menus, and context menus */
body.painel.dark-mode .tox-silver-sink .tox-menu,
body.painel.dark-mode .tox-silver-sink .tox-listbox,
body.painel.dark-mode .tox-silver-sink .tox-pop,
body.painel.dark-mode .tox-silver-sink .tox-collection--toolbar {
    background-color: #1a202c !important; 
    border: 1px solid #334155 !important;
}

body.painel.dark-mode .tox-toolbar__group {
    border-right-color: #334155 !important;
}
/* Fim TinyMCE Overrides */


body.painel.dark-mode #content .userform legend,
body.painel.dark-mode #content .clienteform legend {
  color: #90caf9;
}
body.painel.dark-mode #content .userform li,
body.painel.dark-mode #content .clienteform li {
  border-bottom: 1px dashed #334155;
}
body.painel.dark-mode #content .userform li ul {
  background: #2d3748;
}
body.painel.dark-mode #content .userform label.user,
body.painel.dark-mode #content .clienteform label.user {
  color: #f8fafc;
}
body.painel.dark-mode #content .userform input[type="text"],
body.painel.dark-mode #content .userform input[type="text2"],
body.painel.dark-mode #content .userform input[type="email"],
body.painel.dark-mode #content .userform input[type="password"],
body.painel.dark-mode #content .clienteform input[type="text"],
body.painel.dark-mode #content .userform textarea, 
body.painel.dark-mode #content .userform select,
body.painel.dark-mode #content .userform .modern-select,
body.painel.dark-mode #content .clienteform .modern-select {
  border: 2px solid #334155;
  background: #2d3748;
  color: #f8fafc;
}

body.painel.dark-mode #content .userform input:disabled,
body.painel.dark-mode #content .userform textarea:disabled,
body.painel.dark-mode #content .userform select:disabled,
body.painel.dark-mode #content .clienteform input:disabled {
  background: #334155;
  color: #94a3b8;
  border-color: #334155;
}
body.painel.dark-mode .userform input[type="text"]:focus,
body.painel.dark-mode .userform input[type="password"]:focus,
body.painel.dark-mode #content .userform .modern-select:focus,
body.painel.dark-mode #content .clienteform .modern-select:focus {
  box-shadow: 0 0 0 4px rgba(87, 147, 251, 0.3);
  border-color: #90caf9; /* Cor de foco mais clara */
}


/* ==========================================================================
    RESPONSIVE
    ========================================================================== */
@media (max-width: 768px) {
  #wrap-content {
    flex-direction: column;
    padding: 16px;
  }
  #sidebar {
    width: 100%;
    order: 2;
  }
  #header {
    padding: 0 16px;
  }
  #header h1 {
    font-size: 20px;
  }
  .userlogado {
    right: 16px;
  }
  #content {
    padding: 16px;
  }
}

/* ==========================================================================
    ANIMATIONS
    ========================================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#content,
#loginform {
  animation: fadeInUp 0.6s ease;
}

/* LOADING */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #5793fb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

















/* CSS para o widget de visitantes */
.online-widget-container {
    width: 100%;
    margin-bottom: 20px;
    clear: both;
}

.online-widget {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 20px;
    width: 250px;
    float: left;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.widget-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.widget-count {
    font-size: 3em;
    font-weight: bold;
    color: #007bff; /* Cor primária do seu sistema */
    margin: 5px 0;
}

.widget-info {
    font-size: 0.8em;
    color: #999;
}
