/* ===== CSS Custom Properties ===== */
:root {
  --theme-color: #42b983;
  --theme-color-light: rgba(66, 185, 131, 0.15);
}

body {
  background-color: #ffffff;
  transition: background-color 0.3s, color 0.3s;
}

.sidebar {
  font-size: 16px;
  width: 250px;
  box-sizing: border-box;
}

.sidebar-nav {
  padding: 15px;
  font-size: 15px;
}

.sidebar-nav h2 {
  text-align: center;
  margin: 15px 0;
  padding-bottom: 5px;
  border-bottom: 2px solid #0E76A8;
  font-weight: bold;
  color: #0E76A8;
}

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.1s;
}

.sidebar-nav a:hover {
  background: #f0f8ff;
  transform: translateX(4px);
}

.sidebar-nav a::before {
  content: "• ";
  color: #0E76A8;
}

.sidebar-nav ul ul li > a::before {
  content: "• ";
}

.sidebar-nav ul ul li::before {
  content: none;
}

/* ===== Página de Contato ===== */
.contact-wrapper {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.contact-form-container {
  flex: 1;
  min-width: 280px;
}

.contact-links {
  min-width: 200px;
}

.contact-links p {
  margin-bottom: 16px;
  line-height: 1.6;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  color: #333;
}

.form-group input,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--theme-color);
  box-shadow: 0 0 0 3px var(--theme-color-light);
}

.btn-submit {
  background-color: var(--theme-color);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-submit:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ===== RESPONSIVIDADE MOBILE ===== */

.markdown-section img {
  max-width: 100%;
}

/* Badges (shields.io) — travados em 20px, nunca escalam */
.markdown-section img[src*="shields.io"],
.markdown-section p img[src*="shields.io"],
body .markdown-section img[src*="shields.io"] {
  display: inline !important;
  margin: 2px 3px !important;
  vertical-align: middle !important;
  height: 20px !important;
  width: auto !important;
  max-width: none !important;
  max-height: 20px !important;
}

/* GitHub corner ribbon — esconde no mobile */
.github-corner {
  display: none !important;
}

@media (min-width: 769px) {
  .github-corner {
    display: block !important;
  }
}

/* ===== Card de perfil ===== */
.profile-card {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Badges sociais do card — tamanho fixo, nunca esticam */
.profile-social img {
  height: 28px !important;
  width: auto !important;
  max-width: none !important;
  margin: 3px 4px 3px 0 !important;
}

/* ===== GitHub Stats container ===== */
.github-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.github-stats img,
.markdown-section img[src*="github-readme-stats"],
.markdown-section img[src*="github-readme-streak"] {
  max-width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  /* Conteúdo com padding adequado */
  .markdown-section {
    padding: 16px 20px 80px 20px !important;
  }

  /* Card de perfil — empilha em coluna */
  .profile-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  /* Formulário de contato */
  .contact-wrapper {
    flex-direction: column;
    gap: 24px;
  }

  .contact-links {
    min-width: unset;
    width: 100%;
  }

  .contact-form-container {
    min-width: unset;
    width: 100%;
  }

  .btn-submit {
    width: 100%;
    padding: 13px;
  }

  /* Inputs maiores para toque — evita zoom automático no iOS */
  .form-group input,
  .form-group textarea {
    font-size: 16px;
    padding: 12px 14px;
  }

  /* Botões flutuantes */
  .dark-toggle-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
    bottom: 16px;
    right: 16px;
  }

  .lang-toggle-btn {
    width: 44px;
    height: 44px;
    font-size: 12px;
    bottom: 68px;
    right: 16px;
  }

  /* Contador de visitas — canto inferior esquerdo */
  .visit-counter {
    bottom: 16px;
    left: 16px;
    max-width: 110px;
    transform: none;
  }

  .visit-counter:hover {
    transform: scale(1.05);
  }

  /* GitHub Stats empilhados */
  .github-stats {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .markdown-section {
    padding: 12px 16px 80px 16px !important;
  }

  /* Foto menor em telas muito pequenas */
  .profile-card img {
    width: 100px !important;
    height: 100px !important;
  }

  .markdown-section h1 {
    font-size: 1.5rem;
  }

  .markdown-section h2 {
    font-size: 1.2rem;
  }
}

/* ===== Botão de Idioma ===== */
.lang-toggle-btn {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 9999;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #0E76A8;
  color: white;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: 0.5px;
}

.lang-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .lang-toggle-btn {
  background: #1a5276;
}

/* ===== Botão Dark Mode ===== */
.dark-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: #42b983;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.dark-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .dark-toggle-btn {
  background: #3b4252;
}

/* ===== Modo Escuro ===== */
body.dark-mode {
  background-color: #1e1e2e !important;
  color: #f0f0f0 !important;
}

/* Sidebar */
body.dark-mode .sidebar {
  background-color: #1e1e2e !important;
  border-right: none !important;
  box-shadow: none !important;
}

body.dark-mode .sidebar .app-name,
body.dark-mode .sidebar .app-name-link {
  color: #f0f0f0 !important;
}

body.dark-mode .sidebar ul li a {
  color: #cdd6f4 !important;
}

body.dark-mode .sidebar ul li.active > a {
  color: #42b983 !important;
  font-weight: 600;
}

body.dark-mode .sidebar-nav h2 {
  color: #89b4fa !important;
  border-bottom-color: #89b4fa !important;
}

body.dark-mode .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #f0f0f0 !important;
}

/* Botão hamburguer da sidebar */
body.dark-mode .sidebar-toggle {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .sidebar-toggle .sidebar-toggle-button span,
body.dark-mode .sidebar-toggle span {
  background-color: #cdd6f4 !important;
}

body.dark-mode .sidebar-toggle .sidebar-toggle-button span {
  background-color: #cdd6f4 !important;
}

/* Área de conteúdo */
body.dark-mode section.content {
  background-color: #1e1e2e !important;
}

/* Markdown */
body.dark-mode .markdown-section {
  color: #f0f0f0 !important;
  background-color: #1e1e2e !important;
}

body.dark-mode .markdown-section h1,
body.dark-mode .markdown-section h2,
body.dark-mode .markdown-section h3,
body.dark-mode .markdown-section h4,
body.dark-mode .markdown-section h5,
body.dark-mode .markdown-section h6 {
  color: #ffffff !important;
}

body.dark-mode .markdown-section p,
body.dark-mode .markdown-section li,
body.dark-mode .markdown-section span,
body.dark-mode .markdown-section td,
body.dark-mode .markdown-section th,
body.dark-mode .markdown-section label {
  color: #f0f0f0 !important;
}

body.dark-mode .markdown-section strong {
  color: #ffffff !important;
}

body.dark-mode .markdown-section a {
  color: #89dceb !important;
}

body.dark-mode .markdown-section a:hover {
  color: #42b983 !important;
}

body.dark-mode .markdown-section hr {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Código inline */
body.dark-mode .markdown-section code {
  background-color: #313244 !important;
  color: #f5c2e7 !important;
  border-radius: 4px !important;
  padding: 2px 5px !important;
}

/* Bloco de código */
body.dark-mode .markdown-section pre {
  background-color: #181825 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
}

body.dark-mode .markdown-section pre code {
  color: #cdd6f4 !important;
  background-color: transparent !important;
}

/* Blockquote */
body.dark-mode .markdown-section blockquote {
  border-left: 4px solid #42b983 !important;
  background-color: rgba(66, 185, 131, 0.08) !important;
  color: #cdd6f4 !important;
}

body.dark-mode .markdown-section blockquote p {
  color: #cdd6f4 !important;
}

/* Tabela */
body.dark-mode .markdown-section table {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .markdown-section table thead tr {
  background-color: #313244 !important;
}

body.dark-mode .markdown-section table thead th {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .markdown-section table tbody tr {
  background-color: #1e1e2e !important;
}

body.dark-mode .markdown-section table tbody tr:nth-child(2n) {
  background-color: #252535 !important;
}

body.dark-mode .markdown-section table td {
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #f0f0f0 !important;
}

/* Formulário de contato */
body.dark-mode .form-group label {
  color: #f0f0f0 !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
  background-color: #313244 !important;
  border-color: #45475a !important;
  color: #f0f0f0 !important;
}

body.dark-mode .form-group input::placeholder,
body.dark-mode .form-group textarea::placeholder {
  color: #6c7086 !important;
}

body.dark-mode .contact-links p,
body.dark-mode .contact-links a {
  color: #cdd6f4 !important;
}

/* ===== Contador de Visitas (hits.sh) ===== */
.visit-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 150px;
  height: auto;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
  display: block;
  backdrop-filter: blur(8px);
}

.visit-counter:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.85);
}

body.dark-mode .visit-counter {
  background: rgba(30, 30, 46, 0.7);
}

body.dark-mode .visit-counter:hover {
  background: rgba(30, 30, 46, 0.85);
}
