:root {
  --header-height: 60px;
  --sidebar-l1-width: 65px;
  --sidebar-l2-width: 270px;
  --top-toggle-height: 50px;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary: #475569;

  --background: #f1f5f9; 
  --surface: #ffffff; 
  --surface-hover: #f8fafc;

  --error: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;

  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;

  --sidebar-l2-bg-light: var(--surface);
  --sidebar-l2-text-light: var(--text-light);
  --sidebar-l2-icon-light: var(--text-lighter);
  --sidebar-l2-hover-bg-light: var(--surface-hover);
  --sidebar-l2-active-text-light: var(--primary);
  --sidebar-l2-border-light: var(--border);

  --sidebar-l1-bg-dark: #212121;
  --sidebar-l1-icon-dark: var(--text-light);
  --sidebar-l1-hover-bg-dark: var(--surface-hover);
  --sidebar-l1-active-text-dark: var(--primary-light);

  /* esse eu uso para botoes de limpar inputs */
  --btn-primary-spa: #2563eb;
  --btn-primary-hover-spa:#3b82f6;
  

  --btn-secondary-spa: #708090;
 /* --btn-secondary-hover-spa:#71797E;*/

  --text-btn-spa: #1e293b;

}

html.dark-theme {
  --background: #1a1a1a;
  --surface: #2a2a2a;
  --surface-hover: #3a3a3a;

  --text: #f0f0f0;
  --text-light: #b0b0b0;
  --text-lighter: #888888;
  --border: #444444;

  --sidebar-l1-bg-dark: var(--surface);
  --sidebar-l1-hover-bg-dark: var(--surface-hover);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow-x: hidden;
  background-color: var(--background);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
}

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

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
}

.header-left .logo {
  display: flex;
  align-items: center;
  margin-left: 10px;
  color: var(--text);
  font-size: 1.2em;
  font-weight: 600;
}

.header-left .logo i {
  margin-right: 8px;
  color: var(--primary);
}

.menu-toggle {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right .user-profile {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.user-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9em;
  margin-right: 10px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  font-size: 0.9em;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  color: var(--text);
}

.user-role {
  color: var(--text-light);
  font-size: 0.85em;
}

.sidebar-l1 {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-l1-width);
  height: calc(100vh - var(--header-height));
  z-index: 999;
  padding-top: 10px;
  transition: background-color 0.3s ease;

  background-color: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-l1-menu {
  list-style: none;
}

.sidebar-l1-menu a,
.sidebar-l1-menu a:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  text-decoration: none;
  position: relative;
  font-size: 1.4rem;
  transition: color 0.2s ease, background-color 0.2s ease;

  color: var(--text-light);
}

.sidebar-l1-menu a:hover,
.sidebar-l1-menu a:focus {
  background-color: var(--surface-hover);
  color: var(--primary);
}

.sidebar-l1-menu a.active {
  color: var(--primary);
  background-color: transparent;
}

.sidebar-l2 {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-l1-width);
  width: var(--sidebar-l2-width);
  height: calc(100vh - var(--header-height));
  z-index: 998;

  background-color: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);

  display: flex;
  flex-direction: column;

  visibility: hidden;
  transform: translateX(-100%);
  transition: transform 0.3s ease, visibility 0s 0.3s,
    background-color 0.3s ease;
}

.sidebar-l2-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px 0 20px;
  height: var(--top-toggle-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

.sidebar-l2-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.3s ease;
}

.sidebar-l2-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.sidebar-l2-close:hover {
  color: var(--text);
  background-color: var(--surface-hover);
}

.sidebar-l2-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 0;
  overflow-x: hidden;
}

.sidebar-l2-content ul {
  list-style: none;
}

.sidebar-l2-content a,
.sidebar-l2-content a:visited {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.sidebar-l2-content a:hover,
.sidebar-l2-content a:focus {
  background-color: var(--surface-hover);
  color: var(--primary);
}

.sidebar-l2-content a.active {
  color: var(--primary);
  font-weight: 600;
}

.sidebar-l2-content a i {
  min-width: 25px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-lighter);
  margin-right: 10px;
  transition: color 0.2s ease;
}

.sidebar-l2-content a:hover i,
.sidebar-l2-content a.active i {
  color: var(--primary);
}

.sidebar-l2-content .submenu {
  max-height: 0;
  overflow: hidden;
  list-style: none;
  padding-left: 15px;
  transition: max-height 0.3s ease-out;
  background-color: transparent;
}

.sidebar-l2-content .has-submenu.open > .submenu {
  max-height: 500px;
}

.sidebar-l2-content .submenu li a {
  padding-left: 30px;
  font-size: 0.9rem;
}

.sidebar-l2-footer {
  flex-shrink: 0;
  padding: 15px 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-lighter);
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  transition: border-color 0.3s ease, color 0.3s ease,
  background-color 0.3s ease;
}

.main-content {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-l1-width);
  padding: 20px;
  height: calc(100vh - var(--header-height));
  transition: margin-left 0.3s ease;
  overflow: auto;
}

html.l2-is-open .sidebar-l2 {
  visibility: visible;
  transform: translateX(0);
  transition: transform 0.3s ease, visibility 0s;
}
html.l2-is-open .main-content {
  margin-left: calc(var(--sidebar-l1-width) + var(--sidebar-l2-width));
}
html.l2-is-closing .sidebar-l2 {
  visibility: visible;
  transform: translateX(-100%);
  transition: transform 0.3s ease, visibility 0s 0.3s;
}

html.dark-theme body {
  background-color: var(--background);
  color: var(--text);
}

html.dark-theme .main-header {
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border-bottom-color: var(--border);
}

html.dark-theme .header-left .logo {
  color: var(--text);
}

html.dark-theme .user-name {
  color: var(--text);
}

html.dark-theme .user-role {
  color: var(--text-light);
}

html.dark-theme .sidebar-l1 {
  background-color: var(--surface);
  border-right-color: var(--border);
}

html.dark-theme .sidebar-l1-menu a,
html.dark-theme .sidebar-l1-menu a:visited {
  color: var(--text-light);
}

html.dark-theme .sidebar-l1-menu a:hover,
html.dark-theme .sidebar-l1-menu a:focus {
  background-color: var(--surface-hover);
  color: var(--text);
}

html.dark-theme .sidebar-l2 {
  background-color: var(--surface);
  border-right-color: var(--border);
}

html.dark-theme .sidebar-l2-header {
  border-bottom-color: var(--border);
}

html.dark-theme .sidebar-l2-header h3 {
  color: var(--text);
}

html.dark-theme .sidebar-l2-close {
  color: var(--text-light);
}

html.dark-theme .sidebar-l2-close:hover {
  color: var(--text);
  background-color: var(--surface-hover);
}

html.dark-theme .sidebar-l2-content a,
html.dark-theme .sidebar-l2-content a:visited {
  color: var(--text-light);
}

html.dark-theme .sidebar-l2-content a:hover,
html.dark-theme .sidebar-l2-content a:focus {
  background-color: var(--surface-hover);
  color: var(--primary);
}

html.dark-theme .sidebar-l2-content a i {
  color: var(--text-lighter);
}

html.dark-theme .sidebar-l2-content a:hover i,
html.dark-theme .sidebar-l2-content a.active i {
  color: var(--primary);
}

html.dark-theme .sidebar-l2-content .submenu {
  background-color: transparent;
}

html.dark-theme .sidebar-l2-footer {
  color: var(--text-lighter);
  border-top-color: var(--border);
  background-color: var(--surface);
}

.user-name,
.user-role {
  display: block;
  min-height: 1.2em;
  min-width: 100px;
}

.sidebar-l2-content li {
  position: relative;
  display: flex;
  align-items: center;
  margin: 2px 8px;
}

.sidebar-l2-content li a {
  flex-grow: 1;
  margin: 0;
  padding-right: 40px;
}

.favorite-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 0.95rem;
  padding: 5px;
  cursor: pointer;
  color: var(--text-lighter);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  transition: color 0.2s ease;
}

.favorite-toggle:hover {
  color: var(--warning);
}

.favorite-toggle .fas.fa-star {
  color: var(--warning);
}

.favorite-toggle .fa-spinner {
  color: var(--primary);
}

.l2-loading,
.l2-empty-state {
  padding: 40px 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

html.dark-theme .favorite-toggle {
  color: var(--text-lighter);
}

html.dark-theme .favorite-toggle:hover {
  color: var(--warning);
}

html.dark-theme .favorite-toggle .fas.fa-star {
  color: var(--warning);
}

html.dark-theme .l2-loading,
html.dark-theme .l2-empty-state {
  color: var(--text-light);
}

html {
  scrollbar-color: var(--border) var(--surface-hover);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-hover);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
  border: 2px solid var(--surface-hover);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-lighter);
}

.sidebar-l2-content li.has-submenu {
  display: block;
  position: relative;
}

.sidebar-l2-content li.has-submenu > a {
  display: flex;
  align-items: center;
}

.sidebar-l2-content li.has-submenu > .submenu {
  width: 100%;
  box-sizing: border-box;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.toast {
  display: flex;
  align-items: flex-start;
  width: 100%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: toast-slide-in 0.3s ease-out forwards;
}

.toast-icon {
  flex-shrink: 0;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}

.toast.success .toast-icon {
  background-color: var(--success);
}
.toast.error .toast-icon {
  background-color: var(--error);
}
.toast.warning .toast-icon {
  background-color: var(--warning);
}
.toast.info .toast-icon {
  background-color: var(--primary);
}

.toast-content {
  flex-grow: 1;
  padding: 12px;
}
.toast-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 3px;
}
.toast-message {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  font-size: 0.9rem;
  color: var(--text-lighter);
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
  color: var(--text);
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.slide-out {
  animation: toast-slide-out 0.4s ease-in forwards;
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.theme-toggle-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  margin: 0;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-light);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle-button:hover,
.theme-toggle-button:focus {
  color: var(--text);
  background-color: var(--surface-hover);
}

.theme-toggle-button .theme-icon-sun {
  display: none;
}

.theme-toggle-button .theme-icon-moon {
  display: block;
}

html.dark-theme .theme-toggle-button .theme-icon-sun {
  display: block;
  color: var(--warning);
}

html.dark-theme .theme-toggle-button .theme-icon-moon {
  display: none;
}

html.dark-theme .main-header .theme-toggle-button {
  color: var(--text-light);
}

html.dark-theme .main-header .theme-toggle-button:hover,
html.dark-theme .main-header .theme-toggle-button:focus {
  color: var(--text);
  background-color: var(--surface-hover);
}

.submenu-back-header {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
  margin-bottom: 10px;
  gap: 12px;
}

.submenu-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-light);
  transition: color 0.2s ease, background-color 0.2s ease;
  flex-shrink: 0;
}

.submenu-back-btn:hover {
  color: var(--primary);
  background-color: var(--surface-hover);
}

.submenu-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex-grow: 1;
}

.submenu-horizontal {
  list-style: none;
  padding: 0;
  margin: 0;
}

.submenu-horizontal li {
  position: relative;
  display: flex;
  align-items: center;
  margin: 2px 8px;
}

.submenu-horizontal li a {
  flex-grow: 1;
  margin: 0;
  padding: 10px 20px;
  padding-right: 40px;
  display: flex;
  align-items: center;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.submenu-horizontal li a:hover {
  background-color: var(--surface-hover);
  color: var(--primary);
}

.submenu-horizontal li a i {
  min-width: 25px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-lighter);
  margin-right: 10px;
  transition: color 0.2s ease;
}

.submenu-horizontal li a:hover i {
  color: var(--primary);
}

.submenu-horizontal li .favorite-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

html.dark-theme .submenu-back-header {
  background-color: var(--surface);
  border-bottom-color: var(--border);
}

html.dark-theme .submenu-back-btn {
  color: var(--text-light);
}

html.dark-theme .submenu-back-btn:hover {
  color: var(--primary);
  background-color: var(--surface-hover);
}

html.dark-theme .submenu-title {
  color: var(--text);
}

html.dark-theme .submenu-horizontal li a {
  color: var(--text-light);
}

html.dark-theme .submenu-horizontal li a:hover {
  background-color: var(--surface-hover);
  color: var(--primary);
}

html.dark-theme .submenu-horizontal li a i {
  color: var(--text-lighter);
}

html.dark-theme .submenu-horizontal li a:hover i {
  color: var(--primary);
}