/* ============================================================
   MyroPay Personal App - Desktop Layout
   Loaded after styles.css. Every rule here is scoped to
   html[data-device="desktop"] (set by /shared/js/responsive.js
   before first paint) — this file adds a desktop layout, it never
   overrides or removes a mobile rule. Deleting this <link> returns
   the app to exactly the mobile-only experience.

   Pattern: two-pane shell — a persistent left sidebar (pane 1)
   replaces the bottom nav, and the existing header + screens render
   in the right-hand content pane (pane 2), unchanged apart from
   width/spacing. No screen markup was rebuilt for desktop — every
   .screen div, and navigateTo(), is reused as-is.
   ============================================================ */

/* Default the sidebar to hidden regardless of load order, so it can
   never intrude on the mobile layout even for a brief instant. The
   [data-device="desktop"] rule further down has higher specificity
   and wins once the attribute is set. */
.side-nav { display: none; }

html[data-device="desktop"] body {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

html[data-device="desktop"] .app {
  max-width: none;
  width: 100%;
  height: auto;
  min-height: 100vh;
}

/* ── Auth screens (login/signup/OTP): let the existing card design
   breathe on a full-size canvas instead of forcing a 430px frame,
   without changing the card itself. ── */
html[data-device="desktop"] .auth-wrap {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  overflow-y: visible;
}

/* ── Authenticated shell: three-pane grid (sidebar / content / rail).
   The rail column collapses on screens that don't populate #desktop-rail
   the same way it always has — see the .desktop-rail rule further down
   for the pane itself. ── */
html[data-device="desktop"] #main-app.app-visible {
  display: grid;
  grid-template-columns: 264px 1fr 300px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "side header header"
    "side main   rail";
  height: 100vh;
  max-width: none;
}

html[data-device="desktop"] .header {
  grid-area: header;
  padding: 18px 36px;
  border-bottom: 1px solid var(--border);
}

html[data-device="desktop"] #screen-container {
  grid-area: main;
  padding: 28px 0 48px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

html[data-device="desktop"] #screen-container .screen {
  width: 100%;
  max-width: 640px;
  padding-left: 12px;
  padding-right: 12px;
}

/* The bottom nav is a mobile affordance — the sidebar replaces it
   entirely on desktop, it isn't shown in addition to it. */
html[data-device="desktop"] .bottom-nav { display: none; }

/* ── Pane 1: sidebar ── */
html[data-device="desktop"] .side-nav {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px 24px;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-y: auto;
}

html[data-device="desktop"] .side-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  padding: 8px 10px 22px;
  cursor: pointer;
}

html[data-device="desktop"] .side-nav-logo .logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html[data-device="desktop"] .side-nav-section {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 16px 12px 6px;
}

html[data-device="desktop"] .side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: .87rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: var(--font-body);
  width: 100%;
  transition: background .15s ease, color .15s ease;
}

/* The [data-tile] color variables (--c1/--c2/--sh) now live globally
   in styles.css as part of the app-wide icon-tile system — desktop
   just adds size/shape on top of the same colors. */

html[data-device="desktop"] .side-link .side-link-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(150deg, var(--c1, var(--accent)), var(--c2, var(--accent-dark)) 120%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 6px 14px -6px var(--sh, var(--accent-glow));
}

html[data-device="desktop"] .side-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

html[data-device="desktop"] .side-link.active {
  background: var(--accent-glow);
  color: var(--accent);
}

/* Reuse the existing notification/avatar header controls as-is; just
   give them a little more breathing room next to the wider header. */
html[data-device="desktop"] .header-actions {
  gap: 14px;
}

/* ── Home dashboard: quick actions + quick access become gradient tiles.
   Everything else about these rows (layout, click handlers, labels)
   is untouched — only the icon treatment changes on desktop. ── */
html[data-device="desktop"] .qa-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 1.1rem;
  color: #fff;
  border: none;
  background: linear-gradient(150deg, var(--c1, var(--accent)), var(--c2, var(--accent-dark)) 120%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35),
              inset 0 -8px 12px -6px rgba(0,0,0,.35),
              0 12px 22px -8px var(--sh, var(--accent-glow));
}
/* qa-grid-icon carries its color/background as an inline style in the
   mobile markup (per-item, set directly in index.html) — inline always
   beats a stylesheet rule, so this one needs !important to actually
   take over on desktop. Everything else here is unchanged. */
html[data-device="desktop"] .qa-grid-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 1.1rem;
  border: none;
  color: #fff !important;
  background: linear-gradient(150deg, var(--c1, var(--accent)), var(--c2, var(--accent-dark)) 120%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35),
              inset 0 -8px 12px -6px rgba(0,0,0,.35),
              0 12px 22px -8px var(--sh, var(--accent-glow));
}
html[data-device="desktop"] .qa:hover .qa-icon,
html[data-device="desktop"] .qa-grid-item:hover .qa-grid-icon {
  transform: translateY(-2px);
  transition: transform .15s ease;
}

/* Screen-home gets a wider dashboard column instead of the shared
   640px form-width cap used by every other screen. (Selector includes
   #screen-container so it out-specifies the shared ".screen" cap
   above rather than relying on source order.) */
html[data-device="desktop"] #screen-container #screen-home {
  max-width: 860px;
}

/* ── Balance hero: dashboard-grade card with a floating tilted card
   mockup. The blobs, greeting, balance, and quick-actions markup are
   all reused as-is; only the shell around them changes shape. ── */
html[data-device="desktop"] .home-hero {
  border-radius: 24px;
  padding: 34px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: radial-gradient(120% 160% at 100% 0%, var(--accent-glow) 0%, var(--bg-card) 46%, transparent 100%);
  border: 1px solid var(--border);
}
html[data-device="desktop"] .home-hero .hero-content {
  flex: 1;
  min-width: 0;
}

html[data-device="desktop"] .balance-amount { font-size: 2.9rem; }

/* ── Right rail (pane 3): wallets + QR, desktop-only ── */
.desktop-rail { display: none; }
html[data-device="desktop"] .desktop-rail {
  grid-area: rail;
  display: block;
  padding: 24px 22px 24px 0;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}
html[data-device="desktop"] .rail-head {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  padding: 4px 4px 10px;
}
html[data-device="desktop"] .rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 22px;
}
html[data-device="desktop"] .rail-wallet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
html[data-device="desktop"] .rail-wallet-row:last-child { border-bottom: none; }
html[data-device="desktop"] .rail-wallet-row .flag { font-size: 1.2rem; }
html[data-device="desktop"] .rail-wallet-row .cur { font-weight: 700; color: var(--text-primary); flex: 1; }
html[data-device="desktop"] .rail-wallet-row .amt { font-weight: 700; font-family: var(--font-display); }
html[data-device="desktop"] .rail-qr-card { text-align: center; }
html[data-device="desktop"] .rail-tag {
  display: inline-flex;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}
html[data-device="desktop"] .rail-qr-card #rail-qr {
  width: fit-content;
  margin: 0 auto 10px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
}
html[data-device="desktop"] .rail-qr-sub {
  font-size: .72rem;
  color: var(--text-tertiary);
}

/* Below 1280px the rail would crowd the content pane (this is still
   "desktop" per the 1024px breakpoint in responsive.js) — drop to the
   two-pane layout and let the content column take the space back. */
@media (max-width: 1280px) {
  html[data-device="desktop"] #main-app.app-visible {
    grid-template-columns: 264px 1fr;
    grid-template-areas:
      "side header"
      "side main";
  }
  html[data-device="desktop"] .desktop-rail { display: none; }
}

/* A slight perspective tilt on the hero card reads well with the extra
   room desktop has; skipped on mobile so the card never clips inside
   a narrow scroll column. */
html[data-device="desktop"] .v-card.v-card--hero {
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  transform: perspective(900px) rotateX(4deg);
}
html[data-device="desktop"] .v-card.v-card--hero:hover {
  transform: perspective(900px) rotateX(2deg) translateY(-4px);
}

/* Quick access grid reads fine at phone width even inside the wider
   pane, so intentionally no layout override there — this is the
   "additive, not a rebuild" line: only structural chrome (nav, shell,
   pane widths, and the icon-tile treatment above) changes on desktop,
   never the screen internals or their JS. */