/* ==========================================================================
   PREMIUM PAGINATION — matches the redesigned account cards
   Self-contained override layer. Load AFTER components.css / polish.css so it
   wins the cascade. All existing IDs/classes/data-attrs and JS are preserved —
   this only restyles .pagination-* .
   ========================================================================== */

.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: var(--z-pagination, 20);
  padding: 14px 18px;
  /* Glassy premium surface — belongs to the same system as the cards */
  background:
    radial-gradient(120% 140% at 8% 0%, rgba(var(--accent-primary-rgb, 59,130,246), 0.06), transparent 46%),
    linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.01)),
    var(--bg-secondary);
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 -1px 0 rgba(255,255,255,0.04) inset,
    0 -8px 24px rgba(0,0,0,0.28);
  transition: border-color 0.2s ease;
}

/* Left cluster: select + range info */
.pagination-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Premium native select — matches the account-card / pagination system */
.page-size-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 7px 36px 7px 12px;
  min-width: 68px;
  height: 36px;
  /* Dark glass surface + soft inner highlight */
  background-color: rgba(255,255,255,0.04);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01)),
    url("data:image/svg+xml;utf8,<svg fill='%238b9aae' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M5.5 7l4.5 5 4.5-5'/></svg>");
  background-repeat: no-repeat, no-repeat;
  background-position: center, right 10px center;
  background-size: 100%, 15px;
  /* Thin refined border + rounded corners matching the cards */
  border: 1px solid rgba(255,255,255,0.12);
  border-top-color: rgba(255,255,255,0.16);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 1px 2px rgba(0,0,0,0.25);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}
.page-size-select:hover {
  border-color: rgba(var(--accent-primary-rgb, 59,130,246), 0.45);
  background-color: rgba(255,255,255,0.06);
}
/* Focus — subtle accent border + very soft glow (no huge outline) */
.page-size-select:focus {
  outline: none;
  border-color: rgba(var(--accent-primary-rgb, 59,130,246), 0.6);
  box-shadow:
    0 0 0 3px rgba(var(--accent-primary-rgb, 59,130,246), 0.14),
    0 1px 0 rgba(255,255,255,0.05) inset;
}
/* Brighten the custom chevron on focus (arrow uses interface muted color) */
.page-size-select:focus {
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01)),
    url("data:image/svg+xml;utf8,<svg fill='%23cbd5e1' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M5.5 7l4.5 5 4.5-5'/></svg>");
  background-repeat: no-repeat, no-repeat;
  background-position: center, right 10px center;
  background-size: 100%, 15px;
}
/* Ensure native option list keeps the dark theme where supported */
.page-size-select option {
  background: var(--bg-elevated, #232d3d);
  color: var(--text-primary);
}

/* Range info — subtle secondary text */
.pagination-info {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* Controls cluster */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons — compact premium controls */
.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}
.pagination-btn .icon-sm {
  width: 18px;
  height: 18px;
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(var(--accent-primary-rgb, 59,130,246), 0.45);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.pagination-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.94);
}

/* Active page — refined accent + subtle glow */
.pagination-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  box-shadow:
    0 0 0 3px rgba(var(--accent-primary-rgb, 59,130,246), 0.16),
    0 3px 10px rgba(var(--accent-primary-rgb, 59,130,246), 0.28);
}

/* Disabled — intentionally dimmed, not broken */
.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.06);
  color: var(--text-muted);
}
.pagination-btn:disabled .icon-sm,
.pagination-btn.disabled .icon-sm {
  opacity: 0.7;
}

.pagination-ellipsis {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
  min-width: 18px;
  text-align: center;
}

/* ==========================================================================
   RESPONSIVE — deliberate mobile layout, never hide controls
   ========================================================================== */

/* <= 640px: two compact rows (controls on top, select+info below) */
@media (max-width: 640px) {
  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
    margin: 0 8px 8px;
  }
  .pagination-controls {
    order: 1;
    justify-content: center;
    gap: 6px;
  }
  .pagination-left {
    order: 2;
    justify-content: center;
    gap: 12px;
  }
  /* Larger touch targets on mobile */
  .pagination-btn {
    min-width: 42px;
    height: 42px;
    font-size: 14px;
    border-radius: 11px;
  }
  .pagination-ellipsis { display: none; }
}

/* <= 430px: keep everything visible, tighten */
@media (max-width: 430px) {
  .pagination-container {
    padding: 11px 10px;
    margin: 0 6px 6px;
  }
  .pagination-btn {
    min-width: 40px;
    height: 40px;
  }
  .page-size-select {
    min-width: 62px;
    height: 36px;
  }
}

/* <= 390px: compact, still fully usable */
@media (max-width: 390px) {
  .pagination-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 6px;
  }
  .pagination-controls { gap: 4px; }
  .pagination-info { font-size: 12.5px; }
  .page-size-select { min-width: 58px; }
}

/* <= 360px: tightest — numbers + chevrons remain tappable */
@media (max-width: 360px) {
  .pagination-btn {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .pagination-container { gap: 10px; }
  .pagination-left { gap: 10px; }
  .page-size-select {
    padding: 6px 30px 6px 10px;
    min-width: 54px;
    font-size: 13px;
  }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pagination-container,
  .pagination-btn,
  .page-size-select {
    transition: none !important;
    animation: none !important;
  }
}
