/* ============================================================
   responsive-patch.css
   Spiffy LLC — Patch for all new pages (June 2026 session)
   Add to existing responsive.css OR include separately in header.php
   ============================================================ */

/* ── Global table fix ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .data-table,
  .earn-table,
  .po-table,
  .splits-table,
  .seo-table,
  .bkp-table,
  .vod-size-table,
  .or-size-table,
  .or-schedule-table,
  .upload-table,
  .bd-completed-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* ── Stat grids → 2 col on mobile ────────────────────────────── */
@media (max-width: 640px) {
  .earn-cards,
  .po-stats,
  .bd-stats,
  .vdb-stats,
  .or-summary-grid,
  .seo-stat-grid,
  .bkp-stats,
  .vod-summary-bar {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .vod-summary-bar {
    flex-wrap: wrap;
  }
  .vod-sum-item {
    flex: 1 1 50%;
    border-right: none !important;
    border-bottom: 1px solid #f1f5f9;
  }
}

@media (max-width: 400px) {
  .earn-cards,
  .po-stats,
  .bd-stats,
  .or-summary-grid,
  .bkp-stats {
    grid-template-columns: 1fr !important;
  }
}

/* ── Chat / Messages layout ───────────────────────────────────── */
@media (max-width: 800px) {
  .om-layout,
  .vom-msg-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .om-sidebar,
  .vom-thread-list {
    max-height: 220px;
    border-right: none !important;
    border-bottom: 1px solid #f1f5f9;
  }
  .om-chat,
  .vom-chat {
    min-height: 400px;
  }
  .om-input-area,
  .vom-input-area {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 10;
    border-top: 1px solid #f1f5f9;
  }
}

/* ── Order tracking progress bar ─────────────────────────────── */
@media (max-width: 768px) {
  .ot-progress-track {
    overflow-x: auto;
    padding-bottom: 12px;
  }
  .ot-prog-label {
    font-size: 9px !important;
    max-width: 48px !important;
  }
  .ot-prog-dot {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
  }
  .ot-tl-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
  }
}

/* ── Order item body ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .or-item-body {
    grid-template-columns: 1fr !important;
  }
  .or-detail-col {
    border-right: none !important;
    border-bottom: 1px solid #f1f5f9;
  }
  .or-addons-col {
    background: #fff !important;
  }
}

/* ── Vendor order detail ──────────────────────────────────────── */
@media (max-width: 768px) {
  .vod-header {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .vod-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-vod-download,
  .btn-vod-confirm,
  .btn-vod-print {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  .vod-addon-specs {
    grid-template-columns: 1fr !important;
  }
  .vod-logos-grid {
    gap: 10px;
  }
  .vod-logo-img {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ── Brand/collection page ────────────────────────────────────── */
@media (max-width: 900px) {
  .bp-layout {
    grid-template-columns: 1fr !important;
    padding-top: 16px !important;
  }
  .bp-sidebar-inner {
    position: static !important;
  }
  .bp-hero-inner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
  .bp-hero-meta {
    align-items: flex-start !important;
  }
  .bp-contact-chips {
    justify-content: flex-start !important;
  }
  .bp-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 480px) {
  .bp-grid {
    grid-template-columns: 1fr !important;
  }
  .bp-prod-actions {
    grid-template-columns: 1fr !important;
  }
}

/* ── Admin pages header ───────────────────────────────────────── */
@media (max-width: 768px) {
  .page-header-bar,
  .or-page-header,
  .vod-header,
  .bp-page-header,
  .vdb-header,
  .bd-header {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .page-header-bar .btn,
  .bd-cta-btn,
  .vdb-upload-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Disputes layout ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .disp-layout,
  .kyc-layout,
  .vom-status-layout,
  .tfa-manage-layout,
  .tfa-scan-layout {
    grid-template-columns: 1fr !important;
  }
  .dac-body {
    flex-direction: column !important;
  }
  .dac-actions {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid #f1f5f9;
  }
  .disp-types-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 480px) {
  .disp-types-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Payout management ────────────────────────────────────────── */
@media (max-width: 768px) {
  .po-table td:nth-child(3),
  .po-table th:nth-child(3),
  .po-table td:nth-child(6),
  .po-table th:nth-child(6) {
    display: none; /* hide email + ref on mobile */
  }
  .split-panel {
    grid-template-columns: 1fr !important;
  }
}

/* ── Vendor dashboard ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .vdb-split-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  .vdb-split-actions {
    flex-wrap: wrap;
  }
  .vdb-btn-review,
  .vdb-btn-confirm,
  .vdb-btn-status,
  .vdb-btn-msg {
    flex: 1;
    justify-content: center;
  }
  .vdb-alerts .vdb-alert {
    flex-direction: column;
    gap: 8px;
  }
  .vdb-alert-link {
    align-self: flex-start;
  }
}

/* ── Buyer dashboard ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .bd-layout {
    grid-template-columns: 1fr !important;
  }
  .bd-order-actions {
    flex-wrap: wrap;
  }
  .bd-oa-btn {
    flex: 1;
    justify-content: center;
    min-width: 80px;
  }
  .bd-alert-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ── Order confirmation ───────────────────────────────────────── */
@media (max-width: 600px) {
  .oc-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .oc-actions {
    grid-template-columns: 1fr !important;
  }
  .oc-btn-primary {
    grid-column: 1 !important;
  }
}

/* ── SEO dashboard ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .seo-kw-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .seo-cron-card {
    flex-direction: column !important;
  }
  .feature-matrix {
    grid-template-columns: 1fr !important;
  }
}

/* ── 2FA pages ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tfa-backup-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .tfa-steps-bar {
    font-size: 11px;
  }
  .tfa-step span {
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
  }
  .tfa-otp-input {
    font-size: 22px !important;
    letter-spacing: 6px !important;
  }
}

/* ── Admin sidebar — mobile overlay ──────────────────────────── */
@media (max-width: 900px) {
  .admin-sidebar,
  .vendor-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
  }
  .admin-sidebar.open,
  .vendor-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .admin-content,
  .vendor-content {
    margin-left: 0 !important;
    padding: 16px !important;
  }
  /* Hamburger button */
  .mobile-sidebar-toggle {
    display: flex !important;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    background: var(--brand-teal, #2B6777);
    color: #fff;
    border: none;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  /* Overlay backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }
  .sidebar-backdrop.visible {
    display: block;
  }
}
@media (min-width: 901px) {
  .mobile-sidebar-toggle { display: none !important; }
}

/* ── Notification bell on mobile ─────────────────────────────── */
@media (max-width: 480px) {
  .nb-dropdown {
    width: calc(100vw - 20px) !important;
    right: -60px !important;
  }
}

/* ── KYC page ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .kyc-docs-grid {
    grid-template-columns: 1fr !important;
  }
  .kyc-doc-row {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
}

/* ── Vendor earnings chart ────────────────────────────────────── */
@media (max-width: 600px) {
  .earn-chart-wrap {
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .earn-bar-group {
    min-width: 48px;
  }
}

/* ── Collection page mobile ───────────────────────────────────── */
@media (max-width: 600px) {
  .collections-grid {
    grid-template-columns: 1fr !important;
  }
  .or-splits-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── CTA bar (order tracking) ────────────────────────────────── */
@media (max-width: 600px) {
  .ot-cta-bar {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .ot-cta-btn {
    width: 100%;
    justify-content: center;
  }
  .ot-header {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .ot-msg-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Backup manager ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .bkp-table td:nth-child(4),
  .bkp-table th:nth-child(4) {
    display: none; /* hide tables count on mobile */
  }
}

/* ── General utility fixes ────────────────────────────────────── */
@media (max-width: 768px) {
  /* Prevent horizontal overflow */
  body { overflow-x: hidden; }

  /* Fix modal widths */
  .om-modal-box,
  #payModal > div {
    margin: 16px !important;
    max-width: calc(100vw - 32px) !important;
  }

  /* Full width buttons on mobile */
  .om-modal-footer,
  .vod-header-actions {
    flex-wrap: wrap;
  }

  /* Reduce padding on cards */
  .or-item-card,
  .vd-card,
  .earn-section,
  .po-section,
  .bkp-section,
  .seo-section {
    padding: 14px !important;
  }

  /* Collapse code blocks */
  .seo-cron-setup code,
  .bkp-cron-box code,
  .check-code {
    word-break: break-all;
    white-space: pre-wrap;
    font-size: 10px;
  }
}
