/* ==============================
   HACSEC Core · Fixes de UI/UX
   Injetado pós-build
   ============================== */

/* 1. Body background */
body {
  background-color: var(--day-bg, #f6f7f2);
}

/* 2. Tabela responsiva — scroll horizontal no mobile */
.responsive-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100vw;
}

.responsive-table-wrapper table {
  min-width: 600px; /* ensure table keeps its min-width inside wrapper */
}

/* 3. Transição suave para troca de tema (data-theme) */
html {
  transition: background-color 0.22s ease, color 0.22s ease;
}

/* 4. data-theme="night" — regras para quando toggle for ativado */
html[data-theme="night"] {
  background-color: var(--night-bg, #030303);
  color-scheme: dark;
}

html[data-theme="night"] body {
  background-color: var(--night-bg, #030303);
  color: var(--night-text, #f4f4ee);
}

/* 5. Focus ring mais visível (acessibilidade) */
*:focus-visible {
  outline: 2px solid var(--day-accent, #00a862) !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}

html[data-theme="night"] *:focus-visible {
  outline-color: var(--night-accent, #00a862) !important;
}

/* 6. Botões com área mínima de toque 44px */
button, a, input, select, textarea {
  min-height: 44px;
}

/* 7. Inputs mais largos no mobile */
input, select, textarea {
  width: 100% !important;
  box-sizing: border-box;
  max-width: 100%;
}

/* 8. Theme toggle button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid var(--day-border, rgba(7,24,39,0.12));
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
  position: relative;
  color: var(--day-text, #071827);
}

.theme-toggle-btn:hover {
  background: var(--day-bg-soft, #eef0ea);
  border-color: var(--day-accent, #00a862);
}

html[data-theme="night"] .theme-toggle-btn {
  border-color: var(--night-border, rgba(244,244,238,0.12));
  color: var(--night-text, #f4f4ee);
}

html[data-theme="night"] .theme-toggle-btn:hover {
  background: var(--night-bg-panel, #0e1317);
  border-color: var(--night-accent, #00a862);
}

/* 9. Hamburger menu mobile */
.hamburger-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  gap: 5px;
  z-index: 1001;
}

.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--day-text, #071827);
  border-radius: 2px;
  transition: all 0.22s ease;
}

html[data-theme="night"] .hamburger-btn span {
  background: var(--night-text, #f4f4ee);
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile nav sheet */
.mobile-nav-sheet {
  display: none;
  position: fixed;
  top: 0;
  right: -100%;
  width: min(85vw, 320px);
  height: 100vh;
  background: var(--day-bg-card, #fff);
  border-left: 1px solid var(--day-border, rgba(7,24,39,0.12));
  z-index: 1000;
  padding: 80px 24px 24px;
  flex-direction: column;
  gap: 8px;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

html[data-theme="night"] .mobile-nav-sheet {
  background: var(--night-bg-panel, #0e1317);
  border-color: var(--night-border, rgba(244,244,238,0.12));
}

.mobile-nav-sheet.open {
  right: 0;
}

.mobile-nav-sheet a {
  display: block;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 500;
  color: var(--day-text, #071827);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.mobile-nav-sheet a:hover {
  background: var(--day-bg-soft, #eef0ea);
}

html[data-theme="night"] .mobile-nav-sheet a {
  color: var(--night-text, #f4f4ee);
}

html[data-theme="night"] .mobile-nav-sheet a:hover {
  background: var(--night-bg-panel-2, #161d22);
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}

/* 10. Correção: formulário mais largo no mobile */
@media (max-width: 600px) {
  input, select, textarea {
    width: 100% !important;
  }
}

/* 11. Ajuste para header no mobile */
@media (max-width: 767px) {
  .hamburger-btn {
    display: flex !important;
  }
  nav, .desktop-nav, header nav {
    display: none !important;
  }
  
  /* Fix container-custom overflow */
  .container-custom, .container-wide {
    max-width: 100vw !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
  }
  
  /* Ensure root element doesn't overflow */
  html, body {
    overflow-x: hidden !important;
  }
  
  /* Fix table wrapper */
  .responsive-table-wrapper {
    max-width: 100vw !important;
    width: 100% !important;
  }
}

/* Fix for all viewports - prevent horizontal scroll */
html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}
