/* Базовые общие стили и иконки */

:root {
  --bg: #0B1118;
  --panel: #121A24;
  --panel-soft: rgba(18, 26, 36, 0.78);
  --line: #1E2936;
  --text: #EAF1F8;
  --muted: #8FA3B8;
  --accent: #3A7BFF;
  --accent-hover: #5C93FF;
  --glow: rgba(58, 123, 255, 0.22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* Базовый контейнер (может переопределяться на страницах) */
.container {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

/* Иконки вместо эмодзи */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(92, 147, 255, 0.45);
  background: rgba(58, 123, 255, 0.12);
  color: #dbe9ff;
}

.icon--solid {
  background: linear-gradient(180deg, #3a7bff, #2f68ec);
  border-color: rgba(58, 123, 255, 0.8);
  color: #ffffff;
}

.icon-doc::before { content: "DOC"; }
.icon-structure::before { content: "GRID"; }
.icon-shield::before { content: "RISK"; }
.icon-search::before { content: "ANLZ"; }
.icon-chart::before { content: "DATA"; }
.icon-risk::before { content: "RISK"; }
.icon-decision::before { content: "OK"; }
.icon-guide::before { content: "GUIDE"; }
.icon-edu::before { content: "EDU"; }
.icon-payment::before { content: "PAY"; }
.icon-premium::before { content: "VIP"; }
.icon-play::before { content: "PLAY"; }

/* ============================================= */
/* МОДАЛЬНЫЕ ОКНА — ОБЩИЕ СТИЛИ */
/* ============================================= */

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal--open {
  display: flex;
}

.modal__dialog {
  width: min(420px, 100% - 32px);
  border-radius: 18px;
  background: rgba(11,17,24,.98);
  border: 1px solid rgba(30,41,54,.9);
  box-shadow: 0 22px 60px rgba(0,0,0,.6);
  overflow: hidden;
}

.modal__header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(30,41,54,.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 8px;
  transition: color .2s;
}

.modal__close:hover {
  color: #fff;
}

.modal__body {
  padding: 20px 24px;
  font-size: 15.5px;
  line-height: 1.5;
  color: #e0e7f0;
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(30,41,54,.8);
  display: flex;
  justify-content: flex-end;
}

/* ============================================= */
/* МОБИЛЬНОЕ МЕНЮ (гамбургер) */
/* ============================================= */

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-menu-btn span {
  display: block;
  height: 2px;
  background: #e0e7f0;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: none;
  background: #0B1118;
  padding: 0;
  overflow-y: auto;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu__content {
  min-height: 100vh;
  background: #121A24;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(58,123,255,0.15);
}

.mobile-menu__close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 0 30px 0;
}

.mobile-menu__nav a {
  padding: 14px 20px;
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.2s;
}

.mobile-menu__nav a:hover,
.mobile-menu__nav a.is-active {
  background: rgba(58,123,255,0.15);
  color: #fff;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: flex;
  }

  .nav {
    display: none;
  }

  .topbar__inner {
    padding-right: 8px;
  }
}

/* КРАСИВОЕ МОБИЛЬНОЕ МЕНЮ */
.mobile-menu__content {
  background: #121A24;
  box-shadow: -4px 0 40px rgba(0,0,0,0.85);
  border-left: 3px solid #3A7BFF;
}

.mobile-menu__header {
  border-bottom: 1px solid rgba(58,123,255,0.2);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.mobile-menu__nav {
  padding-top: 8px;
}

/* РАВНОМЕРНЫЙ ФОН ПО ВСЕМУ МЕНЮ */
.mobile-menu__content {
  background: #121A24 !important;
  padding: 20px !important;
}

.mobile-menu__content > * {
  background: #121A24 !important;
}

.mobile-menu__header,
.mobile-menu__nav,
.mobile-menu__nav a {
  background: #121A24 !important;
}

.mobile-menu__header {
  background: #121A24 !important;
  margin: -20px -20px 20px -20px;
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid rgba(58,123,255,0.2);
}

.mobile-menu__nav {
  background: #121A24 !important;
  padding: 0 0 20px 0;
}

.mobile-menu__nav a {
  background: rgba(18, 26, 36, 0.85) !important;
  margin-bottom: 6px;
  border-radius: 10px;
}

.mobile-menu__nav a:hover,
.mobile-menu__nav a.is-active {
  background: rgba(58,123,255,0.3);
  color: white;
}

/* Унифицированный размер логотипа на всех страницах */
.brand__logo {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

/* Исправление регистрации на мобильных */
.auth-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.auth-actions .btn {
  width: 100%;
  max-width: 320px;
}

@media (min-width: 641px) {
  .auth-actions {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }
  
  .auth-actions .btn {
    width: auto;
    max-width: none;
  }
}

/* Footer - стабилизация на мобильных */
.footer-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .footer-nav {
    gap: 12px;
  }
}

/* ============================================= */
/* МОБИЛЬНАЯ ВЕРСИЯ ТОРГОВОГО ТЕРМИНАЛА */
/* ============================================= */

@media (max-width: 768px) {
  .trade-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .trade-card {
    margin-bottom: 0;
  }

  /* Порядок: График -> Форма -> История */
  .trade-card--chart {
    order: 1;
  }

  .trade-card--form {
    order: 2;
  }

  .trade-card[data-trade-history-root] {
    order: 3;
  }

  .trade-form__row {
    flex-direction: column;
    gap: 16px;
  }

  .trade-field__input {
    font-size: 16px;
    padding: 14px 16px;
    min-height: 48px;
  }

  .trade-field__hint {
    font-size: 13.5px;
    line-height: 1.4;
    margin-top: 6px;
  }

  .trade-history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  .trade-account {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .trade-form__row {
    gap: 12px;
  }

  .section-title {
    font-size: 23px;
  }

  .trade-card__body {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .trade-form__row {
    gap: 12px;
  }

  .section-title {
    font-size: 24px;
  }

  .trade-field__hint {
    font-size: 13px;
    line-height: 1.4;
  }

  .trade-card--form {
    padding: 16px;
  }

  .trade-form__actions {
    margin-top: 20px;
  }
}

