/**
 * investoor-overrides.css
 * Audit fixes only (override layer — do not edit existing CSS files).
 *
 * 1) Header nav overlap at ~1100px / ~1194px
 * 2) Home hero product line wrap on phones
 * 3) Calculator title / glass padding on phones
 * 4) Mobile drawer: hide native scrollbar, keep actions usable
 * 5) Inner-page hero top gap (not home): reduce excess padding under sticky header
 */

/* --------------------------------------------------------------------------
   1) Header: switch to hamburger earlier so long DE/HU nav cannot collide
      with logo / language / action buttons on narrow laptops & large tablets.
      Existing theme keeps desktop nav until 992px — too late for long labels.
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  #mainHeader .nav-menu {
    display: none !important;
  }

  #mainHeader .mobile-toggle {
    display: flex !important;
  }

  /* Keep actions usable; hide only legacy login chip if present */
  #mainHeader .login-btn {
    display: none !important;
  }

  #mainHeader .header-container {
    gap: 8px;
  }

  #mainHeader .header-actions {
    margin-left: auto;
  }
}

/* --------------------------------------------------------------------------
   2) Home hero product line: redesign uses nowrap — clips EN/DE/HU on phones
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  html.rd .hero-title {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Force wrap for long “Trading · Fixed-Term Investment · Savings” etc. */
  html.rd .hero-title .rd-products,
  html.rd .hero-title .rd-accent.rd-products {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    display: block;
    padding-inline: 4px;
    box-sizing: border-box;
  }

  .hero-section .hero-content,
  .hero-section .container {
    max-width: 100%;
    min-width: 0;
  }

  .hero-section {
    overflow-x: clip;
  }
}

@media (max-width: 768px) {
  html.rd .hero-title {
    font-size: clamp(1.55rem, 6.5vw, 2.35rem) !important;
  }

  html.rd .hero-title .rd-products,
  html.rd .hero-title .rd-accent.rd-products {
    font-size: clamp(0.95rem, 4.6vw, 1.25rem) !important;
    line-height: 1.25;
    margin-top: 6px;
  }
}

@media (max-width: 430px) {
  html.rd .hero-title {
    font-size: clamp(1.4rem, 7vw, 2.05rem) !important;
  }
}

/* --------------------------------------------------------------------------
   2b) Stats glass under hero: less negative pull-up on mobile (was “stuck”)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  html.rd .stats-banner-section {
    padding-top: 8px;
    padding-bottom: 28px;
  }

  html.rd .stats-glass-grid {
    margin-top: -36px !important; /* was ~-80px — sit a bit lower */
    padding: 18px 16px !important;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  html.rd .stats-glass-grid .stat-card {
    padding-left: 4px;
    padding-right: 4px;
  }
}

@media (max-width: 480px) {
  html.rd .stats-glass-grid {
    margin-top: -28px !important;
    padding: 16px 14px !important;
  }
}

/* --------------------------------------------------------------------------
   3) Calculator hero title (HU 320): shrink + wrap long compound words
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  html.rd .calc-ui-hero h1,
  .calc-ui-hero h1 {
    font-size: clamp(1.4rem, 7.5vw, 1.85rem) !important;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }

  .calc-ui-hero,
  .calc-ui-hero .container {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  .calc-ui-crumb {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* --------------------------------------------------------------------------
   3b) Home calculator glass: equalize mobile padding (left was > right)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  html.rd .calculator-glass-box {
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box;
    overflow-x: clip;
  }

  html.rd .calculator-glass-box .calc-body-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 20px;
  }

  html.rd .calculator-glass-box .calc-controls,
  html.rd .calculator-glass-box .calc-result-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 20px 16px !important; /* equal L/R */
  }

  html.rd .calculator-glass-box .range-marks,
  html.rd .calculator-glass-box .custom-range-slider {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 0;
    padding-right: 0;
  }

  html.rd .calculator-glass-box .range-marks {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    overflow-wrap: anywhere;
    font-size: 0.68rem;
  }

  html.rd .calculator-glass-box .custom-select {
    max-width: 100%;
    box-sizing: border-box;
    padding-left: 14px;
    padding-right: 40px;
  }
}

@media (max-width: 480px) {
  html.rd .calculator-glass-box {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  html.rd .calculator-glass-box .calc-controls,
  html.rd .calculator-glass-box .calc-result-card {
    padding: 16px 14px !important;
  }
}

/* /calculator page panels — same equal padding */
@media (max-width: 768px) {
  .calc-ui-shell {
    box-sizing: border-box;
    overflow-x: clip;
  }

  .calc-ui-shell .calc-ui-panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 20px 16px !important;
  }
}

/* --------------------------------------------------------------------------
   4) Mobile drawer (hamburger): hide ugly native scrollbar, space action
      buttons, keep usable scroll on short screens / long languages.
   -------------------------------------------------------------------------- */
.mobile-drawer {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.mobile-drawer .drawer-header {
  flex-shrink: 0;
}

.mobile-drawer .drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  justify-content: flex-start;
  gap: 20px;
  padding: 20px 0 8px;
  /* Hide native scrollbar (still scrollable) */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* old Edge */
}

.mobile-drawer .drawer-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none; /* Chrome / Safari */
}

.mobile-drawer .mobile-nav-list {
  gap: 10px;
  flex-shrink: 0;
}

.mobile-drawer .mobile-nav-link {
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.mobile-drawer .drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto;
  padding-top: 14px;
  padding-bottom: 4px;
  flex-shrink: 0;
  /* Stay visible while nav list scrolls on short screens */
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--bg-surface, #0b1c31);
  box-shadow: 0 -12px 16px -8px rgba(0, 0, 0, 0.45);
}

/* Bootstrap .mb-2 is not globally available — kill stacked margins, use gap */
.mobile-drawer .drawer-actions .btn,
.mobile-drawer .drawer-actions .mb-2 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Narrow phones: slightly tighter drawer padding */
@media (max-width: 390px) {
  .mobile-drawer {
    width: min(100vw, 340px);
    padding: 18px 14px max(18px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-drawer .mobile-nav-link {
    font-size: 0.98rem;
    padding: 7px 0;
  }

  .mobile-drawer .drawer-actions {
    gap: 12px;
  }
}

/* Short / landscape viewports: keep both buttons visible with less nav gap */
@media (max-height: 560px) {
  .mobile-drawer .drawer-body {
    padding-top: 12px;
    gap: 12px;
  }

  .mobile-drawer .mobile-nav-list {
    gap: 6px;
  }

  .mobile-drawer .mobile-nav-link {
    padding: 5px 0;
    font-size: 0.95rem;
  }

  .mobile-drawer .drawer-actions {
    gap: 12px;
  }
}

/* --------------------------------------------------------------------------
   5) Inner pages only (NOT home /.hero-section):
      Header is sticky + in document flow, but .page-hero / *-ui-hero still use
      large padding-top (~104–170px) meant for a fixed overlapping header.
      That creates a big empty band under the header on almost every inner page.
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  html.rd .page-hero,
  .page-hero {
    padding-top: 36px !important;
    padding-bottom: 40px !important;
  }

  html.rd :is(.calc-ui-hero, .saving-ui-hero, .earn-ui-hero, .partner-ui-hero),
  :is(.calc-ui-hero, .saving-ui-hero, .earn-ui-hero, .partner-ui-hero) {
    padding-top: 36px !important;
    padding-bottom: 40px !important;
  }
}

@media (max-width: 640px) {
  html.rd .page-hero,
  .page-hero,
  html.rd :is(.calc-ui-hero, .saving-ui-hero, .earn-ui-hero, .partner-ui-hero),
  :is(.calc-ui-hero, .saving-ui-hero, .earn-ui-hero, .partner-ui-hero) {
    padding-top: 28px !important;
    padding-bottom: 32px !important;
  }

  html.rd .page-hero .breadcrumb,
  .page-hero .breadcrumb,
  html.rd :is(.calc-ui-crumb, .saving-ui-crumb, .earn-ui-crumb, .partner-ui-crumb) {
    margin-bottom: 14px;
  }
}
