* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #050816;
  color: #e5e7eb;
}

.app-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 24px;
  background: radial-gradient(circle at top left, #111827, #020617);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 28px;
}

.subtitle {
  margin-top: 0;
  margin-bottom: 24px;
  color: #9ca3af;
  font-size: 14px;
}

form {
  margin-bottom: 24px;
}

.market-section {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid rgba(55, 65, 81, 0.7);
}

.market-section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 18px;
}

/* === GLOBAL EXPIRY BAR (unused if you don't use it) === */

.global-expiry-bar {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.global-expiry-bar label {
  font-size: 13px;
  color: #e5e7eb;
}

.global-expiry-bar input[type="datetime-local"],
.global-expiry-bar input[type="number"] {
  max-width: 260px;
}

.global-expiry-bar small {
  font-size: 11px;
  color: #9ca3af;
}

/* === FORM GRID === */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 14px;
  color: #e5e7eb;
}

input[type="number"],
input[type="text"],
input[type="datetime-local"],
select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="datetime-local"]:focus,
select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.5);
}

small {
  font-size: 11px;
  color: #9ca3af;
}

/* === BUTTONS === */

.btn-primary,
.btn-secondary {
  margin-top: 18px;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #22c55e);
  color: white;
}

.btn-secondary {
  margin-left: 8px;
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #4b5563;
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
  opacity: 0.95;
}

/* === GLOBAL ODDS PANEL (if used) === */

.global-odds {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.global-odds h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.global-odds-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.global-odds-title {
  width: 90px;
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
}

.live-odds-row {
  display: flex;
  gap: 10px;
  flex: 1;
}

/* === LIVE ODDS CARDS === */

.live-odds-card {
  flex: 1;
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, border-color 0.15s ease;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(135deg, #020617, #020617);
  position: relative;
}

.live-odds-card.up-card {
  border-color: rgba(34, 197, 94, 0.6);
}

.live-odds-card.down-card {
  border-color: rgba(239, 68, 68, 0.6);
}

.live-odds-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.live-odds-prob {
  font-size: 22px;
  font-weight: 700;
}

.up-card .live-odds-prob {
  color: #bbf7d0;
}

.down-card .live-odds-prob {
  color: #fecaca;
}

.live-odds-price {
  font-size: 12px;
  color: #9ca3af;
}

/* Opportunity highlight on side card */
.live-odds-opportunity {
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.55);
  border-color: rgba(250, 204, 21, 0.95);
}

.live-odds-opportunity::after {
  content: "OPPORTUNITY";
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.9);
  color: #fefce8;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Tick animations */

.tick-up {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.35);
  background: radial-gradient(
    circle at top left,
    rgba(22, 163, 74, 0.25),
    #020617
  );
}

.tick-down {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
  background: radial-gradient(
    circle at bottom right,
    rgba(220, 38, 38, 0.25),
    #020617
  );
}

.tick-up-soft {
  animation: pulse-up 0.45s ease-out;
}

.tick-down-soft {
  animation: pulse-down 0.45s ease-out;
}

@keyframes pulse-up {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse-down {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}

/* === ALERT EDGE (legacy) === */

.alert-edge {
  border-color: rgba(251, 191, 36, 0.9) !important;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.45);
  background: radial-gradient(
    circle at top,
    rgba(251, 191, 36, 0.25),
    #020617
  ) !important;
  position: relative;
}

.alert-edge::after {
  content: "EDGE > 4pp";
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.8);
  color: #fef9c3;
}

.highlight-edge {
  color: #facc15;
}

/* === RESULTS CARD PER MARKET === */

.results-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #4b5563;
  background: rgba(15, 23, 42, 0.9);
}

.results-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

/* === DETAILED RESULTS GRID === */

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.results-grid h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 15px;
  color: #e5e7eb;
}

.results-grid p {
  margin: 2px 0;
  font-size: 13px;
  color: #d1d5db;
}

/* === TAGS / RECOMMENDATION === */

.recomendacion {
  margin-top: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.tag-ok {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
}

.tag-bad {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.7);
  color: #fecaca;
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: #9ca3af;
}

/* === USER TRADES TABLE === */

.trades-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.trades-table thead {
  background: rgba(31, 41, 55, 0.9);
}

.trades-table th,
.trades-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(55, 65, 81, 0.8);
}

.trades-table th {
  font-weight: 600;
  color: #e5e7eb;
}

.trades-table td {
  color: #d1d5db;
}

.trades-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.6);
}

/* === ERRORS & FOOTER === */

.error {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.7);
  font-size: 13px;
}

footer {
  margin-top: 24px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

.hidden {
  display: none;
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
  .app-container {
    margin: 20px auto;
    padding: 16px;
  }

  .global-odds-title {
    width: 70px;
  }

  .live-odds-prob {
    font-size: 18px;
  }

  .live-odds-price {
    font-size: 11px;
  }
}

/* Bot status badges */

.bot-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.bot-status-on {
  border-color: rgba(34, 197, 94, 0.7);
  background: rgba(22, 163, 74, 0.1);
  color: #bbf7d0;
}

.bot-status-off {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.bot-status-error {
  font-size: 11px;
  color: #f97373;
  max-width: 260px;
  text-align: right;
}

/* Bot log panel */

.bot-log-panel {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #4b5563;
  background: rgba(15, 23, 42, 0.95);
}

.bot-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.bot-log-entry {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(55, 65, 81, 0.7);
  font-size: 12px;
}

.bot-log-main {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
}

.bot-log-time {
  color: #9ca3af;
}

.bot-log-label {
  font-weight: 600;
}

.bot-log-side {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.bot-log-side-up {
  border-color: rgba(34, 197, 94, 0.8);
  background: rgba(22, 163, 74, 0.2);
  color: #bbf7d0;
}

.bot-log-side-down {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(220, 38, 38, 0.2);
  color: #fecaca;
}

.bot-log-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #d1d5db;
}

.bot-log-slug {
  color: #9ca3af;
}

/* Log table */

.bot-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bot-log-table th,
.bot-log-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #1f2937;
}

.bot-log-table th:first-child,
.bot-log-table td:first-child,
.bot-log-table th:nth-child(2),
.bot-log-table td:nth-child(2) {
  text-align: left;
}

.bot-log-table th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.pnl-positive {
  color: #16a34a;
  font-weight: 600;
}

.pnl-negative {
  color: #dc2626;
  font-weight: 600;
}

.status-open {
  color: #facc15;
  font-weight: 600;
}

.status-sold {
  opacity: 0.7;
}

.bot-log-totals {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Quick summary grid */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.summary-box {
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px 12px;
  position: relative;
}

/* Glow color by best side */
.summary-box-up {
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.38);
  border-color: rgba(34, 197, 94, 0.9);
}

.summary-box-down {
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.38);
  border-color: rgba(239, 68, 68, 0.9);
}

.summary-box-opportunity {
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.6);
  border-color: rgba(250, 204, 21, 0.95);
}

.summary-opportunity-pill {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.9);
  color: #fefce8;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.summary-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.summary-col {
  flex: 1;
}

.summary-title {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.summary-label {
  color: #9ca3af;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-prob-big {
  font-size: 1.4rem;
  font-weight: 700;
}

.summary-prob-market {
  font-size: 0.8rem;
  opacity: 0.75;
}

.summary-value {
  font-size: 0.8rem;
  font-weight: 600;
}

/* metrics row */
.summary-row-metrics {
  margin-top: 8px;
  gap: 8px;
}

/* diff colors */
.summary-diff-positive {
  color: #4ade80;
}

.summary-diff-negative {
  color: #f97373;
}

.summary-diff-neutral {
  color: #9ca3af;
}

/* Timer */

.qs-timer-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.qs-timer-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #9ba3c0;
  letter-spacing: 0.06em;
}

.qs-timer {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  font-weight: 600;
  color: #f5f7ff;
}
