:root {
  --bg: #0b0c10;
  --card: rgba(255,255,255,0.06);
  --glass: rgba(255,255,255,0.08);
  --text: #e6e6e6;
  --muted: #a8b0b9;
  --primary: #6ee7b7; /* mint */
  --danger: #ff6b6b;
  --accent: #8ab4ff;
  --ring: rgba(110, 231, 183, .5);
  --shadow: rgba(0,0,0,.35);
}

[data-theme="dark"] {
  --bg: #0b0c10;
  --card: rgba(255,255,255,0.06);
  --glass: rgba(255,255,255,0.08);
  --text: #e6e6e6;
  --muted: #a8b0b9;
  --primary: #6ee7b7; /* mint */
  --danger: #ff6b6b;
  --accent: #8ab4ff;
  --ring: rgba(110, 231, 183, .5);
  --shadow: rgba(0,0,0,.35);
}

[data-theme="light"] {
  --bg: #f7f8fb;
  --card: rgba(255,255,255,0.85); /* Сlightly darker for better contrast */
  --glass: rgba(255,255,255,0.95);
  --text: #0e1726;
  --muted: #4b5563;
  --primary: #059669; /* emerald */
  --danger: #e11d48;
  --accent: #2563eb;
  --ring: rgba(37, 99, 235, .25);
  --shadow: rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% 0%, #1f2937 0%, transparent 50%),
              radial-gradient(800px 600px at 100% 0%, #0ea5e9 0%, transparent 40%),
              linear-gradient(180deg, #0b0c10 0%, #111827 100%);
  background-color: var(--bg); /* fallback для светлой темы */
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 20px;
}

header {
  background-color: var(--card);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  padding: 0.5rem 1rem !important;
  position: relative;
  z-index: 10;
}

.brand {
  display: flex; align-items: center; gap: 12px;
}
.logo {
  width: 40px; height: 40px; border-radius: 12px; 
  background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow: 0 10px 30px var(--shadow), inset 0 0 0 1px rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo svg {
  width: 24px;
  height: 24px;
  fill: white;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; color: var(--text); }
.muted { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 18px; box-shadow: 0 8px 30px var(--shadow);
  backdrop-filter: blur(8px);
}

.grid {
  display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start;
}
@media (min-width: 920px){ .grid { grid-template-columns: 1.05fr .95fr; } }

.controls { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px){ .controls { grid-template-columns: 1fr 1fr 1fr; } }

label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.select, .button, .input {
  appearance: none; width: 100%; border: 1px solid rgba(255,255,255,.12); background: var(--glass);
  color: var(--text); border-radius: 12px; padding: 12px 14px; outline: none; transition: box-shadow .2s, border-color .2s, transform .06s;
  font-size: 1rem;
}
.select:focus, .input:focus { box-shadow: 0 0 0 6px var(--ring); border-color: var(--accent); }

.button { cursor: pointer; font-weight: 650; border: 1px solid rgba(255,255,255,.12); }
.button.primary { background: linear-gradient(135deg, var(--accent), var(--primary)); color: white; }
.button.secondary { background: linear-gradient(135deg, #f59e0b, #ef4444); color: white; }
.button.ghost { background: transparent; border: 1px dashed rgba(255,255,255,.25); }
.button:active { transform: translateY(1px); }

.signal {
  display: grid; gap: 10px; grid-template-columns: auto 1fr auto; align-items: center;
  padding: 14px; border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.12);
}
.signal > div:nth-child(2) { color: var(--text); }
.badge { padding: 4px 10px; font-size: 12px; border-radius: 999px; font-weight: 700; letter-spacing: .03em; }
.up   { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.35); }
.down { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.35); }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi .tile { text-align: center; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); }
.kpi .tile h3 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.kpi .tile p { margin: 6px 0 0; font-size: 18px; font-weight: 800; letter-spacing: .02em; color: var(--text); }

.history { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.history th, .history td { padding: 0.5rem; border-bottom: 1px solid rgba(255,255,255,.12); text-align: left; color: var(--text); }
.history th { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 0.625rem; }

footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; }
.note { font-size: 12px; color: var(--muted); }

/* Адаптивность */
@media (max-width: 576px) {
  .container {
    padding: 16px;
  }
  .card {
    padding: 14px;
  }
  .controls {
    gap: 10px;
  }
  .select, .button, .input {
    padding: 0.75rem;
    font-size: 1.1rem;
  }
  .select option {
    font-size: 1.1rem;
  }
  .history {
    font-size: 0.75rem;
  }
  .history th, .history td {
    padding: 0.375rem 0.25rem;
  }
  .kpi {
    gap: 6px;
  }
  .kpi .tile {
    padding: 8px;
  }
  .kpi .tile h3 {
    font-size: 12px;
  }
  .kpi .tile p {
    font-size: 16px;
  }
}

/* Светлая тема - специфичные стили */
[data-theme="light"] #signal-card {
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
[data-theme="light"] .kpi .tile {
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
[data-theme="light"] .history th, [data-theme="light"] .history td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
[data-theme="light"] #reset-history {
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Стилизация Select2 */
.select2-container--bootstrap-5 .select2-selection {
  background: var(--glass) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  font-size: 1rem !important;
  height: auto !important;
  min-height: 44px !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  box-shadow: 0 0 0 6px var(--ring) !important;
  border-color: var(--accent) !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important;
  padding: 0 !important;
}
.select2-container--bootstrap-5 .select2-selection .select2-selection__arrow {
  height: 100% !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
  background: var(--glass) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 30px var(--shadow) !important;
  backdrop-filter: blur(8px) !important;
}
.select2-container--bootstrap-5 .select2-results__option {
  padding: 12px 14px !important;
  color: var(--text) !important;
  font-size: 1rem !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background: var(--card) !important;
}
/* Адаптивность для Select2 */
@media (max-width: 576px) {
  .select2-container--bootstrap-5 .select2-selection {
    padding: 0.75rem !important;
    font-size: 1.1rem !important;
  }
  .select2-container--bootstrap-5 .select2-results__option {
    font-size: 1.1rem !important;
  }
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
  right: .7rem !important;
}

/* ================================================================================== */

/* Добавления для блока статей */
.articles-section {
  margin-top: 2rem;
}

.articles-section .row {
  gap: 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e6e6e6 !important;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
  display: inline-block;
}

[data-theme="light"] .section-title {
  color: #e6e6e6 !important;
}

.article-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--card);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--shadow);
}

.article-image {
  height: 150px;
  object-fit: cover;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.article-meta {
  display: flex;
  align-items: center;
}

.article-title {
  color: var(--text);
  font-weight: 600;
  height: 48px;
  max-height: 48px;
}

.article-excerpt {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Стиль для кнопки Read More */
.btn-read-more {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: white;
  border: none;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  width: fit-content;
}

.btn-read-more:hover {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-decoration: none;
}

.btn-read-more i {
  font-size: 0.8em;
  vertical-align: middle;
}

/* Адаптивность для блока статей */
@media (max-width: 992px) {
  .col-lg-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .articles-section {
    margin-top: 1.5rem;
  }
  
  .section-title {
    font-size: 1.3rem;
    width: 100%;
    text-align: center;
  }
  
  .article-card {
    margin-bottom: 1rem;
  }
  
  .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ================================================================================== */

/* Исправление видимости текста в article-meta для темной темы */
.article-meta {
  color: var(--muted) !important;
}

.article-meta .article-date,
.article-meta .reading-time {
  color: var(--muted) !important;
}

/* Для светлой темы */
[data-theme="light"] .article-meta {
  color: var(--muted) !important;
}

[data-theme="light"] .article-meta .article-date,
[data-theme="light"] .article-meta .reading-time {
  color: var(--muted) !important;
}

/* Остальные без изменений */
.article-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 200px);
}

.article-content {
  padding: 2rem;
}

.article-hero-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.article-body h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding-bottom: 0.5rem;
}

.article-body h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem;
  color: var(--text);
}

.article-body p {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body .lead {
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
}

.alert {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(8px);
}

.alert-info {
  border-left: 4px solid var(--primary);
  background: linear-gradient(90deg, rgba(110, 231, 183, 0.1), transparent);
}

.article-tags .badge {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}

/* Адаптивность для статьи */
@media (max-width: 768px) {
  .article-content {
    padding: 1.5rem;
  }
  
  .article-hero-image {
    height: 250px;
  }
  
  .article-body h2 {
    font-size: 1.5rem;
  }
  
  .article-body h3 {
    font-size: 1.25rem;
  }
  
  .article-body p,
  .article-body ul,
  .article-body ol {
    font-size: 1rem;
  }
  
  .lead {
    font-size: 1.1rem;
  }
}

.bg-light-subtle {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Стили для светлой темы */
[data-theme="light"] .article-body h2 {
  border-bottom: 1px solid rgba(0,0,0,.15);
}

[data-theme="light"] .alert-info {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.1), transparent);
  border: 1px solid rgba(0,0,0,.15);
}

/* Корректировка для body с минимальной высотой */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Футер к низу */
footer {
  margin-top: auto;
}

/* ================================================================================== */

/* Стили Telegram авторизации */
.telegram-auth-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.telegram-auth-content {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 30px var(--shadow);
  backdrop-filter: blur(8px);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-required-message {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}

@media (max-width: 576px) {
  .telegram-auth-content {
    padding: 1.5rem;
    width: 95%;
  }
  
  .telegram-auth-content h2 {
    font-size: 1.5rem;
  }
  
  .telegram-auth-content p {
    font-size: 1rem;
  }
}

.alert {
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  color: var(--accent);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(8px);
  padding: 12px;
}

.alert-info {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(110, 231, 183, 0.1), transparent);
}

[data-theme="light"] .alert-info {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.1), transparent);
  border: 1px solid rgba(0,0,0,.15);
}

.alert i {
  color: var(--accent);
}

[data-theme="light"] .alert i {
  color: var(--primary);
}

/* Language selector в одну строку */
.language-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1rem;
  justify-content: center;
}

.language-selector .form-label {
  color: var(--muted);
  font-size: 2.5rem;
  margin: 0;
}

.language-selector .form-select {
  background: var(--glass);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1rem;
  width: auto;
  min-width: 120px;
}

@media (max-width: 576px) {  
  .language-selector .form-select {
    padding: 0.5rem;
    font-size: 1.1rem;
    min-width: 100px;
  }
}

/* ====================================================================== */

/* Стили для кнопки промокода в SweetAlert */
.btn-promo {
  background: linear-gradient(135deg, var(--accent), var(--primary)) !important;
  color: white !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 12px 24px !important;
  font-weight: 650 !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 12px var(--shadow) !important;
}

.btn-promo:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px var(--shadow) !important;
}

/* Стили для SweetAlert попапа промокода */
.swal-modal {
  background: var(--card) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 30px var(--shadow) !important;
  backdrop-filter: blur(15px) !important;
}

.swal-title {
  color: var(--text) !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

.swal-text {
  color: var(--text) !important;
  font-size: 1.1rem !important;
  line-height: 1.4 !important;
  margin-bottom: 0 !important;
  text-align: center;
}

.swal-button-container {
  margin: 0.5rem !important;
}

.swal-button {
  background: var(--glass) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  padding: 12px 24px !important;
  font-weight: 650 !important;
  font-size: 1rem !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
}

.swal-button:hover {
  background: var(--card) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px var(--shadow) !important;
}

.swal-button--confirm {
  background: linear-gradient(135deg, var(--accent), var(--primary)) !important;
  color: white !important;
  border: none !important;
}

.swal-button--cancel {
  background: var(--glass) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}

/* Светлая тема для SweetAlert */
[data-theme="light"] .swal-modal {
  border: 1px solid rgba(0,0,0,.15) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,.08) !important;
}

[data-theme="light"] .swal-title {
  color: var(--text) !important;
}

[data-theme="light"] .swal-text {
  color: var(--text) !important;
}

[data-theme="light"] .swal-button {
  background: var(--glass) !important;
  color: var(--text) !important;
  border: 1px solid rgba(0,0,0,.15) !important;
}

[data-theme="light"] .swal-button:hover {
  background: var(--card) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.08) !important;
}

[data-theme="light"] .swal-button--confirm {
  background: linear-gradient(135deg, var(--accent), var(--primary)) !important;
  color: white !important;
  border: none !important;
}

[data-theme="light"] .swal-button--cancel {
  background: var(--glass) !important;
  color: var(--text) !important;
  border: 1px solid rgba(0,0,0,.15) !important;
}

/* Дизейблим артефакты анимации success попапа */
.swal-icon--success:before,
.swal-icon--success:after,
.swal-icon--success__hide-corners {
  display: none;
}
