/**
 * NGT — Panel Responsive CSS
 * Fixes all inline grids/flexbox inside dashboard, support, ib-program, rewards, settings
 * Covers: 320px → 2560px
 */

/* ═══════════════════════════════
   TABLET LANDSCAPE (max 992px)
═══════════════════════════════ */
@media (max-width: 992px) {
  /* Copy trading / signal lock sections */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ═══════════════════════════════
   TABLET PORTRAIT (max 768px)
═══════════════════════════════ */
@media (max-width: 768px) {
  /* All 2-col inline grids → 1 col */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* All 3-col inline grids → 1 col */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Support form grid */
  #new-ticket-form [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* IB withdraw/cashback row */
  .ib-withdraw-row { flex-direction: column !important; }

  /* Dashboard stats minmax reduction */
  [style*="minmax(230px"] { --min: 160px; }
  [style*="minmax(200px"] { --min: 140px; }

  /* Panel padding reduction */
  .main-panel { padding: 15px 12px !important; }

  /* topbar buttons wrap */
  .topbar { flex-wrap: wrap !important; gap: 10px !important; }
  .topbar > div:last-child { width: 100%; }

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

  /* Support ticket list and chat */
  #support-list { gap: 10px !important; }
  #ticket-chat-panel { padding: 15px !important; }
}

/* ═══════════════════════════════
   MOBILE LARGE (max 576px)
═══════════════════════════════ */
@media (max-width: 576px) {
  /* All flex rows → wrap */
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }
  /* Buttons full width in forms */
  .btn[style*="width"] { width: 100% !important; }

  /* Dashboard copy trading lock */
  [style*="minmax(300px"] {
    grid-template-columns: 1fr !important;
  }

  /* IB stats grid */
  [style*="minmax(220px"] {
    grid-template-columns: 1fr 1fr !important;
  }
  [style*="minmax(180px"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Section paddings */
  .section { padding: 40px 0 !important; }

  /* Reward/cashback cards */
  [style*="min-width: 200px"] { min-width: 100% !important; }
  [style*="min-width:200px"]  { min-width: 100% !important; }
  [style*="min-width: 300px"] { min-width: 100% !important; }
  [style*="min-width:300px"]  { min-width: 100% !important; }

  /* Settings form groups */
  .settings-row { flex-direction: column !important; }

  /* Header in panels */
  .topbar h2 { font-size: 1.15rem !important; }
}

/* ═══════════════════════════════
   MOBILE SMALL (max 400px)
═══════════════════════════════ */
@media (max-width: 400px) {
  /* IB level stats — 2 col → 1 col */
  [style*="minmax(220px"],
  [style*="minmax(180px"],
  [style*="minmax(150px"] {
    grid-template-columns: 1fr !important;
  }
  /* Compact padding */
  .main-panel { padding: 10px 8px !important; }
  .stat-card  { padding: 16px 12px !important; }
  .stat-card .value { font-size: 1.3rem !important; }

  /* Toast narrower */
  .toast { width: 90%; text-align: center; padding: 12px 16px !important; font-size: 0.85rem !important; }
}

/* ═══════════════════════════════
   MOBILE XS (max 360px)
═══════════════════════════════ */
@media (max-width: 360px) {
  .main-panel { padding: 8px 6px !important; }
  .ngt-table td, .ngt-table th { padding: 8px 6px !important; font-size: 0.75rem !important; }
  .btn { padding: 10px 14px !important; font-size: 0.85rem !important; }
}

/* ═══════════════════════════════
   ULTRA-WIDE (min 1800px)
═══════════════════════════════ */
@media (min-width: 1800px) {
  .main-panel { padding: 40px 60px !important; }
  [style*="minmax(230px"] { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; }
}
