/* styles.css - Versão Final com Scrollbar Integrada */

:root {
  /* Cores do tema Árvore */
  --primary-dark: #1a2b4c;
  --primary-medium: #2c4a78;
  --primary-light: #4a6741;
  --primary-extra-light: #3a4b3d;
  --accent-blue: #4fc3f7;
  --accent-green: #81c784;
  --accent-orange: #ffb74d;
  --wood-dark: #6d4c41;
  --wood-light: #8d6e63;
  --leaf-green: #4caf50;
  
  /* Cores para scrollbar da sidebar */
  --sidebar-scrollbar-track: rgba(26, 43, 76, 0.2);
  --sidebar-scrollbar-thumb: rgba(79, 195, 247, 0.6);
  --sidebar-scrollbar-thumb-hover: rgba(129, 199, 132, 0.8);
  
  /* Cores gerais */
  --sidebar-bg: #1e3a8a;
  --sidebar-active: #4f46e5;
  --sidebar-highlight: #fbbf24;
  --content-bg: #f9fafb;
  --text-dark: #0f172a;
  --text-medium: #1e293b;
  --text-light: #f9fafb;
  --text-muted: #e0e0e0;
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-scrollbar-thumb) var(--sidebar-scrollbar-track);
}

/* Estrutura principal */
html {
  font-size: 18px;
}

body {
  font-family: 'EB Garamond', serif;
  color: var(--text-dark);
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(to bottom, 
    var(--primary-dark) 0%, 
    var(--primary-medium) 30%, 
    var(--primary-light) 70%, 
    var(--primary-extra-light) 100%);
}

/* CONTAINER PRINCIPAL */
.container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* BARRA LATERAL COM SCROLLBAR PERFEITA */
.sidebar {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  background: linear-gradient(
    to bottom, 
    rgba(30, 58, 138, 0.95),
    rgba(26, 43, 76, 0.95)
  );
  backdrop-filter: blur(12px);
  color: #e2e8f0;
  padding: 2.5rem 1.8rem 2.5rem 2rem;
  overflow-y: overlay;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-right: 1px solid rgba(79, 195, 247, 0.3);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

/* SCROLLBAR DA SIDEBAR - ESTILO PREMIUM */
.sidebar::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--sidebar-scrollbar-track);
  border-radius: 10px;
  margin: 30px 0;
  border: 2px solid transparent;
  background-clip: content-box;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--sidebar-scrollbar-thumb);
  border-radius: 10px;
  border: 2px solid rgba(26, 43, 76, 0.3);
  background-clip: padding-box;
  transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--sidebar-scrollbar-thumb-hover);
  border: 2px solid rgba(79, 195, 247, 0.5);
}

.sidebar::-webkit-scrollbar-corner {
  background: transparent;
}

/* CONTEÚDO DA SIDEBAR */
.sidebar h2 {
  color: #4fc3f7;
  border-bottom: 1px solid rgba(79, 195, 247, 0.4);
  padding-bottom: 16px;
  margin: 28px 0 22px;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sidebar a {
  display: flex;
  align-items: center;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 1.25rem;
  transition: all 0.3s ease;
  margin-bottom: 14px;
  border-radius: 10px;
  padding: 16px 20px;
  background: rgba(79, 70, 229, 0.1);
}

.sidebar a:hover {
  background: rgba(79, 70, 229, 0.25);
  transform: translateX(8px);
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

.sidebar a.active {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.4), transparent);
  border-left: 5px solid #fbbf24;
  font-weight: 500;
}

/* REMOVIDO: Setinhas da sidebar */
/* .sidebar a::before {
  content: '→';
  margin-right: 12px;
  color: #fbbf24;
  transition: all 0.3s ease;
}

.sidebar a:hover::before {
  transform: translateX(5px);
} */

/* ÁREA DE CONTEÚDO PRINCIPAL */
.content {
  flex: 1;
  height: 100vh;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  color: #e2e8f0;
  overflow-y: auto;
  position: relative;
}

/* SCROLLBAR DO CONTEÚDO PRINCIPAL */
.content::-webkit-scrollbar {
  width: 12px;
}

.content::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.content::-webkit-scrollbar-thumb {
  background: rgba(79, 195, 247, 0.5);
  border-radius: 6px;
  border: 2px solid rgba(15, 23, 42, 0.6);
}

.content::-webkit-scrollbar-thumb:hover {
  background: rgba(129, 199, 132, 0.6);
}

/* CONTAINER DE LEITURA */
.reading-container {
  padding: 2.5rem 3rem;
  min-height: 100%;
  line-height: 1.8;
  color: rgba(226, 232, 240, 0.98);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* TIPOGRAFIA */
.reading-container p {
  font-size: 1.25rem;
  margin-bottom: 1.8rem;
  text-align: justify;
  hyphens: auto;
  letter-spacing: 0.02rem;
  max-width: 100%;
}

.reading-container h1, 
.reading-container h2, 
.reading-container h3 {
  color: #e2e8f0;
  margin-top: 2.5rem;
  margin-bottom: 1.8rem;
  line-height: 1.4;
  max-width: 100%;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.reading-container h1 {
  font-size: 3rem;
}

.reading-container h2 {
  font-size: 2.5rem;
}

.reading-container h3 {
  font-size: 2rem;
}

/* Elementos matemáticos */
.equation {
  background: rgba(0, 0, 0, 0.3);
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem 0;
  border-left: 4px solid var(--accent-blue);
  text-align: center;
  font-size: 1.4rem;
  overflow-x: auto;
  max-width: 100%;
}

.theorem {
  background: rgba(79, 195, 247, 0.1);
  border-left: 4px solid var(--accent-blue);
  padding: 2rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
  max-width: 100%;
}

.theorem-title {
  color: var(--accent-green);
  font-weight: bold;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Botão do menu (mobile) */
#toggleMenuBtn {
  position: fixed;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 1000;
  background: var(--primary-dark);
  color: var(--text-light);
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
}

#toggleMenuBtn:hover {
  background: var(--sidebar-active);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* RESPONSIVIDADE MOBILE */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }
  
  .container {
    position: relative;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    transform: translateX(-100%);
    box-shadow: 5px 0 25px rgba(0,0,0,0.4);
    width: 340px;
    padding: 2rem 1.6rem 2rem 1.8rem;
  }
  
  .sidebar-visible .sidebar {
    transform: translateX(0);
  }
  
  .content {
    width: 100%;
    flex: none;
    padding: 1.5rem;
  }
  
  .reading-container {
    padding: 1.5rem;
    max-width: 100%;
  }
  
  .sidebar a {
    font-size: 1.2rem;
    padding: 14px 18px;
  }
  
  #toggleMenuBtn {
    display: block;
  }
  
  /* Ajuste da scrollbar no mobile */
  .sidebar::-webkit-scrollbar {
    width: 8px;
  }
}

/* Desktop - garantindo que funcione */
@media (min-width: 769px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
  }
  
  #toggleMenuBtn {
    display: none;
  }
}

/* Estilos para impressão */
@media print {
  html {
    font-size: 12pt;
  }
  
  .sidebar,
  #toggleMenuBtn {
    display: none !important;
  }
  
  .container {
    display: block;
  }
  
  .content {
    width: 100% !important;
    background: white !important;
    color: black !important;
    padding: 0 !important;
  }
  
  .reading-container {
    background: white !important;
    color: black !important;
    padding: 1rem !important;
    max-width: 100% !important;
  }
}

/* Animações */
.sidebar-loaded {
  animation: sidebarFadeIn 0.5s ease-out forwards;
}

@keyframes sidebarFadeIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.menu-active {
  background: #4fc3f7 !important;
  transform: rotate(90deg) !important;
}

.active-highlight {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  margin-right: 10px;
  box-shadow: 0 0 8px #fbbf24;
}

/* Elementos específicos do diagrama */
.mermaid {
  font-size: 1.3rem;
  margin: 2.5rem auto;
  max-width: 900px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}


/* Container principal */
.simulation-link-container {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 8px;
  border-left: 4px solid var(--accent-blue);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Título */
.simulation-title {
  color: var(--accent-blue);
  margin-bottom: 1.2rem;
  font-size: 1.4rem;
  border-bottom: 1px solid rgba(79, 195, 247, 0.3);
  padding-bottom: 0.5rem;
}

/* Links estilizados */
.simulation-link {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.2rem;
  margin: 0.6rem 0;
  background: rgba(79, 195, 247, 0.1);
  border-radius: 6px;
  color: var(--accent-blue);
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid rgba(79, 195, 247, 0.2);
}

.simulation-link:hover {
  background: rgba(79, 195, 247, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 2px 10px rgba(79, 195, 247, 0.2);
}

/* Elementos do link */
.simulation-icon {
  font-size: 1.3rem;
  margin-right: 12px;
  opacity: 0.8;
}

.simulation-text {
  flex-grow: 1;
  font-size: 1.1rem;
}

.simulation-arrow {
  font-size: 1.2rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.simulation-link:hover .simulation-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* Responsividade */
@media (max-width: 768px) {
  .simulation-link-container {
    padding: 1rem;
  }
  
  .simulation-link {
    padding: 0.7rem 1rem;
  }
  
  .simulation-text {
    font-size: 1rem;
  }
}

.debug-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 100;
}