/* ============================================
   RESPONSIVE FIX — Torge Sistemas
   Mobile & Tablet overrides (inline-style site)
   ============================================ */

/* ---------- HAMBURGER MENU BUTTON ---------- */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  position: relative;
}
.hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: #1a2b3c;
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- MOBILE OVERLAY NAV (slide-in drawer) ---------- */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  width: min(82vw, 320px);
  height: 100%;
  bottom: 0;
  background: rgba(13, 27, 36, 0.92);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 20px 0 18px;
  gap: 2px;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  border-radius: 0;
  transform: translateX(-110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  visibility: hidden;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}
.mobile-nav-overlay.open {
  transform: translateX(0);
  visibility: visible;
}
/* Hide nav when menu is open */
nav.menu-open {
  background: transparent !important;
  box-shadow: none !important;
}
nav.menu-open > div > a:first-child,
nav.menu-open .hamburger-btn {
  visibility: hidden !important;
}
.mobile-nav-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.40);
}
.mobile-nav-backdrop.open {
  display: block;
}
.mobile-nav-overlay a {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 12px 24px;
  text-align: left;
  transition: background 0.2s;
}
.mobile-nav-overlay .overlay-logo {
  display: block;
  width: min(124px, calc(100% - 64px));
  max-width: calc(100% - 64px);
  height: auto;
  object-fit: contain;
  object-position: left top;
  align-self: flex-start;
  margin: 14px 24px 18px;
  filter: brightness(0) invert(1) contrast(1.06);
  transform: none;
}
.mobile-nav-overlay a:hover {
  background: rgba(255,255,255,0.08);
}
.mobile-nav-overlay a:last-child {
  margin: 8px 16px 0;
  background: #0e9f6e;
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  text-align: center;
  padding: 12px 24px;
}

nav > div {
  height: 86px !important;
  min-height: 86px;
}

nav > div > a:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: auto;
  min-width: 96px;
  height: auto;
  line-height: 0;
  overflow: visible;
  flex-shrink: 0;
}

nav > div > a:first-child img {
  width: 96px;
  max-width: 96px;
  height: auto !important;
  object-fit: contain;
  object-position: left top;
  display: block;
  transform: none;
}

footer > div > div:first-child > div:first-child {
  display: block;
  width: auto;
  max-width: 250px;
  overflow: visible;
  margin-bottom: 0;
}

footer > div > div:first-child > div:first-child > div:first-child {
  display: block;
  width: 128px;
  max-width: 128px;
  overflow: visible;
}

footer img[alt="Torge Sistemas"] {
  width: 128px !important;
  max-width: 128px !important;
  height: auto !important;
  object-fit: contain;
  object-position: left top;
  margin: 0;
  display: block;
  transform: none;
}

/* --- HERO WAVE DIVIDER: remove on all sizes --- */
#inicio > div:last-child {
  display: none !important;
}

#inicio > div[style*="grid-template-columns"] > div:first-child > div[style*="margin-top: 52px"] {
  margin-top: 18px !important;
}

.section-dark .stat-block:last-child .stat-num {
  font-size: clamp(2.2rem, 3vw, 2.9rem) !important;
  letter-spacing: -0.4px !important;
}

/* Keep the last stats label on one line after text replacement */
.section-dark .stat-block:last-child .stat-label {
  white-space: nowrap !important;
  font-size: clamp(12px, 1.15vw, 14px) !important;
  letter-spacing: 0 !important;
}

/* Hide overlay on desktop */
@media (min-width: 769px) {
  #inicio {
    min-height: auto !important;
  }
  #inicio > div[style*="grid-template-columns"] {
    padding-bottom: 36px !important;
  }
  .mobile-nav-overlay,
  .mobile-nav-backdrop {
    display: none !important;
  }
}

/* ============================================
   BREAKPOINT: <= 768px (Tablet / Mobile)
   ============================================ */
@media (max-width: 768px) {

  /* --- NAV: hide desktop links, show hamburger --- */
  nav > div > div {
    display: none !important;
  }
  .hamburger-btn {
    display: block;
  }
  .hamburger-btn span {
    background: #fff !important;
  }
  .hamburger-btn.dark span {
    background: #1a2b3c !important;
  }

  /* Nav adjustments */
  nav {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 10px !important;
    z-index: 1000 !important;
  }
  nav > div {
    padding: 0 !important;
    height: 72px !important;
    min-height: 72px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  nav > div > a:first-child {
    margin-right: auto !important;
    width: auto !important;
    min-width: 84px !important;
    height: auto !important;
    overflow: visible !important;
    display: flex !important;
    align-items: flex-start !important;
  }
  nav img {
    width: 84px !important;
    max-width: 84px !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: left top !important;
    display: block !important;
    transform: none !important;
  }
  .hamburger-btn {
    margin-left: auto !important;
    margin-right: 0 !important;
  }

  /* --- HERO SECTION --- */
  #inicio {
    min-height: auto !important;
    padding-top: 90px !important;
    padding-bottom: 40px !important;
  }
  #inicio > div:nth-child(2) {
    grid-template-columns: 1fr !important;
    padding: 80px 20px 40px !important;
    gap: 24px !important;
  }
  #inicio > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    padding: 80px 20px 40px !important;
    gap: 24px !important;
  }
  #inicio h1 {
    font-size: 32px !important;
    line-height: 1.2 !important;
  }
  #inicio img[alt*="Dashboard"],
  #inicio img[alt*="Torge"] {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    position: relative !important;
    right: auto !important;
    margin: 0 auto !important;
  }
  /* Hero CTA buttons: full width below image */
  #inicio > div[style*="grid-template-columns"] > div:first-child {
    display: contents !important;
  }
  /* Reduce paragraph bottom margin in hero */
  #inicio > div[style*="grid-template-columns"] p {
    margin-bottom: 12px !important;
  }
  #inicio div[style*="display: flex"][style*="gap: 14px"] {
    flex-direction: column !important;
    width: 100% !important;
    order: 10 !important;
  }
  #inicio a[href="#contato"],
  #inicio a[href="#funcionalidades"] {
    font-size: 15px !important;
    padding: 14px 20px !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    display: block !important;
    box-shadow: none !important;
  }
  /* Remove dashboard image shadow on mobile */
  #inicio img[alt*="Dashboard"],
  #inicio img[alt*="Torge ERP"] {
    box-shadow: none !important;
  }
  /* Push buttons below image */
  #inicio > div[style*="grid-template-columns"] > div:nth-child(2) {
    order: 5 !important;
  }
  /* Hero carousel dots below image too */
  #inicio .hero-grid,
  #inicio > div[style*="grid-template-columns"] > div:first-child > div:last-child {
    order: 4 !important;
  }
  #inicio > div[style*="grid-template-columns"] > div:first-child > div[style*="margin-top: 52px"] {
    margin-top: 16px !important;
  }
  #inicio .hero-grid {
    pointer-events: none !important;
  }

  /* --- STATS BAR --- */
  .section-dark {
    padding: 48px 20px !important;
  }
  .section-dark > div[style*="repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    text-align: center;
  }
  .stat-num {
    font-size: 36px !important;
    letter-spacing: 2px !important;
  }
  .stat-label {
    font-size: 14px !important;
  }
  .stat-block {
    border-right: none !important;
    padding: 28px 20px !important;
  }
  .stat-block.delay-2 {
    border-top: 1px solid rgba(255,255,255,0.15) !important;
    border-bottom: 1px solid rgba(255,255,255,0.15) !important;
  }

  /* --- SECTIONS: standardize spacing --- */
  section {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  section:not(#inicio) {
    padding-top: 60px !important;
    padding-bottom: 60px !important;
  }
  section > div[style*="max-width: 1160px"] {
    padding: 0 !important;
  }

  /* --- SEGMENTS GRID --- */
  #segmentos > div:nth-child(2) {
    grid-template-columns: 1fr !important;
  }

  /* --- SECTION HEADINGS --- */
  section h2 {
    font-size: 28px !important;
    line-height: 1.25 !important;
  }

  /* --- FEATURES TABS --- */
  #funcionalidades > div:nth-child(2) {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  #funcionalidades > div:nth-child(2) button {
    font-size: 13px !important;
    padding: 8px 14px !important;
  }
  /* Features grid */
  #funcionalidades > div:nth-child(3) {
    grid-template-columns: 1fr !important;
  }

  /* --- PLANS CAROUSEL --- */
  #planos div[style*="grid-template-columns"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0px !important;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  #planos div[style*="grid-template-columns"]::-webkit-scrollbar {
    display: none;
  }
  #planos div[style*="grid-template-columns"] > div {
    min-width: 100% !important;
    max-width: 100% !important;
    scroll-snap-align: start;
    flex-shrink: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 695px !important;
  }
  #planos div[style*="grid-template-columns"] > div > a {
    margin-top: auto !important;
  }
  /* Remove CTA button shadow */
  #planos a[href="#contato"] {
    box-shadow: none !important;
  }

  /* Plans carousel container needs relative positioning */
  #planos {
    overflow: hidden !important;
  }
  #planos > div:nth-child(2) {
    position: relative !important;
    overflow: visible !important;
  }

  /* Plans dots and arrows */
  .plans-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
  }
  .plans-dots,
  .testimonial-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
  }
  .plans-dots span,
  .testimonial-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(26,138,122,0.25);
    transition: background 0.3s;
    cursor: pointer;
  }
  .plans-dots span.active,
  .testimonial-dots span.active {
    background: #1a8a7a;
  }
  .plans-arrows {
    display: none;
  }
  .plans-arrow-side {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #1a8a7a;
    background: rgba(255,255,255,0.95);
    color: #1a8a7a;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  .plans-arrow-side:hover {
    background: #1a8a7a;
    color: #fff;
  }
  .plans-arrow-left {
    left: -18px;
  }
  .plans-arrow-right {
    right: -18px;
  }

  /* --- COMPARISON TABLE --- */
  /* Table wrapper has inline overflow:hidden - must override */
  div:has(> table) {
    overflow: visible !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    font-size: 13px !important;
    width: 100% !important;
  }
  table thead,
  table tbody {
    display: table !important;
    width: 100% !important;
    min-width: 500px !important;
  }
  table th,
  table td {
    padding: 10px 12px !important;
    white-space: nowrap !important;
  }
  table th:first-child,
  table td:first-child {
    white-space: normal !important;
    min-width: 140px !important;
  }

  /* --- VIDEO/DEMO SECTIONS --- */
  section > div[style*="cursor: pointer"] {
    max-width: 100% !important;
  }
  section video,
  section > div img[alt*="Torge"] {
    width: 100% !important;
    height: auto !important;
  }

  /* --- RESTORE GRID for segments & funcionalidades (NOT carousel) --- */
  #segmentos div[style*="auto-fit"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    overflow-x: visible !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  #segmentos div[style*="auto-fit"] > div {
    min-width: unset !important;
    max-width: 100% !important;
    flex-shrink: unset !important;
  }

  /* Funcionalidades: show ALL cards, compact grid */
  #funcionalidades div[style*="auto-fit"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    overflow-x: visible !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  #funcionalidades div[style*="auto-fit"] > div {
    min-width: unset !important;
    max-width: 100% !important;
    flex-shrink: unset !important;
    padding: 12px 10px !important;
  }
  #funcionalidades div[style*="auto-fit"] h3 {
    font-size: 14px !important;
  }
  #funcionalidades div[style*="auto-fit"] p {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  /* --- TESTIMONIALS CAROUSEL (only for .section-tinted) --- */
  .section-tinted {
    overflow: hidden !important;
  }
  .section-tinted > div {
    overflow: visible !important;
  }
  .section-tinted div[style*="auto-fit"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0px !important;
    padding-bottom: 12px;
    scrollbar-width: none;
    position: relative;
  }
  .section-tinted div[style*="auto-fit"]::-webkit-scrollbar {
    display: none;
  }
  .section-tinted div[style*="auto-fit"] > div {
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 240px !important;
    scroll-snap-align: start;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }

  /* Testimonials dots + arrows */
  .testimonial-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
  }
  .testimonial-arrows {
    display: none;
  }
  .testimonial-arrow-side {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #1a8a7a;
    background: rgba(255,255,255,0.95);
    color: #1a8a7a;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  .testimonial-arrow-side:hover {
    background: #1a8a7a;
    color: #fff;
  }
  .testimonial-arrow-left {
    left: -18px;
  }
  .testimonial-arrow-right {
    right: -18px;
  }

  /* --- ABOUT SECTION --- */
  /* About uses display:grid with grid-template-columns: 1fr 1fr inline */
  #sobre > div,
  #sobre div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  #sobre > div > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* --- INTEGRATIONS TAGS --- */
  section > div[style*="flex-wrap"] {
    gap: 10px !important;
    justify-content: center !important;
  }

  /* --- FAQ --- */
  section > div[style*="max-width: 720px"] {
    max-width: 100% !important;
    padding: 0 !important;
  }
  section > div > button {
    font-size: 15px !important;
    padding: 16px !important;
  }

  /* --- CONTACT SECTION --- */
  /* Contact uses display:grid with grid-template-columns: 1fr 1fr inline */
  #contato {
    padding: 56px 20px !important;
  }
  #contato > div,
  #contato > div > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  #contato div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 10px"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  #contato > div > div:first-child {
    width: 100% !important;
    max-width: 100% !important;
  }
  #contato > div > div:last-child {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* Contact info cards */
  #contato > div > div:first-child > div:last-child {
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* --- FOOTER --- */
  footer {
    padding: 40px 20px 24px !important;
  }
  footer img[alt="Torge Sistemas"] {
    width: clamp(98px, 32vw, 118px) !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: left top !important;
    margin: 0 !important;
    display: block !important;
    transform: none !important;
    align-self: flex-start !important;
  }
  footer > div > div:first-child > div:first-child {
    text-align: left !important;
    align-items: flex-start !important;
    display: flex !important;
    flex-direction: column !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
  }
  footer > div > div:first-child > div:first-child > div:first-child {
    width: fit-content !important;
    max-width: 100% !important;
    overflow: visible !important;
    align-self: flex-start !important;
  }
  footer > div > div:first-child > div:first-child > div {
    text-align: left !important;
    display: flex !important;
    justify-content: flex-start !important;
  }
  footer > div > div:first-child {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  footer > div > div:last-child {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    gap: 12px !important;
  }

  /* --- GLOBAL: prevent horizontal overflow --- */
  html, body {
    overflow-x: hidden !important;
  }

  /* --- SCROLL-TO-TOP + WHATSAPP BUTTONS --- */
  button[style*="position: fixed"] {
    display: none !important;
  }
  a[href*="wa.me"] {
    bottom: 20px !important;
    right: 16px !important;
  }
}

/* ============================================
   BREAKPOINT: <= 480px (Small phones)
   ============================================ */
@media (max-width: 480px) {

  /* Even smaller hero heading */
  #inicio h1 {
    font-size: 26px !important;
  }

  section h2 {
    font-size: 24px !important;
  }

  /* Stats - keep num size */
  .stat-num {
    font-size: 32px !important;
  }

  /* Plans cards - tighter */
  #planos > div:nth-child(2) > div {
    padding: 24px 16px !important;
  }

  /* Table - smaller text */
  table {
    font-size: 12px !important;
  }
  table thead,
  table tbody {
    min-width: 440px !important;
  }

  /* Contact form inputs */
  #contato input,
  #contato select,
  #contato textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }
}
