/* ═══════════════════════════════════════════════════
   shared.css — общие стили: переменные, header, nav,
   footer, toast, modal, breadcrumb
   TradeRating.ru
═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg:       #f6f8fb;
  --bg2:      #edf1f7;
  --bg3:      #e3eaf3;
  --surface:  #ffffff;
  --dark:     #192434;
  --dark2:    #243447;
  --dark3:    #3a4c62;
  --acc:      #2f6fed;
  --acc2:     #245dcb;
  --acc-bg:   #eaf1ff;
  --green:    #1f8a5b;
  --green-bg: #ebf8f2;
  --gold:     #b8841f;
  --gold-bg:  #fbf5e8;
  --muted:    #66778e;
  --border:   #d7e1ee;
  --border2:  #becddd;
  --font:     'Geologica', sans-serif;
  --serif:    'Lora', Georgia, serif;
  --radius:   12px;
  /* legacy aliases */
  --blue:     #2f6fed;
  --blue-bg:  #eef4ff;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--dark);
  background: var(--bg);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
input, button, textarea, select { font-family: var(--font); }

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: linear-gradient(165deg, #1f2d40 0%, #192434 48%, #141e2e 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 36px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: baseline;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.logo-accent { color: #6b9cff; }
.logo-tld { font-weight: 400; font-size: 13px; color: #8a98ad; margin-left: 2px; }

/* ── Nav shell ── */
nav.nav-main { flex: 1; display: flex; align-items: center; min-width: 0; }
.nav-shell {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 44px;
  gap: 3px;
  padding: 4px;
  background: rgba(0,0,0,0.22);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 1px 3px rgba(0,0,0,0.12);
}
.nav-shell a,
.nav-shell .auth-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: rgba(232,240,255,0.88);
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}
.nav-shell a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-shell .auth-btn {
  flex: 1.1;
  color: #eef3ff;
  background: rgba(47,111,237,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.nav-shell .auth-btn:hover {
  color: #fff;
  background: rgba(47,111,237,0.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 1px rgba(47,111,237,0.35);
}
.nav-shell a:focus-visible,
.nav-shell .auth-btn:focus-visible {
  outline: 2px solid rgba(107,156,255,0.95);
  outline-offset: 2px;
}

/* ── Breadcrumb ── */
.breadcrumb-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.breadcrumb {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--acc); }
.breadcrumb-sep { color: var(--border2); font-size: 11px; }
.breadcrumb-current { color: var(--dark); font-weight: 600; }

/* ── Toast ── */
#toastContainer, #toastBox {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--dark2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  pointer-events: auto;
  animation: toastIn .22s ease forwards;
  min-width: 220px;
  max-width: 340px;
}
.toast.ok   { background: var(--green); }
.toast.err  { background: #c0392b; }
.toast.warn { background: var(--gold); color: var(--dark); }
.toast.out  { animation: toastOut .22s ease forwards; }
@keyframes toastIn  { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }
@keyframes toastOut { from{opacity:1;transform:none} to{opacity:0;transform:translateY(8px)} }

/* ── Auth Modal ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.on { display: flex; }
.modal-card {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  margin: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}
.mclose {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: none;
  background: var(--bg2);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.mclose:hover { background: var(--bg3); }
.modal-body { padding: 20px 22px; }
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--bg2);
  border-radius: 8px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.on { background: var(--surface); color: var(--dark); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.auth-form { display: none; flex-direction: column; gap: 10px; }
.auth-form.on { display: flex; }
.auth-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}
.auth-input:focus { border-color: var(--acc); }
.auth-submit {
  background: var(--acc);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.auth-submit:hover { background: var(--acc2); }
.auth-msg { font-size: 12px; color: #c03030; margin-top: 4px; min-height: 16px; }

/* ── Footer ── */
footer {
  background: linear-gradient(180deg, #1a2636 0%, #141e2e 100%);
  color: rgba(255,255,255,0.82);
  padding: 56px 36px 32px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.ftop {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.fbrand p {
  margin-top: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.48);
  line-height: 1.65;
  max-width: 280px;
}
.fcol h4 {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 14px;
}
.fcol a {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.68);
  margin-bottom: 9px;
  transition: color .15s;
}
.fcol a:hover { color: #fff; }
.fbot {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.fdisc {
  font-size: 11.5px;
  color: rgba(255,255,255,0.35);
  line-height: 1.6;
  max-width: 680px;
}
.fcopy {
  font-size: 12px;
  color: rgba(255,255,255,0.38);
  flex-shrink: 0;
}

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ── Custom Confirm Dialog ── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.confirm-box {
  background: var(--surface); border-radius: 14px; padding: 26px 28px;
  max-width: 360px; width: calc(100% - 40px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: toastIn .18s ease forwards;
}
.confirm-msg {
  font-size: 15px; font-weight: 500; color: var(--dark);
  line-height: 1.6; margin-bottom: 22px;
}
.confirm-btns { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-yes {
  background: #c03030; color: #fff; border: none;
  border-radius: 8px; padding: 9px 20px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.confirm-yes:hover { background: #a02020; }
.confirm-no {
  background: var(--bg2); color: var(--dark3); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.confirm-no:hover { background: var(--bg3); }

/* ── Back to Top ── */
.back-to-top {
  position: fixed; bottom: 82px; right: 24px; z-index: 800;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--dark2); color: #fff; border: none;
  font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(0,0,0,0.22);
  opacity: 0; transform: translateY(10px) scale(0.85);
  transition: opacity .25s, transform .25s, background .15s;
  pointer-events: none;
}
.back-to-top.on { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { background: var(--acc); }

/* ── Responsive ── */
@media (max-width: 960px) {
  .header-inner { flex-direction: column; gap: 10px; padding: 10px 20px; }
  nav.nav-main { width: 100%; }
  .nav-shell { flex-wrap: wrap; }
  .nav-shell a, .nav-shell .auth-btn { min-width: calc(50% - 4px); flex: none; }
  .breadcrumb { padding: 10px 20px; }
}
@media (max-width: 720px) {
  .ftop { grid-template-columns: 1fr 1fr; gap: 24px; }
  footer { padding: 40px 20px 28px; }
}
@media (max-width: 480px) {
  .ftop { grid-template-columns: 1fr; gap: 20px; }
}
