/* ===== FONT FOR THIS PAGE ===== */
.signal-run,
.signal-run * {
  font-family: "Lexend", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== LAYOUT ===== */
.signal-run {
  width: 100%;
  min-height: calc(100vh - 80px);
  padding: 72px 16px 40px;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at top, #020617 0, #020617 35%, #000 100%);
}

.signal-shell {
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== (OLD) HEADER – МОЖЕ НЕ ВИКОРИСТОВУВАТИСЬ ===== */
.signal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.signal-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  color: #e5e7eb;
}

.signal-subtitle {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

.signal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.signal-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
  background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
}

.signal-tag--ai {
  border-color: rgba(94, 234, 212, 0.7);
  color: #a5f3fc;
}

/* ===== GRID ===== */
.signal-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
}

/* ===== MAIN CARD (CHART) ===== */
.signal-main-card {
  background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.96));
  border-radius: 22px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.95),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  overflow: hidden;
  position: relative;
}

.signal-chart-wrapper {
  position: relative;
  width: 100%;
  padding-top: 60%;
}

.signal-chart-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 22px;
}

/* ===== SEARCH OVERLAY ===== */
.signal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98)),
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(0, 0, 0, 0.98));
  z-index: 2;
  opacity: 1;
  transition: opacity 0.26s ease;
}

.signal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-inner,
.signal-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.overlay-spinner {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 3px solid rgba(55, 65, 81, 0.9);
  border-top-color: #22d3ee;
  border-right-color: #a855f7;
  animation: overlay-spin 0.8s linear infinite;
}

@keyframes overlay-spin {
  to {
    transform: rotate(360deg);
  }
}

.overlay-label,
.overlay-text-main {
  font-size: 14px;
  color: #e5e7eb;
  font-weight: 500;
  text-align: center;
}

.overlay-sub,
.overlay-text-sub {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}

/* ===== SIDE CARDS (RIGHT COLUMN) ===== */
.signal-side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signal-card {
  background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.97));
  border-radius: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(30, 64, 175, 0.6);
  box-shadow:
    0 12px 30px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.8);
}

.signal-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  margin-bottom: 6px;
}

/* label з іконкою (Direction / Time) */
.signal-card-label--with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Pair */
.signal-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pair-flags {
  display: flex;
  align-items: center;
  position: relative;
  width: 32px;
  height: 20px;
}

.flag {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.9);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: absolute;
}

.flag-left {
  left: 0;
  z-index: 1;
}

.flag-right {
  right: 0;
  transform: translateX(4px);
  opacity: 0.95;
}

.pair-name {
  font-size: 15px;
  color: #e5e7eb;
  font-weight: 500;
}

/* Direction + icon */
.signal-direction {
  display: flex;
  align-items: center;
}

.direction-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.direction-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.direction-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.direction-text--idle {
  color: #9ca3af;
}

.direction-text--buy {
  color: #4ade80;
}

.direction-text--sell {
  color: #f97373;
}

/* Time icon */
.time-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.9;
}

/* Timer */
.signal-timer {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e5e7eb;
}

/* ===== INDICATORS PANEL (RIGHT-BOTTOM CARD) ===== */
.signal-card--indicators {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  cursor: pointer; /* вся картка клікабельна */
}

/* робимо заголовок індикаторів flex + місце для стрілок */
.signal-card--indicators .signal-card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

/* текст-хінт */
.indicators-toggle-hint {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
  color: #64748b;
  opacity: 0.9;
}

/* напівпрозорі стрілочки (подвійний chevron) */
.signal-card--indicators .signal-card-label::before,
.signal-card--indicators .signal-card-label::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(148, 163, 184, 0.7);
  border-left: none;
  border-top: none;
  border-radius: 2px;
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* розміщуємо стрілочки праворуч, одна над одною */
.signal-card--indicators .signal-card-label::before {
  transform: translateY(-2px) rotate(45deg);   /* стрілка вниз */
}

.signal-card--indicators .signal-card-label::after {
  transform: translateY(2px) rotate(45deg);    /* нижня, трохи зсунута */
}

/* hover — робимо стрілки трохи яскравішими */
.signal-card--indicators:hover .signal-card-label::before,
.signal-card--indicators:hover .signal-card-label::after {
  opacity: 0.9;
}

/* коли блок розгорнутий – стрілочки дивляться вгору */
.signal-card--indicators.is-expanded .signal-card-label::before {
  transform: translateY(-2px) rotate(225deg);
}

.signal-card--indicators.is-expanded .signal-card-label::after {
  transform: translateY(2px) rotate(225deg);
}

/* контейнер індикаторів (collapsible) */
.signal-indicators {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  overflow: hidden;
  max-height: 88px; /* БАЗОВО: згорнуто, видно кілька рядків */
  transition: max-height 0.22s ease;
}

/* розгорнутий стан (JS додає .is-expanded на card) */
.signal-card--indicators.is-expanded .signal-indicators {
  max-height: 500px;
}

/* рядок індикатора: іконка + назва + значення справа */
.indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.indicator-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ind-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  object-fit: contain;
  opacity: 0.95;
}

.indicator-name {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
}

.indicator-value {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
}

/* сила сигналу – трохи підсвічена */
.signal-card--indicators .indicator-row:last-child .indicator-value {
  color: #7cf9ff;
}

/* ===== PRICE ROW ===== */
.signal-price-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.price-box {
  flex: 1;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at 0 0, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.97));
}

.price-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
  margin-bottom: 4px;
}

.price-value {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  color: #e5e7eb;
}

/* ===== RESULT + BACK BUTTON ===== */
.signal-bottom-row {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.signal-result {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result-label {
  font-size: 13px;
  color: #9ca3af;
}

.result-value {
  font-size: 16px;
  font-weight: 600;
}

.result-value--pending {
  color: #e5e7eb;
}

.result-value--win {
  color: #4ade80;
  font-size: 22px;
  text-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

.result-value--loss {
  color: #f97373;
}

/* RETURN (нічия, коли entry = close) */
.result-value--return {
  color: #9ca3af;
  font-size: 20px;
}

/* ===== BUTTON: BACK TO SETUP ===== */
.btn-main {
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #020617;
  background: linear-gradient(135deg, #22d3ee, #a855f7);
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.35);
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

.btn-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(56, 189, 248, 0.45);
}

/* прихована за замовчуванням */
.btn-back-setup {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

/* показати після завершення сигналу */
.btn-back-setup--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ===== CONFETTI ===== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 6px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, #22d3ee, #a855f7);
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--confetti-x, 0px), 110vh, 0) rotateZ(360deg);
    opacity: 0;
  }
}

/* ===== NO SIGNAL MODAL ===== */
.no-signal-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.no-signal-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.no-signal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(0, 0, 0, 0.95));
  backdrop-filter: blur(12px);
}

.no-signal-modal__content {
  position: relative;
  max-width: 360px;
  width: 100%;
  margin: 0 16px;
  padding: 20px 18px 18px;
  border-radius: 20px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  background:
    radial-gradient(circle at 0 0, rgba(15, 23, 42, 1), rgba(15, 23, 42, 0.98)),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  box-shadow:
    0 20px 60px rgba(15, 23, 42, 0.95),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.no-signal-modal.is-open .no-signal-modal__content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.no-signal-title {
  font-size: 18px;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0;
}

.no-signal-text {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.5;
  margin: 0 0 6px;
}

.no-signal-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding-inline: 18px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .signal-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .signal-main-card {
    order: 1;
  }

  .signal-side-col {
    order: 2;
  }
}

@media (max-width: 640px) {
  .signal-run {
    padding-top: 64px;
  }

  .signal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .signal-price-row {
    flex-direction: column;
  }

  .signal-chart-wrapper {
    padding-top: 70%;
  }
}