/* ===================================================================
   MOBILE OVERHAUL — 2026-05-17 (Pinky) — Full-screen nav overlay,
   44px+ touch targets, Safari 16px no-zoom, hero clamp, cards grid
   =================================================================== */

/* iOS Safari font-size 16px prevents auto-zoom on focus */
@media (max-width: 640px) {
  input, select, textarea {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
  }
}

/* ===== NAV — FULL-SCREEN OVERLAY (slide from right) ===== */
@media (max-width: 900px) {
  /* Hide desktop nav links by default on mobile/tablet */
  .nav-links {
    position: fixed !important;
    top: 0;
    right: 0;
    width: min(100vw, 420px);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #0f1e37 0%, #0a1426 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateX(105%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    z-index: 9999;
    padding: 88px 24px 32px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column !important;
    gap: 6px !important;
    align-items: stretch !important;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  }
  .nav-links.open,
  .nav-links[aria-expanded="true"] {
    transform: translateX(0);
  }
  body.nav-open {
    overflow: hidden;
  }
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    animation: navBackdropIn .25s ease;
  }
  @keyframes navBackdropIn {
    from { opacity: 0 }
    to { opacity: 1 }
  }

  /* Burger: visible, 44px touch */
  .burger {
    display: inline-flex !important;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10000;
  }
  .burger svg { width: 26px; height: 26px; }
  .burger[aria-expanded="true"] svg { transform: rotate(90deg); }

  /* Nav items inside drawer: full-width buttons 56px */
  .nav-links > .nav-item,
  .nav-links > a {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }
  .nav-links a,
  .nav-trigger {
    width: 100%;
    padding: 16px 18px !important;
    font-size: 17px !important;
    font-weight: 500;
    min-height: 52px;
    color: rgba(255, 255, 255, .95) !important;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .nav-links a:hover,
  .nav-trigger:hover,
  .nav-item.has-dropdown:hover .nav-trigger {
    background: rgba(43, 118, 187, .3) !important;
    color: #fff !important;
  }

  /* Dropdowns: accordion expandable */
  .nav-item.has-dropdown {
    display: block !important;
    width: 100%;
  }
  .dropdown {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: hidden !important;
    background: rgba(0, 0, 0, .25) !important;
    border: 0 !important;
    border-radius: 0 0 10px 10px !important;
    box-shadow: none !important;
    padding: 4px 0 12px 16px !important;
    margin: 0 !important;
    width: 100%;
    min-width: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, visibility 0s linear .3s;
    display: block !important;
  }
  .nav-item.has-dropdown.is-open .dropdown,
  .nav-item.has-dropdown[aria-expanded="true"] .dropdown {
    visibility: visible !important;
    max-height: 1200px;
    transition: max-height .4s ease, visibility 0s linear 0s;
  }
  .dropdown-item {
    padding: 12px 14px !important;
    min-height: 48px;
    font-size: 15.5px !important;
    border-radius: 8px;
  }
  .nav-trigger .chevron {
    margin-left: auto;
  }
  .nav-item.has-dropdown.is-open .chevron {
    transform: rotate(180deg);
  }

  /* Language switcher in drawer */
  .nav-lang {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .nav-lang .dropdown {
    visibility: visible !important;
    max-height: none !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px 0 !important;
  }
  .nav-lang .dropdown-item {
    padding: 10px 8px !important;
    min-height: 56px;
    flex-direction: column;
    text-align: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
  }
  .nav-lang .dropdown-item .dd-flag { font-size: 22px; margin-bottom: 4px; }
  .nav-lang .dropdown-item .dd-label { font-size: 11.5px; }
  .nav-lang .dropdown-item.is-current {
    background: var(--brand-1, #1E3A5F) !important;
    border: 1px solid rgba(255, 255, 255, .25);
  }
  .nav-lang-trigger { display: none !important; }
  .nav-cta { display: none !important; }
}

/* ===== HERO TIGHT MOBILE ===== */
@media (max-width: 640px) {
  .hero {
    padding: 56px 0 64px !important;
  }
  .hero h1,
  .hero .h1 {
    font-size: clamp(1.85rem, 7.5vw, 2.6rem) !important;
    line-height: 1.15 !important;
    word-break: break-word;
    hyphens: auto;
  }
  .hero p,
  .hero .lead {
    font-size: 16px !important;
    line-height: 1.55 !important;
  }
  .hero .btn,
  .btn {
    min-height: 48px;
    padding: 12px 22px !important;
    font-size: 15px !important;
  }
}

/* ===== CARDS GRID — 2-col on 414-640, 1-col on <414 ===== */
@media (max-width: 640px) {
  .product-grid,
  .grid,
  .cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .product-card .body,
  .product-card .desc {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }
  .product-card h4 { font-size: 14.5px !important; line-height: 1.25; }
  .product-card .img { aspect-ratio: 4/3; }
}
@media (max-width: 380px) {
  .product-grid,
  .grid,
  .cards {
    grid-template-columns: 1fr !important;
  }
}

/* ===== FORMS — Safari no-zoom + 48px buttons ===== */
@media (max-width: 640px) {
  .form-row,
  .row2,
  .row3 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  input[type=text],
  input[type=email],
  input[type=tel],
  input[type=url],
  input[type=number],
  input[type=search],
  input[type=password],
  textarea,
  select {
    width: 100%;
    padding: 14px 12px !important;
    border-radius: 10px;
  }
  button[type=submit],
  .btn.red,
  .btn-primary {
    width: 100%;
    min-height: 52px;
    font-size: 16px !important;
  }
}

/* ===== FOOTER STACK ===== */
@media (max-width: 640px) {
  footer .container,
  footer-grid,
  .footer-cols {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  footer h3, footer h4 { font-size: 15px; }
  footer a { padding: 4px 0; display: inline-block; }
}

/* ===== ADMIN MOBILE — tables horizontal scroll ===== */
@media (max-width: 900px) {
  .admin-header { flex-direction: column; align-items: flex-start !important; gap: 16px; }
  .panel { padding: 18px !important; border-radius: 10px; }
  .data {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    white-space: nowrap;
  }
  .data thead, .data tbody, .data tr {
    display: table;
    width: max-content;
    min-width: 100%;
  }
  /* Preview modal mobile: full-screen */
  .apv-dialog { inset: 0 !important; border-radius: 0 !important; }
  .apv-head { padding: 10px 14px !important; flex-wrap: wrap; gap: 6px; }
  .apv-actions { gap: 5px; }
  .apv-vp { margin-right: 4px; }
}

/* ===== ANTI-OVERFLOW (PINKY-MOBILE-SAFE-v2 reinforce) ===== */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}
img, video, svg, canvas, iframe {
  max-width: 100%;
  height: auto;
}
main, section, header, footer, nav { max-width: 100vw; }

/* ===== TOUCH TARGETS GLOBAL ===== */
@media (max-width: 900px) {
  a, button, .btn, .nav-trigger, .dropdown-item {
    min-height: 44px;
  }
}

/* === MOBILE V2 FIX 2026-05-17 22:00 === */

/* Drop backdrop-filter blur — Chromium/iOS Safari render issues with drawer text */
@media (max-width: 900px) {
  .nav-links {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0d1d36 !important; /* solid dark, no transparency */
  }
  body.nav-open::before {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, .65) !important;
  }
  /* Force text visibility inside drawer */
  .nav-links a,
  .nav-links .nav-trigger,
  .nav-links .dropdown-item,
  .nav-links .dd-label,
  .nav-links span {
    color: #fff !important;
  }
}

/* === COLOR-PICKER VARIANT DOTS — PROFESSIONAL PILLS === */
@media (max-width: 900px) {
  .color-variants {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    background: rgba(0, 0, 0, .35);
    border-radius: 14px;
    margin: 12px auto !important;
    width: fit-content;
    max-width: 90%;
  }
  .color-chip {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, .25) !important;
    background: transparent !important;
    overflow: hidden;
    cursor: pointer;
    transition: all .2s;
    position: relative;
  }
  .color-chip .swatch {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    display: block;
  }
  .color-chip span:not(.swatch) {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none;
  }
  .color-chip.active,
  .color-chip[aria-pressed="true"] {
    border-color: #fff !important;
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .15), 0 4px 12px rgba(0, 0, 0, .4);
  }
  .color-picker-label { text-align: center; font-size: 13px; padding: 0 12px; }
  .color-picker-label .selected { font-weight: 700; color: var(--accent, #f59e0b); }
}

/* === HERO PROGRESS DOTS — kompaktowe paski 2026-05-17 22:11 === */
@media (max-width: 900px) {
  /* Override global min-height:44px for hero progress segments */
  .hero-progress {
    gap: 6px !important;
    padding: 8px 14px !important;
    background: rgba(0, 0, 0, .55) !important;
    border-radius: 14px;
    width: fit-content;
    margin: 12px auto !important;
  }
  .hero-progress .seg {
    width: 22px !important;
    height: 6px !important;
    min-height: 6px !important;
    min-width: 22px !important;
    border-radius: 99px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, .25) !important;
    border: 0 !important;
    cursor: pointer;
    transition: all .25s;
    flex: none;
  }
  .hero-progress .seg.active {
    width: 36px !important;
    min-width: 36px !important;
    background: var(--red, #C82A18) !important;
  }
  .hero-progress .seg:hover { background: rgba(255, 255, 255, .45) !important; }
}

/* === FIX ACCORDION OVERLAP 2026-05-17 22:18 === */
@media (max-width: 900px) {
  /* All drawer items: do NOT shrink */
  .nav-links > * {
    flex-shrink: 0 !important;
    flex-grow: 0;
  }
  /* nav-item with dropdown: vertical flex column so dropdown stretches inline */
  .nav-links .nav-item.has-dropdown {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .nav-links .nav-item.has-dropdown .nav-trigger {
    flex-shrink: 0 !important;
  }
  .nav-links .nav-item.has-dropdown .dropdown {
    flex-shrink: 0 !important;
    height: auto !important;
  }
  /* Ensure dropdown is in normal flow when open (kill any abs/transform from desktop CSS) */
  .nav-links .nav-item.has-dropdown.is-open .dropdown {
    position: static !important;
    transform: none !important;
    height: auto !important;
    max-height: 2000px !important;
    overflow: visible !important;
  }
}
