/**
 * SERWERCALC - Manual de Utilização
 * Estilos principais para a aplicação
 * Versão: 1.1
 * Autor: Eng. Wanderilo Lima
 */

/* =============================================
   1. VARIÁVEIS GLOBAIS
   ============================================= */
:root {
  /* Cores principais */
  --ocre-dark: #8B6B3D;
  --ocre-medium: #B38B5B;
  --ocre-light: #D4B483;
  --ocre-very-light: #F0E0C1;
  --accent-color: #030302;
  
  /* Cores de texto */
  --text-dark: #3E3A34;
  --text-medium: #5A5349;
  --text-light: #7A7267;
  
  /* Efeitos visuais */
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 6px 15px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.15);
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Medidas */
  --border-radius: 12px;
  --spacing: 1.6rem;
  --sidebar-width: 350px;
}

/* =============================================
   2. RESET E ESTILOS BASE
   ============================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.8;
  color: var(--text-dark);
  background-color: #F8F5F0;
  background-image: url('../media/texture.png');
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* =============================================
   3. LAYOUT PRINCIPAL
   ============================================= */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 4rem;
}

.main-content {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 3rem;
  position: relative;
}

@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
    padding-bottom: 3rem;
  }
}

/* =============================================
   4. CABEÇALHO
   ============================================= */
header {
  position: relative;
  background:
    linear-gradient(rgba(139, 107, 61, 0.7), rgba(139, 107, 61, 0.7)),
    url('../media/imagetitle.png') center/cover no-repeat;
  color: white;
  padding: 6rem 1.5rem 5rem;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: center;
  z-index: 1;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(0,0,0,0.3) 100%);
  z-index: -1;
}

.header-content h1 {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
  margin-bottom: 0.6rem;
  user-select: none;
  position: relative;
  display: inline-block;
}

.header-content h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--ocre-very-light);
  border-radius: 2px;
}

.header-content .subtitle {
  font-size: 1.3rem;
  font-weight: 300;
  max-width: 680px;
  margin: 0 auto;
  color: var(--ocre-very-light);
  font-style: italic;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* =============================================
   5. BARRA LATERAL
   ============================================= */
.sidebar {
  position: sticky;
  top: 20px;
  background: #fff;
  border-radius: var(--border-radius);
  padding: 1.8rem 1.2rem;
  box-shadow: var(--shadow-md);
  border: 1.5px solid var(--ocre-light);
  font-size: 0.9rem;
  height: fit-content;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ocre-light) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--ocre-light);
  border-radius: 3px;
}

.sidebar h3 {
  font-family: 'Poppins', sans-serif;
  color: var(--ocre-dark);
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 3px solid var(--ocre-light);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar h3 i {
  font-size: 1rem;
}

/* Estilos para os ícones do cabeçalho */
.header-icon {
  height: 0.8em; /* Tamanho reduzido */
  vertical-align: middle;
  filter: 
    drop-shadow(0 2px 2px rgba(0,0,0,0.3)) /* Sombra suave */
    drop-shadow(0 1px 1px rgba(0,0,0,0.2)); /* Sombra adicional para profundidade */
  transition: all 0.3s ease;
}

.left-icon {
  margin-right: 0.4rem;
}

.right-icon {
  margin-left: 0.4rem;
}

/* Efeito hover opcional */
.header-icon:hover {
  filter: 
    drop-shadow(0 3px 3px rgba(0,0,0,0.25))
    drop-shadow(0 2px 2px rgba(0,0,0,0.15));
  transform: scale(1.05);
}

/* Ajuste para o título com ícones */
.header-content h1 {
  display: flex;
  align-items: center;
  justify-content: center;
}
#typing-text {
  display: inline-block;
  min-width: 180px; /* Evita "pulo" no layout */
  text-align: center;
}

.typing-in-progress {
  border-right: 2px solid var(--ocre-medium); /* Cursor durante digitação */
  padding-right: 5px;
  animation: blink-caret 0.75s step-end infinite;
}

.blinking-cursor {
  animation: blink-caret 0.75s step-end infinite;
  color: var(--ocre-medium);
  font-weight: normal;
}

@keyframes blink-caret {
  from, to { opacity: 0; }
  50% { opacity: 1; }
}

/* EFEITO DE DIGITAÇÃO NO TÍTULO------------------------- */
#typing-text {
  display: inline-block;
  min-width: 180px; /* Evita "pulo" no layout */
  text-align: center;
}

.typing-in-progress {
  border-right: 2px solid var(--ocre-medium); /* Cursor durante digitação */
  padding-right: 5px;
  animation: blink-caret 0.75s step-end infinite;
}

.blinking-cursor {
  animation: blink-caret 0.80s step-end infinite;
  color: var(--ocre-medium);
  font-weight: normal;
}

@keyframes blink-caret {
  from, to { opacity: 0; }
  50% { opacity: 1; }
}

/* =============================================
   6. NAVEGAÇÃO
   ============================================= */
.nav-links {
  list-style: none;
}

.nav-links > li {
  margin-bottom: 0.6rem;
  position: relative;
}

.nav-links > li > a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  color: var(--text-medium);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: var(--transition);
  letter-spacing: 0.02em;
  user-select: none;
  font-size: 0.9rem;
}

.nav-links > li > a i {
  font-size: 0.8rem;
  width: 16px;
  text-align: center;
  transition: var(--transition);
}

.nav-links > li > a:hover,
.nav-links > li > a.active {
  background-color: rgba(212, 180, 131, 0.2);
  color: var(--ocre-dark);
  border-left-color: var(--ocre-dark);
  transform: translateX(4px);
}

.nav-links > li > a.active {
  background-color: rgba(212, 180, 131, 0.3);
  font-weight: 700;
}

/* Sub-navegação */
.sub-nav {
  list-style: none;
  margin-top: 0.4rem;
  margin-left: 0.8rem;
  padding-left: 0.8rem;
  border-left: 2px dashed var(--ocre-light);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease;
}

.nav-links > li.active > .sub-nav {
  max-height: 500px;
  margin-bottom: 0.6rem;
}

.sub-nav li {
  margin-bottom: 0.5rem;
}

.sub-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem 0.5rem 0.6rem;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--transition);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.sub-nav a i {
  font-size: 0.7rem;
  width: 14px;
  text-align: center;
}

.sub-nav a:hover {
  background-color: rgba(212, 180, 131, 0.15);
  color: var(--ocre-dark);
}

.sub-nav a.active {
  color: var(--ocre-dark);
  font-weight: 700;
  background-color: rgba(212, 180, 131, 0.2);
}

/* Sub-sub-navegação */
.sub-nav .sub-nav {
  margin-left: 1.5rem;
  padding-left: 1.2rem;
  border-left: 2px dashed rgba(179, 139, 91, 0.4);
  max-height: none;
  display: block;
}

.sub-nav > li.active > .sub-nav {
  max-height: 700px;
  margin-bottom: 0.6rem;
  display: block;
}

.sub-nav > li {
  position: relative;
}

.sub-nav > li > a {
  position: relative;
}

/* Seta indicativa para itens com subitens */
.nav-links > li > a:has(+ .sub-nav)::after,
.sub-nav > li > a:has(+ .sub-nav)::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  margin-left:5px;
  transition: transform 0.3s ease;
}

.nav-links > li.active > a:has(+ .sub-nav)::after,
.sub-nav > li.active > a:has(+ .sub-nav)::after {
  transform: rotate(180deg);
}

/* Estilos para o menu de navegação */
.nav-links, .sub-nav {
  list-style: none;
  padding-left: 15px;
}

.sub-nav {
  display: none; /* Esconde os submenus por padrão */
}

.sub-nav.active {
  display: block; /* Mostra o submenu ativo */
}

.arrow-icon {
  margin-left: 5px;
  transition: transform 0.3s ease;
}

/* Estilo para itens ativos */
.nav-links li.active > .sub-nav {
  display: block;
}

/* Ajuste para os sub-subitens */
.sub-nav .sub-nav {
  padding-left: 15px;
}
/* Estilos para o menu de navegação */
.nav-links, .sub-nav {
  list-style: none;
  padding-left: 15px;
}

.sub-nav {
  display: none; /* Esconde os submenus por padrão */
}

.nav-links li.active > .sub-nav,
.sub-nav li.active > .sub-nav {
  display: block; /* Mostra submenus ativos */
}

.arrow-icon {
  margin-left: 5px;
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

/* Ajuste para os sub-subitens */
.sub-nav .sub-nav {
  padding-left: 15px;
}
/* Remove a seta padrão do Font Awesome se existir */
.nav-links li > a > i.fa-chevron-right,
.sub-nav li > a > i.fa-chevron-right {
  display: none;
}

/* =============================================
   7. CONTEÚDO PRINCIPAL
   ============================================= */
.content-section {
  background: white;
  border-radius: var(--border-radius);
  padding: 2.5rem 2.5rem 2.5rem 2.8rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 3rem;
  border: 1.5px solid var(--ocre-light);
  user-select: text;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-section:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.content-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, var(--ocre-dark), var(--accent-color));
  border-radius: var(--border-radius) 0 0 var(--border-radius);
}

/* =============================================
   8. TIPOGRAFIA
   ============================================= */
h2 {
  font-family: 'Poppins', sans-serif;
  color: var(--ocre-dark);
  font-size: clamp(1.8rem, 2vw, 2.2rem);
  margin-bottom: 1.8rem;
  font-weight: 700;
  position: relative;
  padding-bottom: 1rem;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 110px;
  height: 5px;
  background: linear-gradient(90deg, var(--ocre-dark), var(--accent-color));
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(107, 142, 35, 0.7);
}

h2 i {
  font-size: 1.8rem;
  color: var(--ocre-medium);
}

h3 {
  font-family: 'Poppins', sans-serif;
  color: var(--ocre-medium);
  font-size: 1.5rem;
  margin: 2.5rem 0 1.8rem;
  font-weight: 600;
  padding-left: 0.7rem;
  border-left: 5px solid var(--ocre-medium);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

h3 i {
  font-size: 1.3rem;
}

p {
  margin-bottom: 1.8rem;
  color: var(--text-medium);
  font-size: 1.05rem;
  line-height: 1.9;
  letter-spacing: 0.02em;
}

/* =============================================
   9. COMPONENTES
   ============================================= */
/* Listas */
ul,
ol {
  margin-bottom: 2rem;
  padding-left: 2.25rem;
  color: var(--text-medium);
  font-size: 1.05rem;
  line-height: 1.8;
}

li {
  margin-bottom: 1.1rem;
  position: relative;
}

ul li::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.8rem;
  width: 8px;
  height: 8px;
  background-color: var(--ocre-medium);
  border-radius: 50%;
}

ol {
  counter-reset: item;
  list-style-type: none; 
}

ol li {
  counter-increment: item;
}

ol li::before {
  content: counter(item) ".";
  position: absolute;
  left: -1.8rem;
  font-weight: bold;
  color: var(--ocre-medium);
}

ul {
  list-style-type: none;
}

/* Figuras */
.figure {
  margin: 3rem 0 3rem 0;
  text-align: center;
  background-color: var(--ocre-very-light);
  padding: 1.8rem;
  border-radius: 12px;
  border: 1.5px solid var(--ocre-light);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.figure:hover {
  box-shadow: var(--shadow-lg);
}

.figure::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--ocre-dark), var(--accent-color));
}

.figure img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1.5px solid var(--ocre-light);
  box-shadow: var(--shadow-md);
  cursor: zoom-in;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.figure img:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-lg);
}

.figure-caption {
  font-style: italic;
  margin-top: 1.5rem;
  color: var(--text-light);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.figure-caption i {
  color: var(--ocre-medium);
}

/* Notas */
.note {
  background-color: #FFF9E6;
  border-left: 6px solid var(--ocre-medium);
  padding: 1.8rem 2rem 1.8rem 3rem;
  margin: 3rem 0;
  border-radius: 0 12px 12px 0;
  position: relative;
  box-shadow: var(--shadow-sm);
  font-size: 1.05rem;
  color: var(--ocre-dark);
  letter-spacing: 0.02em;
  transition: transform 0.3s ease;
}

.note:hover {
  transform: translateX(5px);
}

.note::before {
  content: "!";
  position: absolute;
  top: 0;
  left: 0;
  background-color: var(--ocre-medium);
  color: white;
  width: 45px;
  height: 100%;
  font-weight: 900;
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 12px 12px 0;
  user-select: none;
}

.note-content {
  padding-left: 10px;
}

.note strong {
  color: var(--ocre-dark);
}

/* Código */
.code {
  font-family: 'Courier New', monospace;
  background-color: var(--ocre-very-light);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 1rem;
  color: var(--ocre-dark);
  border: 1.5px solid var(--ocre-light);
  user-select: text;
  position: relative;
  display: inline-block;
}

.code::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--ocre-medium);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.code:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* =============================================
   10. RODAPÉ
   ============================================= */
footer {
  text-align: center;
  padding: 3rem 1.5rem;
  margin-top: 4rem;
  color: var(--text-light);
  font-size: 1rem;
  border-top: 2px solid var(--ocre-light);
  background-color: white;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  user-select: none;
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--ocre-dark), var(--accent-color), var(--ocre-dark));
  border-radius: 3px;
}

/* =============================================
   11. COMPONENTES INTERATIVOS
   ============================================= */
/* Botão "Voltar ao topo" */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--ocre-dark);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--ocre-medium);
  transform: translateY(-5px);
}

/* Sistema de zoom */
.zoom-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.zoomed-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  cursor: grab;
}

.close-zoom {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--ocre-dark);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
}

/* Tooltips */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: var(--ocre-dark);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--ocre-dark) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* =============================================
   12. ELEMENTOS DECORATIVOS
   ============================================= */
.decorative-border {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--ocre-dark), var(--accent-color), var(--ocre-dark));
  margin: 3rem 0;
  position: relative;
  overflow: hidden;
}

.decorative-border::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255,255,255,0.3), 
    transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* =============================================
   13. SUBSEÇÕES
   ============================================= */
.sub-section {
  margin: 2.5rem 0;
  padding-left: 1.5rem;
  border-left: 3px solid var(--ocre-light);
}

.sub-section h4 {
  font-family: 'Poppins', sans-serif;
  color: var(--ocre-dark);
  font-size: 1.4rem;
  margin: 2rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sub-section h5 {
  font-family: 'Poppins', sans-serif;
  color: var(--ocre-medium);
  font-size: 1.2rem;
  margin: 1.8rem 0 1rem;
}

.nested-list {
  list-style-type: circle;
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.nested-list li::before {
  display: none;
}

/* =============================================
   14. RESPONSIVIDADE
   ============================================= */
@media (max-width: 768px) {
  header {
    padding: 4rem 1rem 3rem;
    border-radius: 0;
  }

  .header-content h1 {
    font-size: 2.6rem;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .sidebar {
    position: relative;
    top: auto;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 10px;
    max-height: none;
  }

  .content-section {
    padding: 2rem 1.5rem;
    margin-bottom: 2.5rem;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    bottom: 1rem;
    right: 1rem;
  }
}