/* =========================================================
   SnipeEX brand — match the app (NO yellow/gold accents)
   Accent = Brand Green only. Red = sell/down/danger only.
   ========================================================= */

:root {
  --brand-green: #A9DA29;
  --brand-red: #EC445F;
  --brand-on-accent: #1E2329;

  /* Site-wide typeface — Tajawal (Arabic + Latin) */
  --sx-font: "Tajawal", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    sans-serif;

  --bg-dark: #161a1e;
  --surface-dark: #2A2E38;
  --text-dark-primary: #EAECEF;
  --text-dark-secondary: #848E9C;
  --divider-dark: #363B46;

  --bg-light: #FFFFFF;
  --surface-light: #F7F8FA;
  --surface-light-alt: #F5F5F5;
  --text-light-primary: #1E2329;
  --text-light-secondary: #707A8A;
  --divider-light: #E6E8EA;

  /* Map legacy tokens → brand (kills yellow/gold from admin theme JS too) */
  --primary-color: #A9DA29 !important;
  --xt-yellow: #A9DA29 !important;
  --xt-yellow-h: #b8e63a !important;
  --xt-green: #A9DA29 !important;
  --xt-red: #EC445F !important;
}

/* Global font — whole site */
html,
body,
#__next,
button,
input,
select,
textarea,
.btn,
a {
  font-family: var(--sx-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- Dark (default app look) ----- */
html[data-theme="dark"],
html:not([data-theme="light"]) {
  --main-background-color: var(--bg-dark);
  --card-background-color: var(--surface-dark);
  --border-color: var(--divider-dark);
  --font-color: var(--text-dark-primary);
  --title-color: var(--text-dark-primary);
  --text-primary-color: var(--text-dark-primary);
  --text-primary-color-3: var(--text-dark-primary);
  --text-primary-color-4: var(--text-dark-secondary);
  --primary-color: var(--brand-green);
  --background-color-hover: rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

html[data-theme="dark"] body,
html:not([data-theme="light"]) body {
  background: var(--bg-dark);
  color: var(--text-dark-primary);
}

/* ----- Light ----- */
html[data-theme="light"] {
  --main-background-color: var(--bg-light);
  --card-background-color: var(--surface-light);
  --border-color: var(--divider-light);
  --font-color: var(--text-light-primary);
  --title-color: var(--text-light-primary);
  --text-primary-color: var(--text-light-primary);
  --text-primary-color-3: var(--text-light-primary);
  --text-primary-color-4: var(--text-light-secondary);
  --primary-color: var(--brand-green);
  --background-color-hover: rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

html[data-theme="light"] body {
  background: var(--bg-light);
  color: var(--text-light-primary);
}

/* Filled green CTAs → dark charcoal label (not white) */
.btn-primary,
.theme-btn,
.xt-cta__btn--primary,
.xt-hero__btn,
.xt-markets-page .btn-primary,
.xt-markets-page .xt-chip.is-active,
.xt-markets-page button.is-active {
  background: var(--brand-green) !important;
  border-color: var(--brand-green) !important;
  color: var(--brand-on-accent) !important;
}
.btn-primary:hover,
.theme-btn:hover,
.xt-cta__btn--primary:hover,
.xt-hero__btn:hover {
  filter: brightness(1.05);
  color: var(--brand-on-accent) !important;
}

/* Buy/up = green, Sell/down = red */
.up,
.text-success,
.color-green {
  color: var(--brand-green) !important;
}
.dn,
.text-danger,
.color-red {
  color: var(--brand-red) !important;
}

/* ===== Unified canvas + Flutter-style shimmer loader ===== */
html[data-theme="dark"],
html:not([data-theme="light"]),
html[data-theme="dark"] body,
html:not([data-theme="light"]) body,
html[data-theme="dark"] #__next,
html:not([data-theme="light"]) #__next {
  background-color: #161a1e !important;
}
html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] #__next {
  background-color: #ffffff !important;
}

.preloder-area,
.loadingContainer,
.loading-image-container,
.exchange-loader-container,
.loader-container {
  background: #161a1e !important;
  background-color: #161a1e !important;
}
html[data-theme="light"] .preloder-area,
html[data-theme="light"] .loadingContainer,
html[data-theme="light"] .loading-image-container,
html[data-theme="light"] .exchange-loader-container,
html[data-theme="light"] .loader-container {
  background: #ffffff !important;
  background-color: #ffffff !important;
}

@keyframes sx-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes sx-page-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.92); opacity: 0.7; }
}

@keyframes sx-page-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(220%); }
}

/* ----- Landing / content shimmer (theme-matched, no white flash) ----- */
.sx-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 0 28px;
  box-sizing: border-box;
  /* Default dark — avoids white flash before data-theme is set */
  background: var(--main-background-color, var(--xt-bg, #161a1e)) !important;
}
html[data-theme="light"] .sx-page-loader {
  background: var(--main-background-color, var(--xt-bg, #ffffff)) !important;
}

.sx-page-loader__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color, #2a3038) 90%, transparent);
  flex: none;
}
.sx-page-loader__bar-spacer { flex: 1; }

.sx-page-loader__hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  max-width: 1180px;
  width: 100%;
  margin: 12px auto 0;
  padding: 0 20px;
  box-sizing: border-box;
}
.sx-page-loader__copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sx-shim--hero-title {
  width: min(420px, 92%);
  height: 42px;
  border-radius: 10px;
}
.sx-shim--hero-line {
  width: min(360px, 88%);
  height: 12px;
  border-radius: 6px;
}
.sx-shim--hero-cta {
  width: 220px;
  height: 44px;
  border-radius: 10px;
  margin-top: 8px;
}
.sx-shim--hero-card {
  width: 100%;
  min-height: 220px;
  height: 240px;
  border-radius: 14px;
}

.sx-page-loader__banners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}
.sx-shim--banner {
  height: 120px;
  border-radius: 12px;
}

.sx-page-loader__section {
  max-width: 1180px;
  width: 100%;
  margin: 8px auto 0;
  padding: 0 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sx-shim--section-title {
  width: 180px;
  height: 22px;
  border-radius: 8px;
  margin: 0 auto 4px;
}
.sx-page-loader__rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sx-shim--row {
  width: 100%;
  height: 48px;
  border-radius: 10px;
}

@media (max-width: 800px) {
  .sx-page-loader__hero {
    grid-template-columns: 1fr;
  }
  .sx-shim--hero-card { min-height: 160px; height: 180px; }
  .sx-page-loader__banners { grid-template-columns: 1fr; }
  .sx-page-loader__bar .sx-shim--nav { display: none; }
}

.sx-shim {
  --sx-shim-base: #1c2128;
  /* Soft brand tint on highlight — follows --primary-color / --xt-yellow */
  --sx-shim-hi: color-mix(
    in srgb,
    var(--primary-color, var(--xt-yellow, var(--brand-green, #A9DA29))) 14%,
    #2a3038
  );
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    var(--sx-shim-base) 0%,
    var(--sx-shim-hi) 40%,
    var(--sx-shim-base) 80%
  );
  background-size: 200% 100%;
  animation: sx-shimmer 1.35s ease-in-out infinite;
}

html[data-theme="light"] .sx-shim {
  --sx-shim-base: #eceef1;
  --sx-shim-hi: color-mix(
    in srgb,
    var(--primary-color, var(--xt-yellow, var(--brand-green, #A9DA29))) 12%,
    #f7f8fa
  );
}

.sx-loader-page {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: #161a1e !important;
  box-sizing: border-box;
}
html[data-theme="light"] .sx-loader-page {
  background: #ffffff !important;
}

.sx-loader-page__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid #2a3038;
  flex: none;
}
.sx-loader-page__bar-spacer { flex: 1; }
.sx-shim--brand { width: 96px; height: 22px; border-radius: 6px; }
.sx-shim--nav { width: 64px; height: 14px; border-radius: 4px; }
.sx-shim--pill { width: 160px; height: 32px; border-radius: 8px; margin-left: 8px; }
.sx-shim--circle { width: 28px; height: 28px; border-radius: 50%; }

.sx-loader-page__pair {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid #2a3038;
  flex: none;
}
.sx-shim--pair { width: 110px; height: 20px; }
.sx-shim--price { width: 96px; height: 24px; }
.sx-shim--stat { width: 72px; height: 28px; border-radius: 6px; }

.sx-loader-page__grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px) minmax(260px, 320px);
  gap: 6px;
  padding: 6px;
}
.sx-shim--panel {
  min-height: 0;
  height: 100%;
  border-radius: 8px;
  border: 1px solid #2a3038;
}
.sx-shim--chart { min-height: 280px; }
.sx-shim--orders {
  flex: none;
  height: 160px;
  margin: 0 6px 6px;
  border: 1px solid #2a3038;
}

.sx-section-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 20px 16px;
  min-height: 120px;
  box-sizing: border-box;
}
.sx-shim--line { height: 12px; width: 100%; border-radius: 6px; }
.sx-shim--w80 { width: 80%; }
.sx-shim--w60 { width: 60%; }
.sx-shim--block { height: 72px; width: 100%; border-radius: 8px; margin-top: 4px; }

/* Hide legacy 3-bar loaders when shimmer is present */
.sx-loader-page .loader,
.sx-section-loader .loader { display: none !important; }

@media (max-width: 900px) {
  .sx-loader-page__grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 1fr) 140px 160px;
  }
  .sx-shim--nav,
  .sx-shim--pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sx-shim { animation: none; background: var(--sx-shim-base); }
}

/* Avatar polish */
.cp-user-avater img,
.profile-avatar,
.big-user-thumb img {
  border-radius: 50% !important;
  object-fit: cover !important;
  background: #1c2128;
}

/* ===== Chart pane shimmer (TradingView-matched) ===== */
.sx-chart-loader{
  width:100%;
  height:100%;
  min-height:180px;
  display:flex;
  flex-direction:column;
  background:#161a1e;
  box-sizing:border-box;
  padding:10px 12px 8px;
  gap:8px;
}
html[data-theme="light"] .sx-chart-loader{background:#fff}
.sx-chart-loader__top{
  display:flex;align-items:center;gap:8px;flex:none;height:28px;
}
.sx-chart-loader__tf{
  width:36px;height:14px;border-radius:4px;opacity:.85;
}
.sx-chart-loader__tf--wide{width:72px;margin-left:auto}
.sx-chart-loader__body{
  flex:1 1 auto;min-height:0;display:flex;gap:8px;position:relative;
}
.sx-chart-loader__candles{
  flex:1;min-width:0;display:flex;align-items:flex-end;justify-content:space-between;
  gap:3px;padding:8px 4px 4px;border-bottom:1px solid #2a3038;
}
.sx-chart-loader__candle{
  flex:1 1 0;min-width:3px;max-width:14px;border-radius:2px 2px 0 0;
  opacity:.55;align-self:flex-end;
  background:linear-gradient(180deg,#2a3038 0%,#1c2128 100%);
  animation:sx-shimmer 1.4s ease-in-out infinite;
  background-size:200% 100%;
}
.sx-chart-loader__candle.is-up{
  background:linear-gradient(180deg,color-mix(in srgb,#A9DA29 35%,#1c2128),#1c2128);
}
.sx-chart-loader__candle.is-dn{
  background:linear-gradient(180deg,color-mix(in srgb,#EC445F 35%,#1c2128),#1c2128);
}
.sx-chart-loader__candle:nth-child(odd){animation-delay:.12s}
.sx-chart-loader__candle:nth-child(3n){animation-delay:.24s}
.sx-chart-loader__axis{
  width:48px;flex:none;display:flex;flex-direction:column;justify-content:space-between;padding:6px 0;
}
.sx-chart-loader__tick{height:8px;width:100%;border-radius:3px;opacity:.7}
.sx-chart-loader__vol{
  flex:none;height:48px;display:flex;align-items:flex-end;justify-content:space-between;
  gap:3px;padding:0 4px 48px 0; /* leave room mirroring price axis */
  margin-right:56px;
}
.sx-chart-loader__bar{
  flex:1 1 0;min-width:3px;max-width:14px;border-radius:2px 2px 0 0;opacity:.5;
}

/* Section loader: center nicer when used in small panels */
.sx-section-loader{
  max-width:360px;margin:0 auto;
}

/* —— Cookie consent (Kestrel / Binance-style bar) —— */
.sx-cookie{
  position:fixed;
  z-index:10050;
  left:16px;right:16px;bottom:16px;
  max-width:720px;
  margin:0 auto;
  pointer-events:none;
}
.sx-cookie__inner{
  pointer-events:auto;
  display:flex;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  padding:14px 16px;
  border-radius:10px;
  background:#1c2128;
  border:1px solid #2a3038;
  box-shadow:0 12px 40px rgba(0,0,0,.45);
  color:#eaecef;
}
html[data-theme="light"] .sx-cookie__inner{
  background:#fff;
  border-color:#eaecef;
  color:#1e2329;
  box-shadow:0 12px 32px rgba(0,0,0,.12);
}
.sx-cookie__text{flex:1 1 240px;min-width:0;text-align:left}
.sx-cookie__title{
  display:block;
  font-size:13px;
  font-weight:600;
  letter-spacing:.02em;
  margin-bottom:4px;
  color:inherit;
}
.sx-cookie__desc{
  margin:0;
  font-size:12px;
  line-height:1.45;
  color:#848e9c;
}
html[data-theme="light"] .sx-cookie__desc{color:#707a8a}
.sx-cookie__actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex:none;
  margin-left:auto;
}
.sx-cookie__link{
  font-size:12px;
  color:#848e9c;
  text-decoration:none;
  padding:8px 10px;
}
.sx-cookie__link:hover{color:#F0B90B}
.sx-cookie__btn{
  appearance:none;
  border:0;
  cursor:pointer;
  font-size:13px;
  font-weight:600;
  padding:9px 18px;
  border-radius:6px;
  background:#F0B90B;
  color:#1e2329;
  transition:filter .15s ease, transform .15s ease;
}
.sx-cookie__btn:hover{filter:brightness(1.05)}
.sx-cookie__btn:active{transform:scale(.98)}
@media (max-width:560px){
  .sx-cookie{left:10px;right:10px;bottom:10px}
  .sx-cookie__inner{padding:12px}
  .sx-cookie__actions{width:100%;justify-content:flex-end}
}

/* ===== Site-wide light mode: flip text/surfaces (no white-on-white) ===== */
html[data-theme="light"]{
  --white:#1E2329;
  --black:#FFFFFF;
}
html[data-theme="light"] body,
html[data-theme="light"] .page-wrap,
html[data-theme="light"] .main-content,
html[data-theme="light"] .user-content-wrapper,
html[data-theme="light"] .cp-user-main-wrapper,
html[data-theme="light"] .section-padding,
html[data-theme="light"] .bg-primary-color,
html[data-theme="light"] .wallet-card-info-container,
html[data-theme="light"] .table-responsive,
html[data-theme="light"] .card,
html[data-theme="light"] .modal-content,
html[data-theme="light"] .dropdown-menu,
html[data-theme="light"] .sidebar,
html[data-theme="light"] .cp-user-sidebar{
  color:var(--text-primary-color,#1E2329);
}
html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] h6,
html[data-theme="light"] .title,
html[data-theme="light"] .section-title,
html[data-theme="light"] .text-white:not(.btn):not(.il-btn):not(.sx-signup):not([class*="btn-"]),
html[data-theme="light"] .text-primary-color-two,
html[data-theme="light"] .cp-user-name,
html[data-theme="light"] label,
html[data-theme="light"] .form-control,
html[data-theme="light"] .table,
html[data-theme="light"] .table td,
html[data-theme="light"] .table th,
html[data-theme="light"] p,
html[data-theme="light"] span:not(.badge):not(.up):not(.dn):not(.text-success):not(.text-danger){
  color:inherit;
}
html[data-theme="light"] .text-white:not(.btn):not(.il-btn):not(.sx-signup):not([class*="tableButton"]):not([class*="btn-"]){
  color:#1E2329 !important;
}
html[data-theme="light"] .card,
html[data-theme="light"] .wallet-card,
html[data-theme="light"] .modal-content,
html[data-theme="light"] .dropdown-menu-main,
html[data-theme="light"] .cp-user-sidebar{
  background:#ffffff !important;
  border-color:#E6E8EA !important;
  color:#1E2329 !important;
}
html[data-theme="light"] .form-control,
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{
  background:#F7F8FA !important;
  border-color:#E6E8EA !important;
  color:#1E2329 !important;
}
html[data-theme="light"] .form-control::placeholder,
html[data-theme="light"] input::placeholder{
  color:#707A8A !important;
}
html[data-theme="light"] .table thead th{
  color:#707A8A !important;
  border-color:#E6E8EA !important;
}
html[data-theme="light"] .table td{
  border-color:#E6E8EA !important;
  color:#1E2329 !important;
}
html[data-theme="light"] .cp-user-sidebar-menu .nav-link,
html[data-theme="light"] .cp-user-sidebar-menu .nav-item a{
  color:#1E2329 !important;
}
html[data-theme="light"] .footer-area .widget-title h4{
  color:#707A8A !important;
}
html[data-theme="light"] .footer-area .widget-inner ul li a{
  color:#1E2329 !important;
}
/* Keep accent CTAs readable: green fill → dark label */
html[data-theme="light"] .btn-primary,
html[data-theme="light"] .theme-btn,
html[data-theme="light"] .sx-signup{
  color:#1E2329 !important;
}

/* ===== Beat stale Next CSS bundle (#f5f5f5 / white text) ===== */
html[data-theme="light"] .xt-landing .xt-hero__title,
html[data-theme="light"] .xt-hero__title,
html[data-theme="light"] .xt-landing h1,
html[data-theme="light"] .xt-landing h2,
html[data-theme="light"] .xt-landing h3,
html[data-theme="light"] .xt-landing .title,
html[data-theme="light"] .xt-markets-page h1,
html[data-theme="light"] .xt-markets-page h2,
html[data-theme="light"] .xt-markets-page h3,
html[data-theme="light"] .xt-mk-hero h1,
html[data-theme="light"] .section-title .title,
html[data-theme="light"] .xt-pair-card__coin strong,
html[data-theme="light"] .xt-pair-card__price,
html[data-theme="light"] .sx-why__intro h2,
html[data-theme="light"] .sx-why__head h2,
html[data-theme="light"] .sx-why__tile h3,
html[data-theme="light"] .sx-why__copy h3,
html[data-theme="light"] .cp-user-main-wrapper h1,
html[data-theme="light"] .cp-user-main-wrapper h2,
html[data-theme="light"] .cp-user-main-wrapper h3,
html[data-theme="light"] .cp-user-main-wrapper .title,
html[data-theme="light"] .wallet-card-info-container,
html[data-theme="light"] .wallet-card-info-container h1,
html[data-theme="light"] .wallet-card-info-container h2,
html[data-theme="light"] .wallet-card-info-container h3,
html[data-theme="light"] .wallet-card-info-container td,
html[data-theme="light"] .wallet-card-info-container th,
html[data-theme="light"] .exchange-volume-table td,
html[data-theme="light"] .exchange-volume-table th,
html[data-theme="light"] .text-black,
html[data-theme="light"] .text-white{
  color:#1E2329 !important;
}
html[data-theme="light"] .xt-landing .xt-hero__sub,
html[data-theme="light"] .xt-hero__sub,
html[data-theme="light"] .xt-mk-hero p,
html[data-theme="light"] .sx-why__lead,
html[data-theme="light"] .sx-why__tile p,
html[data-theme="light"] .sx-why__copy p{
  color:#707A8A !important;
}
html[data-theme="light"] .xt-mk-hero{
  background:#F7F8FA !important;
}
html[data-theme="light"] .xt-landing,
html[data-theme="light"] .xt-markets-page,
html[data-theme="light"] .cp-user-main-wrapper{
  background:#FFFFFF !important;
  color:#1E2329 !important;
}
html[data-theme="light"] .cp-user-top-bar .cp-user-logo img,
html[data-theme="light"] .cp-user-logo-large{
  filter:brightness(0) saturate(100%);
  opacity:.92;
}

/* Force Tajawal over legacy Manrope/Open Sans declarations */
body,
body *:not(code):not(pre):not(kbd):not(samp):not(.fa):not(.fas):not(.far):not(.fal):not(.fab):not([class^="fa-"]):not([class*=" fa-"]),
.kestrel-trade,
.sx-api,
.xt-landing {
  font-family: var(--sx-font) !important;
}
code, pre, kbd, samp, .sx-api__table code,
.monaco-editor, [class*="monospace"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}
.fa, .fas, .far, .fal, .fab,
[class^="fa-"], [class*=" fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome !important;
}
