@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --fxq-bg: #0B132B;
  --fxq-bg-deep: #050914;
  --fxq-surface: #111D3B;
  --fxq-surface-2: #152243;
  --fxq-primary: #D96C06;
  --fxq-primary-hover: #E87A15;
  --fxq-secondary: #F4D06F;
  --fxq-text: #F8F9FA;
  --fxq-muted: #A0AABF;
  --fxq-line: rgba(255,255,255,.09);
  --fxq-line-strong: rgba(244,208,111,.18);
  --fxq-success: #4ECB8A;
  --fxq-error: #FF4B4B;
  --fxq-warning: #F4D06F;
  --fxq-font: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fxq-radius-sm: 12px;
  --fxq-radius: 18px;
  --fxq-radius-lg: 26px;
  --fxq-shadow: 0 24px 70px rgba(0,0,0,.28);
  --fxq-ease: cubic-bezier(.2,.8,.2,1);
}

html { scroll-behavior: smooth; }
body, button, input, select, textarea { font-family: var(--fxq-font) !important; }
body { text-rendering: optimizeLegibility; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
::selection { background: rgba(217,108,6,.36); color: var(--fxq-text); }

/* ---------- Shared interaction polish ---------- */
.btn,
.btn-action,
.network-btn,
.copy-btn,
.back-btn,
.menu-item,
.nav-item,
.stat-card,
.history-item,
.profile-pic,
.deposit-card {
  transition: transform .22s var(--fxq-ease), border-color .22s var(--fxq-ease), background .22s var(--fxq-ease), box-shadow .22s var(--fxq-ease), opacity .22s var(--fxq-ease) !important;
}

.btn:active,
.btn-action:active,
.network-btn:active,
.copy-btn:active,
.back-btn:active,
.menu-item:active,
.nav-item:active,
.stat-card:active,
.history-item:active { transform: translateY(1px) scale(.99) !important; }

:focus-visible { outline: 2px solid var(--fxq-secondary) !important; outline-offset: 3px !important; }

.form-control,
input,
select,
textarea { border-radius: 14px !important; }
.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 4px rgba(217,108,6,.12) !important;
}
.form-control.fxq-field-error,
input.fxq-field-error,
select.fxq-field-error,
textarea.fxq-field-error {
  border-color: var(--fxq-error) !important;
  box-shadow: 0 0 0 4px rgba(255,75,75,.1) !important;
}

.fxq-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .62s var(--fxq-ease), transform .62s var(--fxq-ease);
}
.fxq-reveal.fxq-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .fxq-reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Public / marketing shell ---------- */
.public-shell {
  background:
    radial-gradient(circle at 12% 10%, rgba(217,108,6,.12), transparent 26rem),
    radial-gradient(circle at 88% 8%, rgba(244,208,111,.08), transparent 24rem),
    var(--fxq-bg) !important;
  color: var(--fxq-text) !important;
  min-height: 100vh;
}

.public-shell > nav {
  width: min(1180px, calc(100% - 32px)) !important;
  left: 50% !important;
  transform: translateX(-50%);
  top: 14px !important;
  border: 1px solid var(--fxq-line) !important;
  border-radius: 18px !important;
  padding: 12px 16px !important;
  background: rgba(11,19,43,.82) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,.18) !important;
  backdrop-filter: blur(20px) saturate(140%) !important;
}
.public-shell > nav .logo { font-size: 20px !important; letter-spacing: -.02em !important; font-weight: 800 !important; }
.public-shell > nav .logo-img { width: 38px !important; height: 38px !important; border-radius: 12px !important; box-shadow: none !important; }
.public-shell > nav .btn,
.public-shell .nav-actions .btn { border-radius: 12px !important; min-height: 42px; padding: 10px 18px !important; }

.public-shell .hero { padding-top: 170px !important; min-height: 720px; }
.public-shell .hero-grid { gap: 64px !important; align-items: center !important; }
.public-shell .hero h1,
.public-shell .page-header h1,
.auth-shell h1 {
  font-family: var(--fxq-font) !important;
  letter-spacing: -.055em !important;
  line-height: 1.04 !important;
}
.public-shell .hero h1 { font-size: clamp(2.9rem, 6vw, 5.3rem) !important; max-width: 790px; }
.public-shell .hero-copy { font-size: 1.08rem !important; line-height: 1.8 !important; max-width: 660px !important; }
.public-shell .eyebrow,
.public-shell .section-kicker {
  text-transform: uppercase;
  letter-spacing: .13em !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
}
.public-shell .dashboard-shell,
.public-shell .feature-card,
.public-shell .cta-panel,
.public-shell .legal-container {
  border-color: var(--fxq-line) !important;
  box-shadow: var(--fxq-shadow) !important;
}
.public-shell .dashboard-shell { border-radius: 28px !important; transform: perspective(1000px) rotateY(-1.5deg) rotateX(1deg); }
.public-shell .dashboard { border-radius: 24px !important; }
.public-shell .feature-card { border-radius: 22px !important; padding: 28px !important; background: linear-gradient(145deg, rgba(21,34,67,.94), rgba(17,29,59,.92)) !important; }
.public-shell .feature-card:hover { transform: translateY(-6px) !important; border-color: rgba(244,208,111,.24) !important; }
.public-shell .trust-strip { border-block: 1px solid var(--fxq-line) !important; background: rgba(5,9,20,.28) !important; }
.public-shell .trust-item { min-width: 0; }
.public-shell .trust-item strong { font-weight: 700 !important; }
.public-shell .content-section { padding-block: 110px !important; }
.public-shell .cta-panel { border-radius: 28px !important; overflow: hidden; position: relative; }
.public-shell .cta-panel::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -120px;
  background: rgba(217,108,6,.17);
  filter: blur(22px);
  border-radius: 50%;
  pointer-events: none;
}
.public-shell footer { background: rgba(5,9,20,.22); }
.public-shell .footer-links { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.public-shell .footer-links a { margin: 0 !important; }

/* legal public pages */
.public-shell .page-header { max-width: 900px !important; padding: 170px 20px 52px !important; }
.public-shell .page-header h1 { font-size: clamp(2.5rem, 6vw, 4.6rem) !important; }
.public-shell .page-header p { max-width: 680px; margin: 0 auto; line-height: 1.75; }
.public-shell .legal-container { max-width: 940px !important; padding: clamp(24px, 5vw, 54px) !important; background: linear-gradient(145deg, rgba(21,34,67,.95), rgba(17,29,59,.96)) !important; }
.public-shell .legal-section { padding: 6px 0 28px; margin-bottom: 26px !important; border-bottom: 1px solid var(--fxq-line); }
.public-shell .legal-section:last-child { border-bottom: 0; }
.public-shell .legal-section h2 { color: var(--fxq-text) !important; font-size: 1.22rem !important; letter-spacing: -.02em; }
.public-shell .legal-section h2::before { width: 6px !important; height: 22px !important; border-radius: 5px !important; }
.public-shell .legal-section p { line-height: 1.9 !important; }
.public-shell .last-updated { display: inline-flex; padding: 7px 12px; border: 1px solid var(--fxq-line); border-radius: 999px; background: rgba(255,255,255,.025); }

/* ---------- Auth shell ---------- */
.auth-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(217,108,6,.16), transparent 28rem),
    radial-gradient(circle at 82% 86%, rgba(244,208,111,.08), transparent 24rem),
    var(--fxq-bg-deep) !important;
  color: var(--fxq-text);
}
.auth-shell .auth-wrapper {
  width: min(100%, 520px) !important;
  padding: 42px 20px !important;
}
.auth-shell .back-link {
  width: fit-content;
  border: 1px solid var(--fxq-line);
  background: rgba(255,255,255,.025);
  padding: 9px 12px;
  border-radius: 12px;
  margin-bottom: 18px !important;
}
.auth-shell .auth-card {
  border-radius: 28px !important;
  padding: clamp(28px, 6vw, 46px) !important;
  background: linear-gradient(150deg, rgba(21,34,67,.98), rgba(11,19,43,.98)) !important;
  border: 1px solid var(--fxq-line-strong) !important;
  box-shadow: 0 28px 80px rgba(0,0,0,.38) !important;
  position: relative;
  overflow: hidden;
}
.auth-shell .auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--fxq-primary), var(--fxq-secondary), transparent);
  opacity: .75;
}
.auth-shell .logo-img { width: 58px !important; height: 58px !important; border-radius: 16px !important; object-fit: cover; }
.auth-shell h1 { font-size: 2rem !important; margin-top: 20px !important; }
.auth-shell .auth-card > p { line-height: 1.7; }
.auth-shell .form-group { margin-bottom: 18px !important; }
.auth-shell .form-label { font-weight: 700 !important; font-size: 12px !important; letter-spacing: .02em; }
.auth-shell .form-control { min-height: 52px; background: rgba(5,9,20,.32) !important; }
.auth-shell .btn { min-height: 52px; border-radius: 14px !important; }
.auth-shell .auth-footer { border-top: 1px solid var(--fxq-line); margin-top: 26px !important; padding-top: 22px; }

/* ---------- Authenticated app shell ---------- */
.app-shell {
  background:
    radial-gradient(circle at 50% -20%, rgba(217,108,6,.12), transparent 38rem),
    var(--fxq-bg-deep) !important;
  color: var(--fxq-text) !important;
  min-height: 100vh;
}
.app-shell .app-container {
  width: min(1280px, calc(100% - 36px)) !important;
  max-width: 1280px !important;
  min-height: calc(100vh - 36px) !important;
  margin: 18px auto !important;
  padding: 0 0 40px 250px !important;
  border: 1px solid var(--fxq-line) !important;
  border-radius: 28px !important;
  background:
    radial-gradient(circle at 85% 5%, rgba(217,108,6,.08), transparent 24rem),
    var(--fxq-bg) !important;
  box-shadow: 0 30px 90px rgba(0,0,0,.32) !important;
  overflow: hidden;
  position: relative;
}
.app-shell .fxq-sidebar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 230px;
  padding: 24px 16px;
  background: rgba(5,9,20,.25);
  border-right: 1px solid var(--fxq-line);
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.fxq-side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; color: var(--fxq-text); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.fxq-side-brand img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; }
.fxq-side-label { color: var(--fxq-muted); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 800; padding: 8px 10px; }
.fxq-side-nav { display: grid; gap: 6px; }
.fxq-side-nav a { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 10px 12px; color: var(--fxq-muted); border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 700; border: 1px solid transparent; }
.fxq-side-nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.fxq-side-nav a:hover { color: var(--fxq-text); background: rgba(255,255,255,.04); }
.fxq-side-nav a.active { color: var(--fxq-text); background: rgba(217,108,6,.13); border-color: rgba(217,108,6,.24); }
.fxq-side-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--fxq-line); color: var(--fxq-muted); font-size: 11px; line-height: 1.6; }

.app-shell .app-container > header {
  min-height: 82px;
  padding: 20px 30px !important;
  border-bottom: 1px solid var(--fxq-line) !important;
  background: rgba(11,19,43,.78) !important;
  backdrop-filter: blur(16px);
}
.app-shell .content { padding: 28px 30px !important; max-width: none !important; }
.app-shell .header-title { font-weight: 800 !important; letter-spacing: -.02em; font-size: 17px !important; }
.app-shell .user-info h1 { font-size: 22px !important; letter-spacing: -.03em; }
.app-shell .user-info p { text-transform: uppercase; letter-spacing: .1em; font-size: 10px !important; font-weight: 800; }
.app-shell .profile-pic { border-radius: 14px !important; }

.app-shell .balance-card,
.app-shell .form-section,
.app-shell .stat-card,
.app-shell .ref-box,
.app-shell .history-item,
.app-shell .menu-group,
.app-shell .earn-hero,
.app-shell .yield-card,
.app-shell .claim-card,
.app-shell .profile-card,
.app-shell .summary-card {
  border-color: var(--fxq-line) !important;
  box-shadow: 0 16px 42px rgba(0,0,0,.18) !important;
}
.app-shell .balance-card { border-radius: 24px !important; background: linear-gradient(145deg, rgba(23,38,71,.98), rgba(17,29,59,.98)) !important; }
.app-shell .form-section { border-radius: 22px !important; background: rgba(21,34,67,.82) !important; }
.app-shell .stat-card:hover,
.app-shell .history-item:hover,
.app-shell .menu-item:hover { transform: translateY(-3px) !important; border-color: rgba(244,208,111,.2) !important; }
.app-shell .section-title { font-size: 13px !important; text-transform: uppercase; letter-spacing: .1em; color: var(--fxq-muted) !important; font-weight: 800 !important; }
.app-shell .btn,
.app-shell .btn-action { border-radius: 13px !important; }
.app-shell .bottom-nav { display: none !important; }
.app-shell .modal-content { border: 1px solid var(--fxq-line) !important; border-radius: 24px !important; box-shadow: 0 30px 90px rgba(0,0,0,.48) !important; }

/* Desktop dashboard layout improvements without changing PHP structure */
@media (min-width: 900px) {
  .app-shell.page-dashboard .content { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .75fr); gap: 24px; align-items: start; }
  .app-shell.page-dashboard .balance-card { grid-row: span 3; margin-bottom: 0 !important; min-height: 330px; display: flex; flex-direction: column; justify-content: center; }
  .app-shell.page-dashboard .section-title { margin: 4px 0 12px !important; }
  .app-shell.page-dashboard .ref-box { margin-bottom: 0 !important; }
  .app-shell.page-dashboard .stats-grid { grid-column: 2; }
  .app-shell.page-dashboard .balance-usdt { font-size: clamp(40px, 5vw, 60px) !important; }
  .app-shell .history-list { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px !important; }
  .app-shell .history-item { min-height: 86px; }
  .app-shell.page-more .menu-group { max-width: 820px; }
  .app-shell.page-profile .content { max-width: 820px !important; }
}

/* ---------- Admin shell ---------- */
.admin-shell { background: var(--fxq-bg-deep) !important; min-height: 100vh; color: var(--fxq-text); }
.admin-shell .admin-container { width: min(960px, calc(100% - 30px)) !important; max-width: 960px !important; padding: 24px 0 60px !important; }
.admin-shell header { border: 1px solid var(--fxq-line); background: rgba(21,34,67,.8); border-radius: 18px; padding: 18px 20px !important; margin-bottom: 20px; }
.admin-shell .deposit-card { border-radius: 18px !important; border-color: var(--fxq-line) !important; box-shadow: 0 12px 32px rgba(0,0,0,.15); }
.admin-shell .deposit-card:hover { transform: translateY(-3px); border-color: rgba(244,208,111,.22) !important; }

/* ---------- Popup / toast error system ---------- */
.fxq-toast-stack {
  position: fixed;
  z-index: 99999;
  right: 18px;
  top: 18px;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}
.fxq-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 28px;
  gap: 11px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--fxq-line);
  border-radius: 16px;
  background: rgba(17,29,59,.97);
  color: var(--fxq-text);
  box-shadow: 0 22px 60px rgba(0,0,0,.38);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(-10px) scale(.98);
  animation: fxqToastIn .34s var(--fxq-ease) forwards;
  overflow: hidden;
  position: relative;
}
.fxq-toast::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--fxq-primary); transform-origin: left; animation: fxqToastLife var(--fxq-duration, 5200ms) linear forwards; }
.fxq-toast.error { border-color: rgba(255,75,75,.34); }
.fxq-toast.error::after { background: var(--fxq-error); }
.fxq-toast.success { border-color: rgba(78,203,138,.3); }
.fxq-toast.success::after { background: var(--fxq-success); }
.fxq-toast.warning { border-color: rgba(244,208,111,.3); }
.fxq-toast.warning::after { background: var(--fxq-warning); }
.fxq-toast-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(217,108,6,.12); color: var(--fxq-primary); font-weight: 900; }
.fxq-toast.error .fxq-toast-icon { color: var(--fxq-error); background: rgba(255,75,75,.1); }
.fxq-toast.success .fxq-toast-icon { color: var(--fxq-success); background: rgba(78,203,138,.1); }
.fxq-toast.warning .fxq-toast-icon { color: var(--fxq-warning); background: rgba(244,208,111,.1); }
.fxq-toast-title { font-size: 13px; font-weight: 800; margin-bottom: 3px; }
.fxq-toast-message { color: var(--fxq-muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.fxq-toast-close { border: 0; background: transparent; color: var(--fxq-muted); width: 28px; height: 28px; border-radius: 9px; cursor: pointer; font-size: 18px; line-height: 1; }
.fxq-toast-close:hover { background: rgba(255,255,255,.06); color: var(--fxq-text); }
.fxq-toast.fxq-leaving { animation: fxqToastOut .25s ease forwards; }
@keyframes fxqToastIn { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fxqToastOut { to { opacity: 0; transform: translateX(16px) scale(.98); } }
@keyframes fxqToastLife { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* hide old message banners after JS promotes them to popups */
.fxq-toast-source { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important; }

/* ---------- Loading overlay ---------- */
.fxq-page-loader { position: fixed; inset: 0; z-index: 99998; display: grid; place-items: center; background: rgba(5,9,20,.45); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.fxq-page-loader.active { opacity: 1; pointer-events: auto; }
.fxq-loader-card { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid var(--fxq-line); border-radius: 15px; background: var(--fxq-surface); box-shadow: var(--fxq-shadow); color: var(--fxq-text); font-size: 13px; font-weight: 700; }
.fxq-loader-ring { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.12); border-top-color: var(--fxq-primary); border-radius: 50%; animation: fxqSpin .7s linear infinite; }
@keyframes fxqSpin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
@media (max-width: 899px) {
  .app-shell { background: var(--fxq-bg) !important; }
  .app-shell .app-container {
    width: 100% !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 0 92px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .app-shell .fxq-sidebar { display: none !important; }
  .app-shell .app-container > header { min-height: 72px; padding: 16px 18px !important; position: sticky !important; top: 0; z-index: 30; }
  .app-shell .content { padding: 20px 18px !important; }
  .app-shell .bottom-nav { display: flex !important; }
  .app-shell .history-list { display: flex !important; }
  .public-shell .dashboard-shell { transform: none; }
}

@media (max-width: 720px) {
  .public-shell > nav { width: calc(100% - 20px) !important; top: 10px !important; }
  .public-shell > nav .logo { font-size: 17px !important; }
  .public-shell > nav .logo-img { width: 34px !important; height: 34px !important; }
  .public-shell > nav .nav-actions { gap: 7px !important; }
  .public-shell > nav .btn { padding: 9px 12px !important; font-size: 12px !important; }
  .public-shell .hero { padding-top: 138px !important; min-height: auto; }
  .public-shell .hero h1 { font-size: clamp(2.65rem, 12vw, 4rem) !important; }
  .public-shell .hero-actions { align-items: stretch; }
  .public-shell .hero-actions .btn { width: 100%; justify-content: center; }
  .public-shell .trust-grid { grid-template-columns: 1fr 1fr !important; gap: 18px !important; }
  .public-shell .content-section { padding-block: 76px !important; }
  .public-shell .legal-container { margin: 0 14px 70px !important; }
  .public-shell .footer-links { gap: 12px 18px; }
  .fxq-toast-stack { top: 12px; right: 12px; width: calc(100vw - 24px); }
}

@media (max-width: 430px) {
  .public-shell > nav .nav-actions .btn-secondary { display: none !important; }
  .public-shell .trust-grid { grid-template-columns: 1fr !important; }
  .auth-shell .auth-wrapper { padding: 24px 14px !important; }
  .auth-shell .auth-card { border-radius: 22px !important; }
  .app-shell .content { padding-inline: 14px !important; }
  .app-shell .app-container > header { padding-inline: 14px !important; }
}
