/* ============================================================
   PlugNest v7 — Responsive layer (loads LAST, wins on mobile)
   Covers phones (iPhone/Android), tablets, and small laptops.
   ============================================================ */

/* Never allow sideways scroll on any device */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, table, pre { max-width: 100%; }

/* ── Fluid container padding ─────────────────────────────── */
@media (max-width: 768px) {
  .container-xl { padding: 0 18px; }
}
@media (max-width: 480px) {
  .container-xl { padding: 0 14px; }
}

/* ── Navbar: show hamburger from 900px (fixes the 641–900 gap) ── */
@media (max-width: 900px) {
  .pn-pill-ham { display: flex !important; }
  .pn-pill-cta { display: none !important; }
}
@media (max-width: 480px) {
  .pn-nav-outer { padding: 8px 10px; }
  .pn-pill { padding: 8px 9px !important; gap: 5px !important; }
  /* Shrink the logo so the whole icon row + hamburger fit inside the pill */
  .pn-pill-logo { gap: 6px !important; margin-right: 0 !important; }
  .pn-pill-logo-text { font-size: 14px !important; }
  /* keep the icon row tidy on small phones */
  .pn-pill-right { gap: 6px !important; }
}

/* ── Section rhythm shrinks on mobile ────────────────────── */
@media (max-width: 768px) {
  .pn-section { padding: 52px 0; }
  .pn-section-title { font-size: 1.7rem !important; }
  .py-80 { padding-top: 52px; padding-bottom: 52px; }
}
@media (max-width: 480px) {
  .pn-section { padding: 40px 0; }
  .pn-section-title { font-size: 1.45rem !important; }
}

/* ── Hero ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-3d-scene { grid-template-columns: 1fr !important; display: block !important; }
  .hero-text-col { max-width: 640px; }
}
@media (max-width: 640px) {
  /* Scale with the viewport so the longest line ("Plugins, Themes," — the
     widest of the three) always fits on one line and the heading stays 3
     lines. At a fixed 3.6rem it overflowed a 375px phone by 41px and wrapped
     to a 4th line. Capped at 3.6rem so tablets keep the original size. */
  .hero-v2-title { font-size: clamp(2.1rem, 11vw, 3.6rem) !important; line-height: 1.06 !important; }
  .hero-v2-sub { font-size: 14px !important; }
  .hero-v2-actions { flex-wrap: wrap; gap: 10px !important; }
  .hero-v2-actions a { width: 100%; justify-content: center; }
  /* Counters: single horizontal row of 4, shrunk to fit a phone width */
  .hero-v2-stats {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    max-width: none !important;
  }
  .hero-v2-stats .hero-stat { flex: 1; min-width: 0; }
  .hero-stat-num { font-size: 19px !important; }
  .hero-stat-label { font-size: 9px !important; letter-spacing: 0.3px !important; }
  .hero-eyebrow { font-size: 12px; }
}
/* (The old 420px step-down is gone — the clamp above now handles every
   narrow width continuously, instead of jumping between two fixed sizes.) */

/* ── Generic collapse helpers (added to inline grids) ────── */
/* Grid children default to min-width:auto — one long unbroken word can
   stretch a column under its sidebar. Let columns shrink + wrap anywhere. */
.pn-2col > *, .pn-2 > *, .pn-2-md > * { min-width: 0; }
.pn-2col h1, .pn-2col p, .pn-card-title, .pn-card-desc, .pn-article p {
  overflow-wrap: anywhere; word-break: break-word;
}

/* Sidebar layouts: content + right rail  (cart, checkout, product) */
@media (max-width: 900px) {
  .pn-2col { grid-template-columns: 1fr !important; gap: 22px !important; }
}
/* Two-up form pairs / stat pairs */
@media (max-width: 620px) {
  .pn-2 { grid-template-columns: 1fr !important; }
}
/* Spotlight-style big two-column feature blocks */
@media (max-width: 880px) {
  .pn-2-md { grid-template-columns: 1fr !important; gap: 32px !important; }
}
/* 3-across tier / pill grids */
@media (max-width: 560px) {
  .pn-3 { grid-template-columns: 1fr !important; }
}

/* ── Footer grid ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .pn-footer .row { grid-template-columns: 1fr 1fr 1fr !important; gap: 28px !important; }
}
@media (max-width: 620px) {
  .pn-footer .row { grid-template-columns: 1fr 1fr !important; }
  .pn-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 400px) {
  .pn-footer .row { grid-template-columns: 1fr !important; }
}
@media (max-width: 768px) {
  .pn-footer-bottom { flex-direction: column; gap: 14px; text-align: center; align-items: center; }
}

/* ── Cards & pricing ─────────────────────────────────────── */
@media (max-width: 480px) {
  .pn-price-card { padding: 24px 20px !important; }
  .pn-price-amount { font-size: 32px !important; }
  .pn-checkout-card { border-radius: 14px; }
}

/* ── Bank details: stack label over value so nothing gets clipped ── */
@media (max-width: 600px) {
  .pn-bank-table, .pn-bank-table tbody, .pn-bank-table tr, .pn-bank-table td { display: block; width: 100% !important; }
  .pn-bank-table tr { padding: 6px 0; }
  .pn-bank-table td { padding: 0 14px; font-size: 14px; }
  .pn-bank-table td:first-child { padding-top: 10px; padding-bottom: 3px; white-space: normal; }
  .pn-bank-table td:last-child {
    padding-bottom: 10px;
    overflow-wrap: anywhere; word-break: break-word;
  }
  .pn-bank-table td:last-child strong { overflow-wrap: anywhere; }
  .pn-copy-btn { display: inline-flex; margin: 6px 0 0 0; }
}

/* Any wide table in a card can scroll horizontally */
.pn-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Payment method tabs wrap on small screens ───────────── */
@media (max-width: 560px) {
  .pn-pay-tabs { flex-wrap: wrap; }
  .pn-pay-tab { flex: 1 1 45%; justify-content: center; }
}

/* ── Products page header search ─────────────────────────── */
@media (max-width: 480px) {
  .pn-cat-pills-scroll { padding: 12px 0; }
}

/* ── Buttons: full-width primary CTAs on phones ──────────── */
@media (max-width: 560px) {
  .btn-lg, .pn-auth-btn, .btn-primary.w-100 { width: 100%; justify-content: center; }
}

/* ── Auth pages ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .pn-auth-card { padding: 26px 20px !important; }
}

/* ════════════════════════════════════════════════════════════
   Mobile polish layer — Jul 2026 (marketplace, inbox, chatbot,
   filters, profiles, video, submit flow). Media-query only:
   desktop view is untouched.
   ════════════════════════════════════════════════════════════ */

/* ── iOS: prevent auto-zoom on focus (needs ≥16px inputs) ── */
@media (max-width: 768px) {
  input[type="text"], input[type="email"], input[type="url"], input[type="number"],
  input[type="password"], input[type="search"], textarea, select {
    font-size: 16px !important;
  }
}

/* ── Smooth touch scrolling on every inner scroll area ───── */
.al-body, .msg-thread, .msg-list, .pn-gsearch-results, .sub-dd-panel,
.es-dd-panel, .pn-flt-panel, .pn-cat-pills-scroll, .msg-details {
  -webkit-overflow-scrolling: touch;
}

/* ── Header actions: fit the full icon row (search·msg·cart·admin·dash·ham) ── */
@media (max-width: 480px) {
  .pn-search-btn, .pn-pill-cart, .pn-acct-btn, .pn-pill-ham {
    width: 37px !important; height: 37px !important;
    font-size: 15px !important; border-radius: 10px !important;
  }
  .pn-acct-btn img,
  .pn-acct-btn > span:not(.pn-acct-name) { width: 25px !important; height: 25px !important; }
  .pn-pill-logo-mark { width: 26px !important; height: 26px !important; font-size: 14px !important; border-radius: 8px; }
}
@media (max-width: 385px) {
  .pn-search-btn, .pn-pill-cart, .pn-acct-btn, .pn-pill-ham {
    width: 32px !important; height: 32px !important; font-size: 14px !important;
  }
  .pn-acct-btn img,
  .pn-acct-btn > span:not(.pn-acct-name) { width: 22px !important; height: 22px !important; }
  .pn-pill { gap: 4px !important; padding: 7px 8px !important; }
  .pn-pill-right { gap: 5px !important; }
  .pn-pill-logo-mark { width: 23px !important; height: 23px !important; font-size: 13px !important; }
  .pn-pill-logo-text { font-size: 13px !important; }
}

/* ── Browse Shop: type pills + filter dropdowns ──────────── */
@media (max-width: 560px) {
  /* pills shrink and wrap tight */
  .pn-flt summary { padding: 8px 12px; font-size: 11.5px; }
  /* dropdown panels span the full header width instead of hanging off-screen */
  .pn-flt { position: static; }
  .pn-flt-panel { left: 0; right: 0; min-width: 0; }
}

/* ── Product cards: slightly shorter media on phones ─────── */
@media (max-width: 480px) {
  .pn-card-thumb { height: 200px; }
  .pn-seller-badge { padding: 3px 9px 3px 3px; }
  .pn-seller-badge .pn-seller-name { max-width: 90px; font-size: 11px; }
}

/* ── Product page ────────────────────────────────────────── */
@media (max-width: 900px) {
  /* the sticky purchase box becomes normal flow under the content */
  .pn-2col > div[style*="sticky"] { position: static !important; top: auto !important; }
}
@media (max-width: 480px) {
  .pn-pricing-grid { grid-template-columns: 1fr !important; }
  video { border-radius: 12px; }
}

/* ── Profile page hero ───────────────────────────────────── */
@media (max-width: 560px) {
  .pn-avatar-glow[style*="104px"] { width: 84px !important; height: 84px !important; font-size: 32px !important; }
}

/* ── Messages inbox ──────────────────────────────────────── */
@media (max-width: 480px) {
  .msg-b { max-width: 88%; font-size: 13px; }
  .msg-thread { padding: 12px; }
  .msg-item { padding: 11px 12px; }
  .msg-av { width: 38px; height: 38px; font-size: 13px; }
  .msg-b img { max-width: 180px; max-height: 150px; }
}

/* ── Aleena chatbot ──────────────────────────────────────── */
@media (max-width: 480px) {
  .al-launcher { width: 54px; height: 54px; bottom: 16px; right: 16px; }
  .al-win { right: 12px; bottom: 80px; width: calc(100vw - 24px); height: min(560px, calc(100vh - 110px)); border-radius: 16px; }
  .al-msg { font-size: 12.5px; }
}

/* ── Global search popup ─────────────────────────────────── */
@media (max-width: 560px) {
  .pn-gsearch-overlay { padding: 4vh 10px 10px; }
  .pn-gsearch-input-row { padding: 13px 14px; }
  .pn-gsearch-results { max-height: 62vh; }
  .pn-gsearch-thumb { width: 38px; height: 38px; font-size: 17px; }
}

/* ── Submit Your Product ─────────────────────────────────── */
@media (max-width: 480px) {
  #model-pills { grid-template-columns: repeat(2, 1fr) !important; }
  .cp-grid { grid-template-columns: 1fr !important; }
  .sub-card { padding: 18px 14px; }
  .sub-preview-frame { animation: none; }   /* calmer on small screens */
}

/* ── Dashboard: level card ladder + purchased items ──────── */
@media (max-width: 480px) {
  .pn-lv-badge { font-size: 10.5px !important; padding: 4px 11px !important; }
}

/* ── Admin panel & dashboard tables: scroll, don't squish ── */
@media (max-width: 768px) {
  .pn-checkout-card div[style*="overflow-x:auto"] > table { min-width: 640px; }
}

/* ── Modals (review, video, on-demand, purchase) breathe ─── */
@media (max-width: 400px) {
  #pn-rev-card, #pn-vid-card, #pn-od-card, #pn-buy-card { padding: 22px 16px !important; }
}

/* ── Homepage stats banner: 2×2 grid, smaller numbers ────── */
@media (max-width: 600px) {
  .pn-stats-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 26px 16px !important;
    max-width: 380px;
    margin: 0 auto;
  }
  .pn-stat-big { font-size: 2rem !important; }
}
@media (max-width: 340px) {
  .pn-stat-big { font-size: 1.7rem !important; }
}

/* ── Homepage seller-levels section ──────────────────────── */
@media (max-width: 480px) {
  .lv-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .lv-card-in { padding: 18px 12px 16px; }
  .lv-share { font-size: 1.4rem; }
  .lv-icon { width: 56px; height: 56px; font-size: 26px; }
  .lv-req { font-size: 10px; }
  .lv-gift { font-size: 10px; padding: 7px 8px; }
}
@media (max-width: 360px) {
  .lv-grid { grid-template-columns: 1fr; }
}

/* ── Docs / FAQ / tutorials touch targets ────────────────── */
@media (max-width: 480px) {
  .dc-q, .fq-q { padding: 14px 14px; font-size: 13.5px; }
  .dc-a-in, .fq-a-in { padding: 0 14px 14px; font-size: 13px; }
  .vt-grid { gap: 14px; }
}

/* ── Email-support / support forms ───────────────────────── */
@media (max-width: 480px) {
  .es-grad-frame { border-radius: 16px; }
  .es-drop { padding: 16px 10px; }
}

/* ── Announcement ribbon: smaller text so it fits in 2 lines ─ */
@media (max-width: 560px) {
  .pn-ribbon { font-size: 10px; padding: 7px 12px; line-height: 1.45; letter-spacing: 0; }
}
@media (max-width: 380px) {
  .pn-ribbon { font-size: 9px; padding: 6px 10px; }
}

/* ── Checkout steps + trust rows wrap gracefully ─────────── */
@media (max-width: 480px) {
  .pn-checkout-steps { max-width: 100% !important; }
  .pn-trust-row { gap: 8px 14px; }
}

/* ── iOS Safari: dynamic viewport (toolbar-safe heights) ─── */
@supports (height: 100dvh) {
  @media (max-width: 820px) {
    .msg-wrap { height: calc(100dvh - 170px); }
    .al-win  { max-height: calc(100dvh - 110px); }
    .pn-gsearch-results { max-height: 58dvh; }
  }
}
