/* ==========================================================================
   Seewaaw — Responsive enhancements for mobile / tablet / desktop
   ========================================================================== */

html, body { overflow-x: hidden; }

/* Main scroll area must stay independently scrollable */
#main-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Plugins internal pages need real document flow so they can scroll */
#ext-main-page {
  min-height: 0;
}
#ext-tab-all:not(.hidden),
#ext-tab-mine:not(.hidden) {
  display: block;
}

/* Center direct page wrappers */
.w-full.max-w-\[430px\],
.w-full.max-w-\[400px\],
.w-full.max-w-md {
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   Tablet (640px+)
   -------------------------------------------------------------------------- */
@media (min-width: 640px) {
  body { font-size: 16px; }

  /* Dashboard: cards use more horizontal space */
  #dash-home .grid-cols-2,
  #dash-home .grid-cols-3,
  #dash-home .grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Public profile grids spacing */
  .p-grid-products,
  .p-grid-articles,
  .p-grid-videos,
  .p-grid-coupons {
    gap: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Desktop (1024px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* Dashboard home: keep stacked layout but limit card width for readability */
  #dash-home {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
  }
  #dash-home .space-y-5 > * {
    margin-top: 0;
    margin-bottom: 1.25rem;
  }

  /* Stats / quick actions 4 columns */
  #dash-home .grid-cols-2,
  #dash-home .grid-cols-3,
  #dash-home .grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Plugins grid */
  #ext-tab-all:not(.hidden),
  #ext-tab-mine:not(.hidden) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  /* Public profile grids */
  .p-grid-products,
  .p-grid-articles,
  .p-grid-videos,
  .p-grid-coupons {
    gap: 1.25rem;
  }

  /* Readable text sizes */
  input, select, textarea, button { font-size: 16px; }
}

/* --------------------------------------------------------------------------
   Large desktop (1280px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1280px) {
  #dash-home {
    max-width: 1100px;
  }

  #ext-tab-all:not(.hidden),
  #ext-tab-mine:not(.hidden) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Media safety
   -------------------------------------------------------------------------- */
img, video, iframe, canvas {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Scrollbars on desktop
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
}
