/* MJ Hub — graceful degradation styles */

/* Offline banner */
#mj-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: #92400e;
  color: #fffbeb;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
#mj-offline-banner[hidden] { display: none !important; }
#mj-offline-banner strong { font-weight: 800; }

html.is-offline body {
  /* subtle cue without breaking layout */
}

/* JS / SDK failure panel */
.mj-js-fallback {
  margin: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(248,113,113,.4);
  background: rgba(127,29,29,.2);
  color: inherit;
  font-size: 14px;
  line-height: 1.5;
}
.mj-js-fallback button {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.mj-js-fallback a { color: #93c5fd; font-weight: 700; }

/* Noscript */
.mj-noscript {
  margin: 24px auto;
  max-width: 480px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.3);
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}
.mj-noscript a {
  color: #93c5fd;
  font-weight: 700;
}

/* backdrop-filter fallback */
@supports not ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .navbar, .bottom-nav, .sidebar, .header,
  [class*="glass"], .modal, .sheet {
    background-color: rgba(15, 23, 42, 0.96) !important;
  }
}

/* Reduced motion */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* System font stack if custom fonts fail */
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

/* === from mj-motion.css (bundled so /css/graceful.css always ships polish) === */
/**
 * MJ Hub — light interaction polish (Apple-inspired, safe).
 * No layout rewrites. Additive only. Safe to load on all customer pages.
 */

:root {
  --mj-press-scale: 0.96;
  --mj-press-ms: 90ms;
  --mj-r-sm: 10px;
  --mj-r-md: 14px;
  --mj-r-lg: 20px;
  --mj-r-xl: 24px;
}

/* Instant press feedback (pointer-down feel via :active) */
button:not(:disabled):not([disabled]):active,
a.btn:active,
.btn:not(:disabled):active,
[role="button"]:active,
.product-card:active,
.country-card:active,
.service-card:active,
.server-card:active,
.chip:active,
.tab:active,
.pill-tab:active,
.nav-item:active,
.bottom-nav a:active,
.dropdown-links li a:active,
.quick-action:active,
.action-btn:active,
.card-btn:active {
  transform: scale(var(--mj-press-scale));
  transition: transform var(--mj-press-ms) ease-out, opacity var(--mj-press-ms) ease-out;
}

/* Avoid scaling structural chrome */
.navbar:active,
.bottom-nav:active,
header:active,
main:active,
.sidebar:active,
.panel:active {
  transform: none !important;
}

/* Clear keyboard focus without changing mouse UI */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary, #3b82f6);
  outline-offset: 2px;
}

/* Sheets: slightly smoother settle (only if they already animate) */
.purchase-sheet,
.sheet,
.bottom-sheet,
.modal-sheet {
  will-change: transform;
}

/* Soften default sheet keyframes if present — do not redefine layout */
@media (prefers-reduced-motion: no-preference) {
  .purchase-sheet {
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* Continuous wait affordance (optional class for number pages) */
.mj-wait-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  margin: 10px 0 4px;
}
.mj-wait-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary, #3b82f6), var(--primary-strong, #2563eb));
  transform-origin: left center;
  transition: transform 1s linear;
}

/* Reduced motion: kill decorative motion, keep UI usable */
@media (prefers-reduced-motion: reduce) {
  .purchase-sheet,
  .sheet,
  .bottom-sheet,
  .modal-sheet,
  [class*="sheet"] {
    animation: none !important;
  }

  button:not(:disabled):active,
  a.btn:active,
  .btn:active,
  [role="button"]:active,
  .product-card:active,
  .country-card:active,
  .service-card:active,
  .server-card:active,
  .chip:active,
  .tab:active,
  .nav-item:active,
  .bottom-nav a:active {
    transform: none !important;
  }

  .mj-wait-bar {
    transition: none !important;
  }
}


/* Stronger coverage for MJ Hub interactive rows */
.balance-card:active,
.stat-card:active,
.menu-item:active,
.list-item:active,
.order-card:active,
.sms-card:active,
.server-option:active,
.country-item:active,
.service-item:active,
.qty-btn:active,
.btn-primary:active,
.btn-ghost:active,
.btn-sm-primary:active,
button.btn-primary:active,
a.hero-btn:active,
.bottom-nav button:active,
.bottom-nav .nav-link:active {
  transform: scale(var(--mj-press-scale, 0.96));
  transition: transform var(--mj-press-ms, 90ms) ease-out;
  opacity: 0.92;
}
