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

  --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: var(--background-dark-mode-menu-lateral);
  --sidebar-l1-icon-dark: var(--text-light);
  --sidebar-l1-hover-bg-dark: var(--surface-hover);
  --sidebar-l1-active-text-dark: var(--primary-light);
  --sidebar-l1-bg: #1a1a1a;
}

.main-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-l1-width);
  right: 0;
  height: var(--header-height);
  z-index: 1000;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  transition: left 0.3s ease;
}

html.dark-theme .main-header {
  background-color: var(--background-dark-mode-menu-lateral);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-bottom: none;
}

/**/
.sidebar-l1 {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-l1-width);
  height: 100vh;
  z-index: 999;
  padding-top: 10px;
  background-color: var(--sidebar-l1-bg);
  /*border-right: 1px solid var(--text-thowine-light);*/
}

html.dark-theme .sidebar-l1 {
  background-color: var(--background-dark-mode-menu-lateral);
  border-right: none;
}

html.l2-is-open .main-header {
  left: calc(var(--sidebar-l1-width) + var(--sidebar-l2-width));
}

html.l2-is-closing .main-header {
  left: var(--sidebar-l1-width);
  transition: left 0.3s ease;
}

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

.header-left .logo {
  display: flex;
  align-items: center;
  margin-left: 10px;
  color: var(--text);
  font-size: 1.2rem;
  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;
  flex-direction: row-reverse;
  align-items: center;
  gap: 8px;
}

.user-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0px;
}

.user-name::after {
  content: ",";
  font-weight: 500;
  color: var(--text-light);
  margin-right: 4px !important;
}

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

.header-right .user-profile .user-info {
  gap: 0 !important;
}

.user-avatar.global-user-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--primary-light);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/*
html.dark-theme.l2-is-open .sidebar-l1 {
  border-bottom-right-radius: 0;
  box-shadow: none;
  border-right: none;
}

.l2-is-open .sidebar-l1 {
  border-right: 1px solid var(--border-dark-mode);
}
*/
.sidebar-l1-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  height: calc(100% - 20px);
  margin: 0;
  padding: 0;
}

.sidebar-l1-menu li {
  position: relative;
  width: 100%;
}

.sidebar-l1-menu li:last-child {
  margin-bottom: 20px;
}

.sidebar-l1-menu .sidebar-privacy-item {
  margin-top: auto;
  margin-bottom: 0;
}

.sidebar-l1-menu a,
.sidebar-l1-menu a:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  text-decoration: none;
  position: relative;
  font-size: 1.4rem;
  color: var(--primary-color);
  transition: all 0.2s ease;
  margin: 2px 10px;
  border-radius: 12px;
}

.sidebar-l1-menu a:hover,
.sidebar-l1-menu a:focus {
  background-color: rgba(193, 44, 176, 0.05);
  transform: scale(1.1);
}

.sidebar-l1-menu a.active::before,
.sidebar-l1-menu a.active::after {
  display: none !important;
}

.sidebar-l2 {
  position: fixed;
  top: 0;
  left: var(--sidebar-l1-width);
  width: var(--sidebar-l2-width);
  height: 100vh;
  z-index: 998;
  background-color: var(--sidebar-l1-bg);
  border-left: none;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  transform: translateX(-100%);
  opacity: 1;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s 0.3s,
    box-shadow 0.3s linear;
  will-change: transform;
}

html.l2-is-open .sidebar-l2 {
  visibility: visible;
  transform: translateX(0);
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s;
}

html.l2-is-closing .sidebar-l2-header,
html.l2-is-closing .sidebar-l2-content {
  opacity: 0;
  box-shadow: none !important;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease,
    visibility 0s 0.3s;
}

.sidebar-l2-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px 0 20px;
  height: var(--header-height);
  flex-shrink: 0;
  /*border-bottom: 1px solid var(--text-thowine-light);*/
}

.sidebar-l2-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-thowine-light);
}

.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;
  margin: 2px 0 2px 15px;
  padding: 10px 20px;
  color: var(--text-thowine-light);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 20px 0 0 20px;
  position: relative;
  transition: all 0.2s ease;
}

.sidebar-l2-content a:hover,
.sidebar-l2-content a:focus {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--primary-color);
}
.sidebar-l2-content a i {
  min-width: 25px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-lighter);
  margin-right: 10px;
}

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

.sidebar-l2-content a.active {
  background-color: var(--background-main);
  color: var(--primary-color);
  margin-left: 15px;
  border-radius: 20px 0 0 20px;
  position: relative;
  z-index: 2;
}

.sidebar-l2-content a.active::before {
  content: "";
  position: absolute;
  top: -20px;
  right: 0;
  width: 20px;
  height: 20px;
  background: radial-gradient(
    circle at 0 0,
    transparent 20px,
    var(--sidebar-l1-bg) 21px
  );
  pointer-events: none;
}

.sidebar-l2-content a.active::after {
  content: "";
  position: absolute;
  bottom: -20px;
  right: 0;
  width: 20px;
  height: 20px;
  background: radial-gradient(
    circle at 0 100%,
    transparent 20px,
    var(--sidebar-l1-bg) 21px
  );
}

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

.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-thowine-light);
}

.submenu-back-header {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
  background-color: transparent;
  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-thowine-light);
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
  flex-shrink: 0;
}

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

.submenu-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-thowine-light);
  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-color);
}

.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-color);
}

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

html.dark-theme .submenu-back-header {
  background-color: transparent;
  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-color);
  background-color: var(--surface-hover);
}

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

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

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

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

html.dark-theme .submenu-horizontal li a:hover i {
  color: var(--primary-color);
}
/*
html.dark-theme .sidebar-l1 {
  background-color: var(--background-dark-mode-menu-lateral);
}*/

html.dark-theme .sidebar-l1-menu a {
  color: var(--primary-color);
}

html.dark-theme .sidebar-l1-menu a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
}

html.dark-theme .sidebar-l1-menu a.active {
  background-color: rgba(255, 255, 255, 0.05);
}

html.dark-theme .sidebar-l2 {
  background-color: var(--background-dark-mode-menu-lateral);
}

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 {
  background-color: var(--surface-hover);
}

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

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

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-color);
}

html.dark-theme .sidebar-l2-content a.active {
  background-color: var(--background-dark-mode-menu-lateral);
  box-shadow:
    inset 0px 4px 5px -4px rgba(0, 0, 0, 0.5),
    inset 0px -4px 5px -4px rgba(0, 0, 0, 0.5);
}

html.dark-theme .sidebar-l2-content a.active::before {
  background: radial-gradient(
    circle at 0 0,
    transparent 18px,
    rgba(0, 0, 0, 0.3) 19.5px,
    var(--background-dark-mode-menu-lateral) 20.5px,
    var(--background-dark-mode-menu-lateral) 100%
  );
}

html.dark-theme .sidebar-l2-content a.active::after {
  background: radial-gradient(
    circle at 0 100%,
    transparent 18px,
    rgba(0, 0, 0, 0.3) 19.5px,
    var(--background-dark-mode-menu-lateral) 20.5px,
    var(--background-dark-mode-menu-lateral) 100%
  );
}
/*

html.dark-theme .sidebar-l2-footer {
  border-top-color: var(--border-dark-mode);
}
*/

html.l2-is-open .main-content {
  margin-left: calc(var(--sidebar-l1-width) + var(--sidebar-l2-width));
}

/* Esses favorites sao do menu l1 por portal */
.sidebar-l2-content li {
  position: relative;
  display: flex;
  align-items: center;
  margin: 2px 0;
}

.sidebar-l2-content li a {
  flex-grow: 1;
  margin: 0 0 0 15px;
  padding-right: 40px;
  color: var(--text-thowine-light);
}

.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(--primary-color);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  transition: color 0.2s ease;
  z-index: 3;
}
.favorite-toggle:hover {
  color: var(--warning);
}
.favorite-toggle .fas.fa-star {
  color: var(--warning);
}
.favorite-toggle .fa-spinner {
  color: var(--primary-color);
}

.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;
}

#btn-hamburger .fa-times {
  display: none;
}

html.l2-is-open #btn-hamburger .fa-bars {
  display: none;
}

html.l2-is-open #btn-hamburger .fa-times {
  display: block;
}
