﻿/* Menu lateral compartilhado entre as páginas da Torre */
:root {
  --transition: all 0.3s ease;
  --sidebar-width-expanded: 256px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 80px;
  --topbar-height-expanded: 176px;
}

body[data-menu-layout="torre"] {
  --bg-primary: #f9fafb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f3f4f6;
  --bg-accent-moto: rgba(239, 68, 68, 0.15);
  --bg-accent-carro: rgba(59, 130, 246, 0.15);
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --border-accent-moto: rgba(239, 68, 68, 0.3);
  --border-accent-carro: rgba(59, 130, 246, 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --accent-moto: #ef4444;
  --accent-carro: #3b82f6;
}

body[data-menu-layout="torre"][data-theme="dark"],
body[data-menu-layout="torre"].dark {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --bg-accent-moto: rgba(239, 68, 68, 0.1);
  --bg-accent-carro: rgba(59, 130, 246, 0.1);
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --border-accent-moto: #7f1d1d;
  --border-accent-carro: #1e3a8a;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  --accent-moto: #ef4444;
  --accent-carro: #3b82f6;
}

[data-menu-layout="torre"] #root {
  min-height: 100vh;
}

/* Barra lateral */
[data-menu-layout="torre"] .barra-lateral {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

[data-menu-layout="torre"] .barra-lateral.expandida {
  width: var(--sidebar-width-expanded);
}

[data-menu-layout="torre"] .barra-lateral.recolhida {
  width: var(--sidebar-width-collapsed);
}

[data-menu-layout="torre"] .barra-lateral .cabecalho,
[data-menu-layout="torre"] .barra-lateral .rodape {
  border-color: var(--border-color);
}

[data-menu-layout="torre"] .barra-lateral .cabecalho {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

[data-menu-layout="torre"] #cabecalhoExpandido {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

[data-menu-layout="torre"] #cabecalhoRecolhido {
  display: none;
}

[data-menu-layout="torre"] .barra-lateral.expandida .logo-expandida {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  animation: floatAnimation 4s ease-in-out infinite;
}

[data-menu-layout="torre"] .barra-lateral.recolhida .logo-recolhida {
  width: 32px;
  height: 32px;
  margin: 0 auto;
  animation: none;
}

[data-menu-layout="torre"] .barra-lateral.recolhida #cabecalhoExpandido {
  display: none !important;
}

[data-menu-layout="torre"] .barra-lateral.recolhida #cabecalhoRecolhido {
  display: flex !important;
}

[data-menu-layout="torre"] .cabecalho-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

[data-menu-layout="torre"] .barra-lateral.recolhida .cabecalho-toggle {
  justify-content: flex-start;
}

[data-menu-layout="torre"] .barra-lateral.recolhida .cabecalho {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  padding-bottom: 0.5rem;
}

[data-menu-layout="torre"] .barra-lateral.recolhida .menu-lateral-container {
  padding-top: 0.5rem;
}

@keyframes floatAnimation {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Conteúdo principal */
[data-menu-layout="torre"] .conteudo-principal {
  background-color: var(--bg-primary);
  transition: var(--transition);
  width: calc(100vw / var(--app-scale, 1));
  max-width: calc(100vw / var(--app-scale, 1));
}

[data-menu-layout="torre"] .conteudo-principal.desktop-expandida {
  margin-left: var(--sidebar-width-expanded);
  width: calc((100vw / var(--app-scale, 1)) - var(--sidebar-width-expanded));
  max-width: calc((100vw / var(--app-scale, 1)) - var(--sidebar-width-expanded));
  box-sizing: border-box;
}

[data-menu-layout="torre"] .conteudo-principal.desktop-recolhida {
  margin-left: var(--sidebar-width-collapsed);
  width: calc((100vw / var(--app-scale, 1)) - var(--sidebar-width-collapsed));
  max-width: calc((100vw / var(--app-scale, 1)) - var(--sidebar-width-collapsed));
  box-sizing: border-box;
}

[data-menu-layout="torre"] .conteudo-principal.mobile {
  margin-left: 0;
}

[data-menu-layout="torre"] .conteudo-principal.mobile-menu-fechado {
  margin-top: var(--topbar-height);
}

[data-menu-layout="torre"] .conteudo-principal.mobile-menu-aberto {
  /* Margin ajustada via JS */
}

/* Barra superior mobile */
[data-menu-layout="torre"] .barra-superior-mobile {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-md);
  height: var(--topbar-height);
  display: none;
  z-index: 3000 !important;
}

[data-menu-layout="torre"] .barra-superior-mobile.expandida {
  height: var(--topbar-height-expanded);
}

[data-menu-layout="torre"] .dropdown-mobile {
  border-color: var(--border-color);
  background-color: var(--bg-secondary);
  display: none;
}

[data-menu-layout="torre"] .dropdown-mobile.visivel {
  display: block;
}

[data-menu-layout="torre"] .dropdown-mobile.oculto {
  display: none !important;
}

/* Tipografia utilitária */
[data-menu-layout="torre"] .texto-primario {
  color: var(--text-primary);
}

[data-menu-layout="torre"] .texto-secundario {
  color: var(--text-secondary);
}

[data-menu-layout="torre"] .texto-silenciado {
  color: var(--text-muted);
}

[data-menu-layout="torre"] .barra-lateral.recolhida .texto-recolhivel {
  display: none;
}

[data-menu-layout="torre"] .barra-lateral.expandida .texto-recolhivel {
  display: block;
}

[data-menu-layout="torre"] .barra-lateral.recolhida .icone-menu {
  margin-left: auto;
  margin-right: auto;
}

[data-menu-layout="torre"] .barra-lateral.expandida .icone-menu {
  margin-right: 0.75rem;
}

/* Botões */
[data-menu-layout="torre"] .botao-hover:hover {
  background-color: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
}

[data-menu-layout="torre"] .botao-moto {
  background-color: var(--accent-moto);
}

[data-menu-layout="torre"] .botao-moto:hover {
  opacity: 0.9;
}

[data-menu-layout="torre"] .botao-carro {
  background-color: var(--accent-carro);
}

[data-menu-layout="torre"] .botao-carro:hover {
  opacity: 0.9;
}

/* Navegação */
[data-menu-layout="torre"] .item-menu,
[data-menu-layout="torre"] .item-menu-mobile {
  border: none;
  background-color: transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--texto-menu, #1f2937);
}

[data-menu-layout="torre"] .item-menu .icone-menu,
[data-menu-layout="torre"] .item-menu span,
[data-menu-layout="torre"] .item-menu-mobile i,
[data-menu-layout="torre"] .item-menu-mobile span {
  transition: var(--transition);
  color: var(--texto-menu, #1f2937);
}

[data-menu-layout="torre"]:not(.dark) .item-menu,
[data-menu-layout="torre"]:not(.dark) .item-menu-mobile {
  --texto-menu: #1f2937;
}

body[data-menu-layout="torre"][data-theme="dark"] .item-menu,
body[data-menu-layout="torre"][data-theme="dark"] .item-menu-mobile,
body[data-menu-layout="torre"].dark .item-menu,
body[data-menu-layout="torre"].dark .item-menu-mobile {
  --texto-menu: #e5e7eb;
}

[data-menu-layout="torre"] .item-menu:hover,
[data-menu-layout="torre"] .item-menu-mobile:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

[data-menu-layout="torre"] .item-menu.ativo,
[data-menu-layout="torre"] .item-menu-mobile.ativo {
  box-shadow: none;
  background: #3a1f39;
}

[data-menu-layout="torre"] .item-menu.ativo .icone-menu,
[data-menu-layout="torre"] .item-menu.ativo span,
[data-menu-layout="torre"] .item-menu-mobile.ativo i,
[data-menu-layout="torre"] .item-menu-mobile.ativo span {
  color: #ff8585 !important;
}

body[data-menu-layout="torre"][data-theme="dark"] .item-menu.ativo,
body[data-menu-layout="torre"][data-theme="dark"] .item-menu-mobile.ativo {
  background: #ff4040;
}

body[data-menu-layout="torre"][data-theme="dark"] .item-menu.ativo .icone-menu,
body[data-menu-layout="torre"][data-theme="dark"] .item-menu.ativo span,
body[data-menu-layout="torre"][data-theme="dark"] .item-menu-mobile.ativo i,
body[data-menu-layout="torre"][data-theme="dark"] .item-menu-mobile.ativo span {
  color: #f8dede !important;
}

body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu.ativo,
body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu-mobile.ativo {
  background: #ffb5b5;
}

body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu.ativo .icone-menu,
body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu.ativo span,
body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu-mobile.ativo i,
body[data-menu-layout="torre"]:not([data-theme="dark"]) .item-menu-mobile.ativo span {
  color: #7a1f1f !important;
}

body[data-menu-layout="torre"][data-theme="dark"] .barra-lateral,
body[data-menu-layout="torre"][data-theme="dark"] .barra-lateral .cabecalho,
body[data-menu-layout="torre"][data-theme="dark"] .barra-lateral .rodape {
  border: none !important;
}

body[data-menu-layout="torre"]:not([data-theme="dark"]) .barra-lateral .cabecalho,
body[data-menu-layout="torre"]:not([data-theme="dark"]) .barra-lateral .rodape {
  border: none !important;
}

body[data-menu-layout="torre"][data-theme="dark"] .card {
  border: none !important;
}

[data-menu-layout="torre"] .card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

[data-menu-layout="torre"] #botaoAlternarBarraLateral {
  position: relative;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 0.75rem;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
}

body[data-menu-layout="torre"]:not([data-theme="dark"]) #botaoAlternarBarraLateral {
  background-color: transparent;
  border: none;
}

body[data-menu-layout="torre"][data-theme="dark"] #botaoAlternarBarraLateral {
  border: none;
  background-color: transparent;
}

[data-menu-layout="torre"] #botaoAlternarBarraLateral:hover {
  background-color: transparent;
  box-shadow: none;
}

body[data-menu-layout="torre"][data-theme="dark"] #botaoAlternarBarraLateral:hover {
  background-color: transparent;
  box-shadow: none;
}

[data-menu-layout="torre"] #botaoAlternarBarraLateral:hover i {
  color: var(--text-primary);
  transform: scale(1.08);
  text-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
}

body[data-menu-layout="torre"][data-theme="dark"] #botaoAlternarBarraLateral:hover i {
  text-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

[data-menu-layout="torre"] #botaoAlternarBarraLateral i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.4rem;
  line-height: 1;
}

[data-menu-layout="torre"] #botaoTemaDesktop .relative,
[data-menu-layout="torre"] #botaoTemaMobile {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

[data-menu-layout="torre"] #botaoTemaDesktop {
  min-height: 44px;
}

[data-menu-layout="torre"] #iconeTemaDesktop,
[data-menu-layout="torre"] #iconeTemaMobile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  line-height: 1;
  transition: transform 0.4s ease, color 0.4s ease;
}

body[data-menu-layout="torre"]:not([data-theme="dark"]) #iconeTemaDesktop,
body[data-menu-layout="torre"]:not([data-theme="dark"]) #iconeTemaMobile {
  animation: temaSunSwap 0.4s ease;
}

body[data-menu-layout="torre"][data-theme="dark"] #iconeTemaDesktop,
body[data-menu-layout="torre"][data-theme="dark"] #iconeTemaMobile {
  animation: temaMoonSwap 0.4s ease;
}

@keyframes temaSunSwap {
  0% {
    transform: rotate(-90deg) scale(0.6);
    opacity: 0;
  }
  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes temaMoonSwap {
  0% {
    transform: rotate(90deg) scale(0.6);
    opacity: 0;
  }
  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

/* Responsividade */
@media (max-width: 768px) {
  [data-menu-layout="torre"] .barra-lateral {
    display: none !important;
  }
  [data-menu-layout="torre"] .barra-superior-mobile {
    display: block !important;
  }

  [data-menu-layout="torre"] .conteudo-principal {
    margin-left: 0 !important;
  }
}

@media (min-width: 768px) {
  [data-menu-layout="torre"] .barra-lateral {
    display: flex !important;
  }

  [data-menu-layout="torre"] .barra-superior-mobile {
    display: none !important;
  }
}
