/* ============================================================
   VENDO — Responsive.css
   Sitewide mobile-first responsive rules.
   Loaded by BOTH public pages AND dashboard layouts.
   Breakpoints:
     1200px — large tablet / small laptop
     1024px — tablet landscape
      768px — tablet portrait
      640px — large phone
      480px — phone
      380px — small phone
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   1. GLOBAL UTILS
   ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

img, video { max-width: 100%; height: auto; }

/* Prevent horizontal scroll everywhere */
html, body { max-width: 100%; overflow-x: hidden; }

/* Scrollable tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.table-responsive::-webkit-scrollbar { display: none; }

/* Hide scrollbar on any horizontal scroll container */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  flex-wrap: nowrap;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* Utility: hide/show at breakpoints */
.hide-on-mobile  { }
.show-on-mobile  { display: none !important; }
@media (max-width: 768px) {
  .hide-on-mobile { display: none !important; }
  .show-on-mobile { display: block !important; }
}

/* ────────────────────────────────────────────────────────────
   2. CONTAINER
   ──────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 640px) { .container { padding: 0 16px; } }
@media (max-width: 380px) { .container { padding: 0 12px; } }

/* ────────────────────────────────────────────────────────────
   3. PUBLIC HEADER
   ──────────────────────────────────────────────────────────── */
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: nowrap;
}

/* Desktop nav hidden < 768, hamburger shown */
@media (max-width: 768px) {
  .nav { display: none; }
  .hamburger { display: flex; }
  /* Hide text buttons, keep icon-only ones */
  .header-actions .btn-ghost,
  .header-actions .btn-primary { display: none; }
}
@media (max-width: 480px) {
  /* On very small screens hide currency selector too */
  .curr-dropdown { display: none; }
}

/* Mobile nav drawer */
#mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border-top: 1px solid #f0f0f8;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 400;
  max-height: 90vh;
  overflow-y: auto;
}
#mobile-nav.open { display: block; }
.mobile-nav-inner {
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
}
.mobile-nav-inner .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 9px;
  color: #374151;
  font-weight: 500;
  font-size: .92rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.mobile-nav-inner .nav-link:hover { background: #f5f3ff; color: #4f46e5; }
.mobile-nav-inner .nav-link.danger { color: #dc2626; }
.mobile-nav-inner .nav-link.danger:hover { background: #fef2f2; }
.mobile-divider {
  height: 1px;
  background: #f3f4f6;
  margin: 8px 0;
}
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.mobile-user-info img {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
}
.mobile-user-name  { font-size: .88rem; font-weight: 700; color: #111827; }
.mobile-user-email { font-size: .74rem; color: #9ca3af; }
.mobile-cta-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px 4px;
}
.mobile-cta-row .btn { flex: 1; justify-content: center; text-align: center; }

/* ────────────────────────────────────────────────────────────
   4. DASHBOARD SIDEBAR
   ──────────────────────────────────────────────────────────── */

/* On mobile: sidebar is fixed, slides in from left */
@media (max-width: 1024px) {
  .dashboard-sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1) !important;
    width: 260px !important;
  }
  .dashboard-sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 32px rgba(0,0,0,.2);
  }
  .dashboard-main {
    margin-left: 0 !important;
  }
  .topbar-hamburger {
    display: flex !important;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }
}

/* Dashboard topbar responsive */
@media (max-width: 640px) {
  .dashboard-topbar {
    padding: 0 12px;
    height: 52px;
  }
  .topbar-user span { display: none !important; }
}

/* ────────────────────────────────────────────────────────────
   5. DASHBOARD CONTENT
   ──────────────────────────────────────────────────────────── */

/* Stats grid: 4 → 2 → 2 → 1 */
.stats-grid,
.vd-stats,
.prd-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1024px) {
  .stats-grid, .vd-stats, .prd-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid, .vd-stats, .prd-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* Page header stacks on mobile */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 600px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header > *:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-header .btn { flex: 1; justify-content: center; min-width: 0; }
}

/* Form cards */
@media (max-width: 640px) {
  .dash-form-card { padding: 16px; }
  .dash-form-card h3 { font-size: .9rem; }
}

/* All data tables: horizontal scroll */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  .data-table th,
  .data-table td { padding: 10px 12px; font-size: .8rem; }
}

/* Dashboard content padding */
.dashboard-content {
  padding: 24px;
}
@media (max-width: 768px) {
  .dashboard-content { padding: 16px; }
}
@media (max-width: 480px) {
  .dashboard-content { padding: 12px; }
}

/* Two-column dash layouts → single on mobile */
@media (max-width: 860px) {
  .pa-layout,
  .cp-layout,
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns: 1fr 340px"],
  [style*="grid-template-columns:1fr 310px"],
  [style*="grid-template-columns: 1fr 310px"],
  [style*="grid-template-columns:1fr 360px"],
  [style*="grid-template-columns: 1fr 360px"] {
    grid-template-columns: 1fr !important;
  }
}

/* Product creation form specific */
@media (max-width: 860px) {
  .pa-row2, .pa-row3, .cp-row-2, .cp-row-3,
  .pa-section .price-grid { grid-template-columns: 1fr !important; }
}

/* Dashboard grid (recent + top products) */
.vd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .vd-grid { grid-template-columns: 1fr; }
}

/* Vendor products grid */
.prd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .prd-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .prd-grid { grid-template-columns: 1fr; } }

/* ────────────────────────────────────────────────────────────
   6. ADMIN SPECIFIC
   ──────────────────────────────────────────────────────────── */

/* Admin vendor table: hide less critical cols */
@media (max-width: 768px) {
  .v-col-joined,
  .v-col-rating,
  .v-col-events { display: none; }
}

/* Admin tabs (settings) — horizontal scroll */
@media (max-width: 640px) {
  [style*="border-radius:14px"][style*="display:flex"] {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  [style*="border-radius:14px"][style*="display:flex"] a {
    white-space: nowrap;
    font-size: .78rem;
    padding: 8px 12px;
  }
}

/* Dash tabs */
.dash-tabs {
  overflow-x: auto;
  flex-wrap: nowrap !important;
  scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 560px) {
  .dash-tab { padding: 9px 12px; font-size: .8rem; white-space: nowrap; }
}

/* ────────────────────────────────────────────────────────────
   7. PUBLIC PAGES — HOMEPAGE
   ──────────────────────────────────────────────────────────── */

/* Hero */
@media (max-width: 768px) {
  .vhero { min-height: auto; padding: 80px 0 60px; }
  .vhero-container { grid-template-columns: 1fr !important; text-align: center; }
  .vhero-float { display: none; }
  .vhero-headline { font-size: clamp(1.8rem, 8vw, 2.8rem) !important; }
  .vhero-ctas { justify-content: center; }
}
@media (max-width: 480px) {
  .vhero-ctas { flex-direction: column; align-items: stretch; }
  .vhero-ctas a { text-align: center; justify-content: center; }
}

/* Section headers */
@media (max-width: 640px) {
  .section-header { margin-bottom: 28px !important; }
  .section-header h2 { font-size: clamp(1.4rem, 5vw, 2rem) !important; }
}

/* Features grid */
.hs-features-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px)  { .hs-features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .hs-features-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* Steps */
.hs-steps-grid {
  display: flex;
  align-items: flex-start;
}
@media (max-width: 640px) {
  .hs-steps-grid { flex-direction: column; align-items: center; gap: 24px; }
  .hs-step-connector { transform: rotate(90deg); }
}

/* Course grid */
.hs-courses-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1200px) { .hs-courses-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .hs-courses-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .hs-courses-grid { grid-template-columns: 1fr; } }

/* Category grid */
@media (max-width: 900px) { .hs-categories-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .hs-categories-grid { grid-template-columns: repeat(2, 1fr); } }

/* Tools grid */
@media (max-width: 860px) { .hs-tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .hs-tools-grid { grid-template-columns: 1fr; } }

/* Testimonials */
@media (max-width: 900px) { .hs-testimonials-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .hs-testimonials-grid { grid-template-columns: 1fr; } }

/* Stats banner */
@media (max-width: 640px) {
  .hs-stats-inner { gap: 0; }
  .hs-stat-item { padding: 12px 16px; }
  .hs-stat-value { font-size: 1.6rem; }
  .hs-stat-divider { display: none; }
}

/* CTA */
@media (max-width: 480px) {
  .hs-cta-btns { flex-direction: column; align-items: stretch; }
  .hs-cta-btns a { text-align: center; justify-content: center; }
}

/* ────────────────────────────────────────────────────────────
   8. MARKETPLACE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mkt-layout {
    grid-template-columns: 1fr !important;
  }
  .mkt-sidebar {
    position: static !important;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .mkt-sidebar::-webkit-scrollbar { display: none; }
  .mkt-filter-card { min-width: 180px; flex-shrink: 0; }
}
@media (max-width: 1000px) { .mkt-grid { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 540px)  { .mkt-grid { grid-template-columns: 1fr !important; } }

/* ────────────────────────────────────────────────────────────
   9. PRODUCT DETAIL PAGE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .pd-hero-inner,
  .pd-layout { grid-template-columns: 1fr !important; }
  .pd-buy-card { display: none; }
  .pd-hero-image-strip { display: none; }
  .pd-sticky-bar { display: flex !important; }
}
@media (max-width: 600px) {
  .pd-hero { padding: 28px 0 0 !important; }
  .pd-hero-title { font-size: 1.4rem !important; }
  .pd-section-bd { padding: 14px !important; }
  .pd-event-grid { grid-template-columns: 1fr !important; }
  .pd-includes { grid-template-columns: 1fr !important; }
  .pd-rating-summary { grid-template-columns: 1fr !important; }
}

/* ────────────────────────────────────────────────────────────
   10. ABOUT PAGE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .ab-two-col { grid-template-columns: 1fr !important; gap: 32px !important; }
  .ab-two-col-rev { direction: ltr !important; }
  .ab-values-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .ab-stat { padding: 12px 20px !important; }
}
@media (max-width: 560px) {
  .ab-values-grid { grid-template-columns: 1fr !important; }
  .ab-stat-div { display: none !important; }
  .ab-hero h1 { font-size: 1.7rem !important; }
}

/* ────────────────────────────────────────────────────────────
   11. AUTH PAGES (login / register)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .auth-card,
  .auth-wrap .auth-card { padding: 24px 18px !important; }
  .auth-title { font-size: 1.4rem !important; }
}

/* Register page two-column fields */
@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr !important; }
}

/* ────────────────────────────────────────────────────────────
   12. CHECKOUT PAGE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .checkout-grid { grid-template-columns: 1fr !important; }
  .checkout-grid > div:last-child { position: static !important; }
}

/* ────────────────────────────────────────────────────────────
   13. VENDOR STORE PAGE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .vendor-store-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .vendor-store-grid { grid-template-columns: 1fr !important; }
}

/* ────────────────────────────────────────────────────────────
   14. FOOTER
   ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px !important;
  }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 24px !important; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 8px; }
}

/* ────────────────────────────────────────────────────────────
   15. MODALS
   ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  /* Any modal with max-width set via inline style */
  [style*="max-width:740px"],
  [style*="max-width: 740px"],
  [style*="max-width:680px"],
  [style*="max-width: 680px"],
  [style*="max-width:600px"],
  [style*="max-width: 600px"] {
    max-width: calc(100vw - 24px) !important;
    margin: 12px !important;
  }
}

/* ────────────────────────────────────────────────────────────
   16. FORMS — universal fluid controls
   ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Any inline two/three col grid → single col */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Price grid */
  .price-grid { grid-template-columns: 1fr !important; }
  /* Inline stat rows */
  [style*="display:flex"][style*="gap:2"] { flex-wrap: wrap !important; }
}

/* ────────────────────────────────────────────────────────────
   17. CART SIDEBAR (already handled but reinforce)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .cart-sidebar { width: 100% !important; }
  .cs-hd, .cs-body, .cs-ft { padding-left: 14px !important; padding-right: 14px !important; }
}

/* ────────────────────────────────────────────────────────────
   18. PRINT
   ──────────────────────────────────────────────────────────── */
@media print {
  .header, .footer, .cart-sidebar, .cart-overlay,
  .dashboard-sidebar, .dashboard-topbar,
  .pd-sticky-bar { display: none !important; }
  .pd-hero { background: #fff !important; color: #000 !important; }
  body { font-size: 12pt; }
}

/* ── Certificate mobile ── */
@media (max-width: 768px) {
  .cert-page { padding: 14px 10px 40px; }
  .cert-wrap { max-width: 100%; }
  .cert-controls { gap: 6px; }
  .ctrl { padding: 7px 11px; font-size: .78rem; }
  .tmpl-picker { gap: 8px; padding: 12px 14px; }
  .tmpl-thumb { width: 80px; height: 56px; }
  .cert-outer { box-shadow: 0 8px 24px rgba(0,0,0,.15); }
  /* Scale cert content for small screens */
  .ct-title    { font-size: clamp(1rem, 6vw, 1.8rem) !important; letter-spacing: .1em !important; }
  .ct-subtitle { font-size: clamp(.5rem, 2vw, .75rem) !important; }
  .ct-name     { font-size: clamp(1rem, 6vw, 2rem) !important; }
  .ct-body     { font-size: clamp(.38rem, 1.4vw, .7rem) !important; max-width: 80% !important; }
  .ct-course   { font-size: clamp(.42rem, 1.6vw, .72rem) !important; }
  .ct-badge-img{ width: clamp(18px, 5vw, 36px) !important; height: clamp(18px, 5vw, 36px) !important; }
  .ct-sig-name { font-size: clamp(.38rem, 1.4vw, .7rem) !important; }
  .ct-sig-script{font-size: clamp(.7rem, 2.8vw, 1.4rem) !important; }
  .cert-logo   { height: clamp(14px, 4vw, 28px) !important; }
}

/* ── Pricing page mobile ── */
@media (max-width: 600px) {
  .pr-grid { grid-template-columns: 1fr !important; padding: 28px 0 0 !important; }
  .pr-hero h1 { font-size: 1.6rem !important; }
  .pr-cert-grid { grid-template-columns: 1fr 1fr !important; }
  .plans-grid { grid-template-columns: 1fr !important; }
}

/* ── API docs mobile ── */
@media (max-width: 860px) {
  .docs-wrap { grid-template-columns: 1fr !important; padding: 0 16px; }
  .docs-sidebar { display: none !important; }
  .docs-main { padding: 28px 0 60px; }
  pre { font-size: .72rem !important; }
}

/* ── Affiliate page mobile ── */
@media (max-width: 640px) {
  .aff-grid { grid-template-columns: repeat(2,1fr) !important; }
}
