/* ============================================================
   Kreditzen — Mobile Responsive Overrides
   Enhances mobile UX without affecting the desktop layout.
   ============================================================ */

/* Prevent horizontal scroll globally on mobile */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; max-width: 100%; }
}

/* ── Landing page layout classes (replace inline styles) ──── */
.kz-landing-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 96px 48px 80px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 72px;
  align-items: center;
}

.kz-landing-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px 80px;
}

.kz-landing-cta {
  text-align: center;
  padding: 60px 48px 80px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.kz-landing-footer-bar {
  padding: 24px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Mobile-only shell additions (hidden on desktop) ────────── */
.kz-hamburger           { display: none; }
.kz-topbar-mobile-brand { display: none; }
.kz-topbar-spacer       { flex: 1; }

.kz-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 22, 45, 0.52);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 190;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.kz-sidebar-overlay.is-open { display: block; }

.kz-bottom-nav { display: none; }

/* ── Bottom nav item styles ─────────────────────────────────── */
.kz-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--fg-3);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  transition: color 0.18s ease, background 0.18s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
}
.kz-bottom-nav-item:hover,
.kz-bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-tint);
}
.kz-bottom-nav-item svg { flex-shrink: 0; }
.kz-bnav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-top: 2px;
}

/* ============================================================
   ≤ 900px — Tablet / large phone
   ============================================================ */
@media (max-width: 900px) {

  /* Sidebar: slide-over drawer instead of a static column */
  .kz-sidebar {
    display: flex !important;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 280px;
    height: 100dvh;
    height: 100vh; /* fallback */
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
  }
  .kz-sidebar.is-open {
    transform: translateX(0);
  }

  /* Hamburger button */
  .kz-hamburger {
    display: inline-flex;
    flex-shrink: 0;
  }

  /* Brand in topbar */
  .kz-topbar-mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 17px;
    color: var(--fg-1);
    letter-spacing: -0.02em;
    text-decoration: none;
  }

  /* The spacer between brand and right-side icons */
  .kz-topbar-spacer { display: none; }

  /* Search bar: hide wide bar (Cmd+K still works via kz-app.js) */
  .kz-topbar .kz-search-wrap { display: none; }

  /* Logout: hidden on mobile — accessible from sidebar */
  .kz-topbar .kz-btn-dark { display: none; }

  /* Topbar tighter on mobile */
  .kz-topbar { padding: 0 12px; gap: 6px; }

  /* Bottom nav visible */
  .kz-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 4px 8px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    gap: 4px;
  }

  /* Push page content above bottom nav */
  .kz-main { padding-bottom: 72px; }

  /* Landing nav: hide text links on tablet/mobile */
  .kz-landing-nav .kz-landing-link { display: none; }

  /* Hero: single column — hide preview card, stack text only */
  .kz-landing-hero {
    grid-template-columns: 1fr;
    padding: 40px 24px 36px;
    gap: 0;
  }
  .kz-landing-preview-card { display: none; }

  /* Section and footer paddings */
  .kz-landing-section     { padding: 0 24px 48px; }
  .kz-landing-cta         { padding: 40px 24px 60px; }
  .kz-landing-footer-bar  { padding: 20px 24px; }
  .kz-landing-nav         { padding: 14px 20px; }

  /* Prevent any overflow from descendants */
  .kz-landing-outer { overflow-x: hidden; }
}

/* ============================================================
   ≤ 768px — Phone
   ============================================================ */
@media (max-width: 768px) {

  /* Auth form: more compact padding on phone */
  .kz-auth-form-side { padding: 32px 24px; }

  /* Page head: stack on mobile */
  .kz-page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }
  .kz-page-head > .kz-row { width: 100%; flex-wrap: wrap; }

  /* Flash container */
  #kz-flash-container { padding: 0 var(--sp-4); }

  /* Tables: horizontal scroll */
  .kz-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Topbar tighter */
  .kz-topbar { padding: 0 10px; gap: 4px; }
}

/* ============================================================
   ≤ 480px — Small phones
   ============================================================ */
@media (max-width: 480px) {
  /* Landing hero title smaller */
  .kz-landing-hero h1 { font-size: clamp(36px, 10vw, 52px); }

  /* Language button icon-only */
  .kz-topbar #kz-lang-btn { padding: 0 8px; font-size: 12px; }

  /* Page padding tighter */
  .kz-page { padding: var(--sp-4); }

  /* Landing nav ghost login hidden too, only Start Free visible */
  .kz-landing-nav .kz-btn-ghost { display: none; }
}

/* ============================================================
   Dark theme adjustments
   ============================================================ */
[data-theme="dark"] .kz-sidebar-overlay {
  background: rgba(0, 10, 24, 0.65);
}
[data-theme="dark"] .kz-bottom-nav {
  background: var(--bg-surface);
}
