/* ============================================================
   MT5 Trader — Login page (Meridian design)
   ALL rules are scoped under .shell to prevent bleeding into
   other Blazor pages during SPA navigation.
   ============================================================ */

/* CSS variables + layout + body styles — all on .shell */
.shell {
  /* surfaces */
  --bg:        #080B11;
  --bg-2:      #0A0E16;
  --surface:   #0F141D;
  --surface-2: #141B27;
  --surface-3: #19212F;
  --line:      #1C2533;
  --line-2:    #25303F;

  /* text */
  --text:   #E8EDF4;
  --text-2: #AEB8C8;
  --muted:  #76829A;
  --faint:  #4C5670;

  /* accents */
  --teal:   #2EE6C7;
  --teal-d: #18A88F;
  --blue:   #4D7CFE;
  --blue-d: #2F57C9;

  /* market semantics */
  --up:   #2FD08A;
  --down: #F65866;
  --warn: #F2B441;

  /* effects */
  --glow-teal: rgba(46,230,199,.18);
  --glow-blue: rgba(77,124,254,.16);
  --ring:      rgba(46,230,199,.55);

  /* type */
  --f-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --f-ui:      "Inter", system-ui, -apple-system, sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius:   14px;
  --radius-s: 10px;
  --ease:     cubic-bezier(.22,.61,.36,1);

  /* layout */
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;

  /* body-level styles */
  font-family: var(--f-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* scoped reset */
.shell *, .shell *::before, .shell *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.shell button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.shell input  { font-family: inherit; }
.shell a      { color: inherit; text-decoration: none; }
.shell :focus-visible { outline: none; }

.shell .mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ============================================================
   Ambient background layers
   ============================================================ */
.shell .bg-layer { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.shell .bg-grid {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: .16;
  -webkit-mask-image: radial-gradient(120% 120% at 30% 10%, #000 35%, transparent 80%);
          mask-image: radial-gradient(120% 120% at 30% 10%, #000 35%, transparent 80%);
}

#candles { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .5; pointer-events: none; }

.shell .bg-glow {
  background:
    radial-gradient(60% 60% at 18% 18%, var(--glow-teal), transparent 60%),
    radial-gradient(55% 55% at 88% 82%, var(--glow-blue), transparent 62%);
  animation: login-glowpulse 14s var(--ease) infinite;
}
@keyframes login-glowpulse {
  0%,100% { opacity: .85; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.06); }
}

.shell .bg-vignette {
  background: radial-gradient(130% 110% at 50% 0%, transparent 55%, rgba(0,0,0,.55) 100%);
}

/* particles */
.shell .particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.shell .particles span {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: var(--teal); opacity: 0;
  box-shadow: 0 0 8px var(--teal);
  animation: login-floatup linear infinite;
}
@keyframes login-floatup {
  0%   { transform: translateY(20px); opacity: 0; }
  12%  { opacity: .55; }
  88%  { opacity: .4; }
  100% { transform: translateY(-110vh); opacity: 0; }
}

/* ============================================================
   Top bar
   ============================================================ */
.shell .topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.shell .brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.shell .brand .mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-2);
  box-shadow: inset 0 0 0 1px rgba(46,230,199,.08), 0 0 20px rgba(46,230,199,.10);
}
.shell .brand .mark svg { width: 20px; height: 20px; display: block; }
.shell .brand .name { font-family: var(--f-display); font-weight: 600; font-size: 16px; letter-spacing: .14em; color: var(--text); }
.shell .brand .sub  { display: block; font-size: 10px; letter-spacing: .26em; color: var(--muted); font-weight: 500; margin-top: 1px; }

.shell .status {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-left: 2px;
}
.shell .status::-webkit-scrollbar { display: none; }

.shell .chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 6px 11px; border-radius: 999px;
  background: rgba(15,20,29,.7);
  border: 1px solid var(--line);
  font-size: 11px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.shell .chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.shell .chip[data-on="true"]  .dot { background: var(--up);   box-shadow: 0 0 8px var(--up);   animation: login-livedot 2.4s ease-in-out infinite; }
.shell .chip[data-on="false"] .dot { background: var(--down); }
.shell .chip[data-on="24"]    .dot { background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: login-livedot 2.4s ease-in-out infinite; }
.shell .chip .lbl { color: var(--muted); }
.shell .chip .val { color: var(--text); font-family: var(--f-mono); font-size: 11px; }
@keyframes login-livedot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.shell .chip.lat .val[data-q="good"] { color: var(--up); }
.shell .chip.lat .val[data-q="ok"]   { color: var(--warn); }
.shell .chip.lat .val[data-q="bad"]  { color: var(--down); }

/* ============================================================
   Main layout
   ============================================================ */
.shell .main {
  position: relative; z-index: 2;
  flex: 1;
  display: flex; flex-direction: column;
  gap: 26px;
  padding: 8px 18px 30px;
  width: 100%; max-width: 1320px;
  margin: 0 auto;
}

/* ---- LEFT: storytelling ---- */
.shell .story { display: flex; flex-direction: column; gap: 22px; min-width: 0; animation: login-fadeup .7s var(--ease) both; }

.shell .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 11px; font-weight: 600; letter-spacing: .22em; color: var(--teal);
  text-transform: uppercase;
}
.shell .eyebrow::before { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, var(--teal), transparent); }

.shell .headline {
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(30px, 7vw, 52px);
  line-height: 1.04; letter-spacing: -.02em; color: var(--text);
  max-width: 14ch;
}
.shell .headline em { font-style: normal; color: var(--teal); }
.shell .lede { font-size: 15px; color: var(--text-2); max-width: 46ch; }

/* mini trading preview */
.shell .preview {
  position: relative;
  background: linear-gradient(180deg, rgba(20,27,39,.85), rgba(15,20,29,.92));
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 16px 16px 14px;
  max-width: 420px;
  box-shadow: 0 22px 60px -28px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.03);
  overflow: hidden;
}
.shell .preview::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 120% at 100% 0%, var(--glow-teal), transparent 55%);
  opacity: .5; pointer-events: none;
}
.shell .pv-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; }
.shell .pv-asset { display: flex; align-items: center; gap: 10px; }
.shell .pv-asset .ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--line-2);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700; color: var(--teal);
}
.shell .pv-asset .sym { font-family: var(--f-display); font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.shell .pv-asset .cls { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.shell .pv-live { font-size: 10px; letter-spacing: .16em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.shell .pv-live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); animation: login-livedot 2s infinite; }

.shell .pv-price { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 4px; position: relative; }
.shell .pv-price .last { font-family: var(--f-mono); font-size: 30px; font-weight: 700; letter-spacing: -.02em; transition: color .25s; }
.shell .pv-price .chg { font-family: var(--f-mono); font-size: 13px; font-weight: 500; padding: 2px 8px; border-radius: 6px; }
.shell .pv-price .chg.up   { color: var(--up);   background: rgba(47,208,138,.1); }
.shell .pv-price .chg.down { color: var(--down); background: rgba(246,88,102,.1); }

.shell .pv-spark { height: 46px; margin: 6px 0 12px; position: relative; }
.shell .pv-spark canvas { width: 100%; height: 100%; display: block; }

.shell .pv-quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.shell .quote { background: rgba(8,11,17,.55); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; }
.shell .quote .k { font-size: 10px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.shell .quote .v { font-family: var(--f-mono); font-size: 16px; font-weight: 600; margin-top: 2px; }
.shell .quote.bid .v { color: var(--up); }
.shell .quote.ask .v { color: var(--down); }

.shell .pv-margin .row { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; }
.shell .pv-margin .row b { color: var(--text-2); font-family: var(--f-mono); font-weight: 500; }
.shell .bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.shell .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--up), var(--teal)); width: 38%; transition: width .6s var(--ease); }

/* trust badges */
.shell .trust { display: flex; flex-wrap: wrap; gap: 10px; }
.shell .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(15,20,29,.6); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  transition: border-color .25s, transform .25s, color .25s;
}
.shell .badge:hover { border-color: var(--line-2); transform: translateY(-1px); color: var(--text); }
.shell .badge svg { width: 14px; height: 14px; color: var(--teal); flex: none; }

/* ---- RIGHT: auth card ---- */
.shell .auth { display: flex; justify-content: center; animation: login-cardin .75s var(--ease) .08s both; }
.shell .card {
  position: relative; width: 100%; max-width: 412px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-2); border-radius: 18px;
  padding: 26px 24px 22px;
  box-shadow: 0 40px 90px -40px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.shell .card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  opacity: .6;
}

.shell .panel { display: none; }
.shell .panel.active { display: block; animation: login-fadeup .4s var(--ease) both; }

.shell .card-head { margin-bottom: 20px; }
.shell .card-head h1 { font-family: var(--f-display); font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.shell .card-head p  { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* form fields */
.shell .field { margin-bottom: 15px; }
.shell .field > label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }

.shell .inwrap { position: relative; display: flex; align-items: center; }
.shell .inwrap .pre { position: absolute; left: 13px; display: grid; place-items: center; color: var(--faint); pointer-events: none; }
.shell .inwrap .pre svg { width: 16px; height: 16px; }

.shell input.in {
  width: 100%;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  color: var(--text); font-size: 14px;
  padding: 12px 13px 12px 40px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.shell input.in::placeholder { color: var(--faint); }
.shell input.in:hover  { border-color: #2c384a; }
.shell input.in:focus  { border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); background: #0b1019; }
/* hide number input spinners */
.shell input.in[type="number"]::-webkit-inner-spin-button,
.shell input.in[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.shell input.in[type="number"] { -moz-appearance: textfield; }

.shell .field.invalid input.in { border-color: var(--down); box-shadow: 0 0 0 3px rgba(246,88,102,.18); }

.shell .eye {
  position: absolute; right: 8px; width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; color: var(--muted);
  transition: color .2s, background .2s;
}
.shell .eye:hover { color: var(--text); background: var(--surface-3); }
.shell .eye svg { width: 17px; height: 17px; }

.shell .err { display: none; font-size: 11.5px; color: var(--down); margin-top: 6px; align-items: center; gap: 5px; }
.shell .field.invalid .err { display: flex; animation: login-shake .35s var(--ease); }
.shell .err svg { width: 12px; height: 12px; flex: none; }

/* primary button */
.shell .btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 16px; border-radius: var(--radius-s);
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  position: relative; overflow: hidden;
  transition: transform .15s var(--ease), box-shadow .25s, filter .2s;
}
.shell .btn-primary {
  color: #04130F;
  background: linear-gradient(180deg, var(--teal), var(--teal-d));
  box-shadow: 0 10px 28px -10px rgba(46,230,199,.6), inset 0 1px 0 rgba(255,255,255,.35);
  margin-top: 20px;
}
.shell .btn-primary:hover  { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 16px 34px -12px rgba(46,230,199,.7); }
.shell .btn-primary:active { transform: translateY(0); }
.shell .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: saturate(.6); }

.shell .btn .spin {
  width: 17px; height: 17px;
  border: 2px solid rgba(4,19,15,.35); border-top-color: #04130F;
  border-radius: 50%; animation: login-spin .7s linear infinite; display: none;
}
.shell .btn.loading .label { visibility: hidden; }
.shell .btn.loading .arr   { display: none; }
.shell .btn.loading .spin  { display: block; position: absolute; }
.shell .btn .arr { transition: transform .2s; }
.shell .btn-primary:hover .arr { transform: translateX(3px); }

/* form-level error banner */
.shell .formerr {
  display: none; align-items: center; gap: 9px;
  margin-bottom: 16px; padding: 11px 12px; border-radius: 10px;
  background: rgba(246,88,102,.08); border: 1px solid rgba(246,88,102,.3);
  color: #ffb3ba; font-size: 12.5px;
  animation: login-shake .4s var(--ease);
}
.shell .formerr.show { display: flex; }
.shell .formerr svg { width: 15px; height: 15px; flex: none; color: var(--down); }

/* security note */
.shell .secnote {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 18px; padding: 11px 12px; border-radius: 10px;
  background: rgba(46,230,199,.05); border: 1px solid rgba(46,230,199,.15);
  font-size: 11.5px; color: var(--text-2); line-height: 1.45;
}
.shell .secnote svg { width: 15px; height: 15px; color: var(--teal); flex: none; margin-top: 1px; }
.shell .secnote b  { color: var(--text); font-weight: 600; }

/* success state */
.shell .success { text-align: center; padding: 14px 0 6px; }
.shell .success .ring {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: rgba(47,208,138,.12); border: 1px solid rgba(47,208,138,.4);
  animation: login-pop .5s var(--ease) both;
}
.shell .success .ring svg { width: 30px; height: 30px; color: var(--up); }
.shell .success h1 { font-family: var(--f-display); font-size: 20px; font-weight: 600; }
.shell .success p  { font-size: 13px; color: var(--muted); margin-top: 6px; }
.shell .success .loadbar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 20px; }
.shell .success .loadbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--up), var(--teal)); width: 0; animation: login-fill 1.8s var(--ease) forwards; }

/* footer */
.shell .foot {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; align-items: center;
  padding: 18px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--faint);
}
.shell .foot a { transition: color .2s; }
.shell .foot a:hover { color: var(--text-2); }
.shell .foot .reg { font-family: var(--f-mono); }

/* ============================================================
   Keyframes (prefixed to avoid collisions)
   ============================================================ */
@keyframes login-spin    { to { transform: rotate(360deg); } }
@keyframes login-fadeup  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes login-cardin  { from { opacity: 0; transform: translateY(20px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes login-shake   { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(5px)} 60%{transform:translateX(-3px)} 80%{transform:translateX(2px)} }
@keyframes login-pop     { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }
@keyframes login-fill    { from{width:0} to{width:100%} }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 560px) {
  .shell .main    { padding: 14px 26px 36px; }
  .shell .topbar  { padding: 18px 26px; }
}
@media (min-width: 1024px) {
  .shell .main   { flex-direction: row; align-items: center; gap: 56px; padding: 30px 40px; }
  .shell .story  { flex: 1.05; max-width: 560px; }
  .shell .auth   { flex: 0 0 auto; width: 412px; }
  .shell .topbar { padding: 20px 40px; }
}
@media (min-width: 1320px) { .shell .main { gap: 80px; } }
@media (max-width: 380px) {
  .shell .pv-quotes { grid-template-columns: 1fr; }
  .shell .headline  { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .shell *, .shell *::before, .shell *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .shell .bg-glow { animation: none; }
  #candles { opacity: .35; }
}

/* existing-session prompt: secondary action + note */
.shell .btn-secondary {
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  margin-top: 10px;
}
.shell .btn-secondary:hover { background: var(--surface-2); border-color: var(--teal-d); }
.shell .btn-secondary .spin { border-color: rgba(232,237,244,.3); border-top-color: var(--text); }
.shell .choice-note { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }
.shell .choice-note a { color: var(--teal); }
