/* Real 3D Interactive UPI Payment Gateway Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --mouse-x: 50%;
  --mouse-y: 50%;

  /* Dark theme tokens */
  --bg-base: #080C15;
  --bg-card: rgba(30, 41, 59, 0.82);
  --bg-card-end: rgba(15, 23, 42, 0.95);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --bg-pill: rgba(15, 23, 42, 0.9);
  --bg-row-hover: rgba(30, 41, 59, 0.4);
  --bg-icon-well: rgba(15, 23, 42, 0.9);
  --orb1-color: rgba(0, 82, 204, 0.22);
  --orb2-color: rgba(0, 200, 150, 0.16);
  --orb3-color: rgba(124, 58, 237, 0.14);
  --divider: rgba(71, 85, 105, 0.4);
}

/* ── LIGHT MODE TOKENS ────────────────────────────────────────────────────────── */
.light {
  --bg-base: #f0f4f8;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-end: rgba(248, 250, 252, 0.97);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-subtle: rgba(203, 213, 225, 0.85);
  --bg-pill: rgba(241, 245, 249, 0.95);
  --bg-row-hover: rgba(226, 232, 240, 0.55);
  --bg-icon-well: rgba(226, 232, 240, 0.85);
  --orb1-color: rgba(59, 130, 246, 0.18);
  --orb2-color: rgba(16, 185, 129, 0.14);
  --orb3-color: rgba(168, 85, 247, 0.12);
  --divider: rgba(203, 213, 225, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  transition: background-color 0.35s ease, color 0.35s ease;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-base) !important;
  color: var(--text-primary);
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ── ANIMATED BACKGROUND SCENE ──────────────────────────────────────────────── */

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -10;
  overflow: hidden;
  pointer-events: none;
}

/* Mesh gradient base */
.bg-mesh {
  position: absolute;
  inset: 0;
  background-size: 400% 400%;
  animation: meshShift 18s ease infinite alternate;
  opacity: 0.55;
}

.dark .bg-mesh {
  background: radial-gradient(ellipse at 0% 0%, rgba(0,82,204,0.18) 0%, transparent 55%),
              radial-gradient(ellipse at 100% 0%, rgba(124,58,237,0.14) 0%, transparent 55%),
              radial-gradient(ellipse at 50% 100%, rgba(0,200,150,0.12) 0%, transparent 55%),
              #080C15;
}

.light .bg-mesh {
  background: radial-gradient(ellipse at 0% 0%, rgba(59,130,246,0.12) 0%, transparent 55%),
              radial-gradient(ellipse at 100% 0%, rgba(168,85,247,0.1) 0%, transparent 55%),
              radial-gradient(ellipse at 50% 100%, rgba(16,185,129,0.1) 0%, transparent 55%),
              #f0f4f8;
}

@keyframes meshShift {
  0%   { background-position: 0% 0%; filter: hue-rotate(0deg); }
  33%  { background-position: 100% 50%; }
  66%  { background-position: 50% 100%; filter: hue-rotate(15deg); }
  100% { background-position: 0% 0%; filter: hue-rotate(0deg); }
}

/* Floating orbs */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.8;
  will-change: transform, opacity;
}

.bg-orb-1 {
  width: 480px; height: 480px;
  top: -120px; left: -80px;
  background: var(--orb1-color);
  animation: floatOrb1 20s ease-in-out infinite;
}

.bg-orb-2 {
  width: 380px; height: 380px;
  top: 40%; right: -100px;
  background: var(--orb2-color);
  animation: floatOrb2 25s ease-in-out infinite;
}

.bg-orb-3 {
  width: 320px; height: 320px;
  bottom: -80px; left: 30%;
  background: var(--orb3-color);
  animation: floatOrb3 22s ease-in-out infinite;
}

.bg-orb-4 {
  width: 200px; height: 200px;
  top: 55%; left: 10%;
  background: var(--orb1-color);
  animation: floatOrb2 28s ease-in-out infinite reverse;
  opacity: 0.5;
}

@keyframes floatOrb1 {
  0%,100% { transform: translate(0, 0) scale(1); }
  30%     { transform: translate(60px, 80px) scale(1.08); }
  60%     { transform: translate(-30px, 50px) scale(0.95); }
}

@keyframes floatOrb2 {
  0%,100% { transform: translate(0, 0) scale(1); }
  25%     { transform: translate(-50px, 40px) scale(1.1); }
  75%     { transform: translate(40px, -60px) scale(0.92); }
}

@keyframes floatOrb3 {
  0%,100% { transform: translate(0, 0) scale(1); }
  40%     { transform: translate(70px, -40px) scale(1.05); }
  70%     { transform: translate(-40px, 30px) scale(0.97); }
}

/* Subtle grid overlay (dark only) */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  animation: gridFade 6s ease-in-out infinite alternate;
  opacity: 0;
  transition: opacity 0.4s;
}

.dark .bg-grid { opacity: 1; }
.light .bg-grid { opacity: 0; }

@keyframes gridFade {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ── 3D PERSPECTIVE VIEWPORT ──────────────────────────────────────────────── */

.perspective-viewport {
  perspective: 1200px;
  perspective-origin: center center;
}

/* ── 3D INTERACTIVE TILT MASTER CARD ──────────────────────────────────────── */

.card-3d-tilt {
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: 28px;
  background: linear-gradient(155deg, var(--bg-card) 0%, var(--bg-card-end) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-subtle);
  transition: transform 0.18s cubic-bezier(0.2, 0, 0.2, 1),
              box-shadow 0.25s ease,
              background 0.35s ease,
              border-color 0.35s ease;
  position: relative;
}

.dark .card-3d-tilt {
  box-shadow:
    0 1px 3px rgba(0,0,0,0.3),
    0 16px 36px -8px rgba(0,0,0,0.6),
    0 36px 72px -16px rgba(0,0,0,0.7),
    inset 0 1px 1px rgba(255,255,255,0.22),
    inset 0 -2px 2px rgba(0,0,0,0.5);
}

.light .card-3d-tilt {
  box-shadow:
    0 1px 3px rgba(0,0,0,0.05),
    0 16px 36px -8px rgba(0,0,0,0.10),
    0 30px 60px -12px rgba(0,0,0,0.07),
    inset 0 2px 0 rgba(255,255,255,0.9),
    inset 0 -2px 0 rgba(0,0,0,0.03);
}

/* Dynamic Specular Hologram Glare */
.card-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle 380px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.14), transparent 75%);
  pointer-events: none;
  z-index: 25;
  mix-blend-mode: overlay;
  transition: opacity 0.3s ease;
}

.light .card-glare {
  background: radial-gradient(circle 380px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.55), transparent 75%);
}

/* ── 3D PARALLAX Z-AXIS ELEVATIONS ────────────────────────────────────────── */

.layer-z-10 { transform: translateZ(14px); }
.layer-z-20 { transform: translateZ(26px); }
.layer-z-30 { transform: translateZ(38px); }
.layer-z-40 { transform: translateZ(52px); }
.layer-z-50 { transform: translateZ(66px); }

/* ── STATUS PILL ──────────────────────────────────────────────────────────── */

.status-pill {
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(30, 41, 59, 0.8);
  color: #94a3b8;
}

.light .status-pill {
  background-color: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(203, 213, 225, 0.85);
  color: #475569;
}

/* ── LIGHT MODE TEXT & HOVER FIXES ───────────────────────────────────────── */

.light .text-slate-100,
.light .text-slate-200 { color: #1e293b !important; }
.light .text-slate-300  { color: #334155 !important; }
.light .text-slate-400  { color: #64748b !important; }
.light .text-slate-500  { color: #64748b !important; }
.light .text-slate-600  { color: #94a3b8 !important; }
.light .text-white      { color: #0f172a !important; }

/* Prevent white-on-white text during hover in light mode */
.light .group-hover\:text-white:hover,
.light .group:hover .group-hover\:text-white {
  color: #0f172a !important;
}

.light .hover\:text-white:hover {
  color: #0f172a !important;
}

.light .btn-3d-push span {
  color: #334155 !important;
}

.light .btn-3d-push:hover span {
  color: #0f172a !important;
}

/* History row hover in light */
.light .hover\:bg-slate-800\/40:hover { background-color: rgba(226,232,240,0.65) !important; }
.light .border-slate-800\/60          { border-color: rgba(203,213,225,0.65) !important; }
.light .divide-slate-800\/70 > * + * { border-color: rgba(203,213,225,0.6) !important; }

/* Status pill in light */
.light .bg-slate-900\/90 { background-color: rgba(241,245,249,0.95) !important; }
.light .border-slate-800 { border-color: rgba(203,213,225,0.85) !important; }
.light .bg-slate-800\/90 { background-color: rgba(226,232,240,0.9) !important; }
.light .border-slate-700\/80 { border-color: rgba(203,213,225,0.8) !important; }

/* ── 3D FLOATING QR PEDESTAL ──────────────────────────────────────────────── */

.qr-3d-monolith {
  background: #ffffff;
  border-radius: 24px;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.1),
    0 16px 32px -4px rgba(0,0,0,0.3),
    0 28px 56px -8px rgba(0,0,0,0.35),
    inset 0 2px 0 #ffffff,
    inset 0 -3px 0 rgba(0,0,0,0.08);
  border: 2px solid rgba(255,255,255,0.95);
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.qr-3d-monolith:hover {
  transform: translateZ(58px) translateY(-3px);
  box-shadow:
    0 8px 16px rgba(0,0,0,0.15),
    0 24px 44px -4px rgba(0,0,0,0.38),
    0 40px 75px -8px rgba(0,0,0,0.42);
}

/* Center Emblem 3D Badge */
.emblem-3d {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow:
    0 4px 10px rgba(0,0,0,0.15),
    0 8px 20px rgba(0,0,0,0.1),
    inset 0 1px 0 #ffffff;
}

/* ── 3D PHYSICAL PUSH BUTTONS ─────────────────────────────────────────────── */

.btn-3d-push {
  position: relative;
  border-radius: 18px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  box-shadow:
    0 4px 0 #050811,
    0 8px 16px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.09);
  transition: transform 0.1s cubic-bezier(0.4,0,0.2,1), box-shadow 0.1s cubic-bezier(0.4,0,0.2,1);
  transform: translateY(0);
  user-select: none;
}

.light .btn-3d-push {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-shadow:
    0 4px 0 #cbd5e1,
    0 8px 16px rgba(0,0,0,0.07),
    inset 0 1px 0 #ffffff;
  border: 1px solid rgba(203,213,225,0.9);
  color: #334155;
}

.btn-3d-push:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 #050811,
    0 12px 20px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

.light .btn-3d-push:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 #cbd5e1,
    0 12px 20px rgba(0,0,0,0.09);
  color: #0f172a;
}

.btn-3d-push:active {
  transform: translateY(4px) !important;
  box-shadow:
    0 0 0 #050811,
    0 2px 4px rgba(0,0,0,0.4),
    inset 0 2px 4px rgba(0,0,0,0.4) !important;
}

.light .btn-3d-push:active {
  transform: translateY(4px) !important;
  box-shadow:
    0 0 0 #cbd5e1,
    0 2px 4px rgba(0,0,0,0.1),
    inset 0 2px 4px rgba(0,0,0,0.08) !important;
}

/* ── PRIMARY 3D ACTION BUTTON ─────────────────────────────────────────────── */

.btn-3d-primary-push {
  position: relative;
  border-radius: 18px;
  background: linear-gradient(180deg, #0070f3 0%, #0056cc 60%, #0044a3 100%);
  box-shadow:
    0 4px 0 #002d6e,
    0 10px 24px rgba(0,102,255,0.45),
    inset 0 1px 0 rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.28);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  transform: translateY(0);
  user-select: none;
  color: #ffffff !important;
}

.btn-3d-primary-push:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 #002d6e,
    0 14px 28px rgba(0,102,255,0.55),
    inset 0 1px 0 rgba(255,255,255,0.5);
}

.btn-3d-primary-push:active {
  transform: translateY(4px) !important;
  box-shadow:
    0 0 0 #002d6e,
    0 2px 6px rgba(0,102,255,0.4),
    inset 0 2px 5px rgba(0,0,0,0.4) !important;
}

/* ── 3D SUNKEN INSET WELL ─────────────────────────────────────────────────── */

.inset-well-3d {
  background: rgba(11,15,25,0.75);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.05);
}

.light .inset-well-3d {
  background: rgba(226,232,240,0.75);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,0.07),
    0 1px 0 #ffffff;
  border: 1px solid rgba(203,213,225,0.85);
  color: #334155 !important;
}

/* ── REAL-TIME 3D POPUP TOAST ─────────────────────────────────────────────── */

.payment-popup-enter {
  animation: popupSlideDown 0.45s cubic-bezier(0.16, 1.25, 0.3, 1) forwards;
}

@keyframes popupSlideDown {
  0%   { opacity: 0; transform: translateY(-32px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.payment-popup-card {
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(30, 41, 59, 0.94) 0%, rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(16, 185, 129, 0.45);
  box-shadow: 
    0 10px 30px -5px rgba(0, 0, 0, 0.5),
    0 20px 40px -10px rgba(16, 185, 129, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.light .payment-popup-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 
    0 10px 30px -5px rgba(0, 0, 0, 0.12),
    0 16px 36px -8px rgba(16, 185, 129, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.9);
}

/* ── QR CODE CONTAINER ────────────────────────────────────────────────────── */

#qrcode canvas {
  display: none !important;
}

#qrcode img {
  margin: 0 auto;
  border-radius: 12px;
  display: block !important;
  max-width: 100%;
  height: auto;
}

/* ── MODAL OVERLAY & SETTINGS STYLING ─────────────────────────────────────── */

.modal-overlay {
  background: rgba(11,15,25,0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.light .modal-overlay {
  background: rgba(240,244,248,0.82);
}

.light #settings-modal input,
.light #settings-modal textarea {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

.light #settings-modal input:focus,
.light #settings-modal textarea:focus {
  border-color: #10b981 !important;
  background-color: #ffffff !important;
}

.light #settings-modal label {
  color: #334155 !important;
}

/* ── PULSE INDICATOR ──────────────────────────────────────────────────────── */

@keyframes soft-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.85); }
}

.live-dot {
  animation: soft-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.4); }

/* ── FONT MONO OVERRIDE ──────────────────────────────────────────────────── */
.font-mono { font-family: var(--font-mono); }

/* ── RESPONSIVE LAYOUT ADDITIONS ──────────────────────────────────────────── */

/* On tablet+ (md: 768px+) make the main column wider */
@media (min-width: 768px) {
  .perspective-viewport {
    max-width: 520px !important;
  }
  main.perspective-viewport {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

/* On laptop (lg: 1024px+) go wider and use a 2-col card layout */
@media (min-width: 1024px) {
  .perspective-viewport {
    max-width: 900px !important;
  }

  /* Two column: QR card left, Buttons card right */
  .layout-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
  }

  /* History spans full width */
  .layout-2col-full {
    grid-column: 1 / -1;
  }
}

/* On wide desktop (xl: 1280px+) add more breathing room */
@media (min-width: 1280px) {
  .perspective-viewport {
    max-width: 960px !important;
  }
}

/* Prevent any horizontal overflow */
body, html { max-width: 100vw; overflow-x: hidden; }

/* ── FOOTER LIGHT MODE ──────────────────────────────────────────────────── */
.light footer { color: #94a3b8 !important; }
.light footer .bg-emerald-500 { background-color: #10b981 !important; }

/* Smooth color transitions on interactive elements */
a, button, span, div, p, h1, h2, h3 {
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
