/* Dark theme overrides for Bootstrap 5.3 */
[data-bs-theme="dark"] {
  --bs-body-bg: #030712;
  --bs-body-color: #f3f4f6;
  --bs-border-color: #1f2937;
  --bs-tertiary-bg: #111827;
  --bs-secondary-bg: #1f2937;
  --bs-link-color: #60a5fa;
  --bs-link-hover-color: #93bbfd;
}

/* Card styling */
.card {
  --bs-card-bg: #111827;
  --bs-card-border-color: #1f2937;
}

/* Table styling */
.table-dark {
  --bs-table-bg: #111827;
  --bs-table-border-color: #1f2937;
  --bs-table-hover-bg: rgba(31, 41, 55, 0.3);
  --bs-table-striped-bg: rgba(31, 41, 55, 0.2);
}

/* Form controls */
.form-control {
  background-color: #1f2937;
  border-color: #374151;
  color: #fff;
}
.form-control:focus {
  background-color: #1f2937;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}
.form-control::placeholder {
  color: #6b7280;
}

/* PnL colors */
.text-pnl-positive { color: #4ade80 !important; }
.text-pnl-negative { color: #f87171 !important; }

/* Side badges */
.badge-long { background-color: rgba(22, 78, 46, 0.8); color: #86efac; }
.badge-short { background-color: rgba(127, 29, 29, 0.8); color: #fca5a5; }

/* Status badges */
.badge-stopped { background-color: #7f1d1d; color: #fca5a5; }
.badge-paused { background-color: #713f12; color: #fde68a; }
.badge-running { background-color: #14532d; color: #86efac; }
.badge-enabled { background-color: #14532d; color: #86efac; }
.badge-disabled { background-color: #7f1d1d; color: #fca5a5; }
.badge-loading { background-color: #1f2937; color: #9ca3af; }
.badge-in-range { background-color: #14532d; color: #86efac; }
.badge-waiting { background-color: #713f12; color: #fde68a; }

/* S/R strength bar */
.sr-strength-bar {
  width: 4rem;
  height: 0.375rem;
  background-color: #374151;
  border-radius: 9999px;
  display: inline-block;
  vertical-align: middle;
}
.sr-strength-bar-fill {
  height: 100%;
  border-radius: 9999px;
}
.sr-strength-bar-fill.resistance { background-color: #f87171; }
.sr-strength-bar-fill.support { background-color: #4ade80; }

/* S/R level text colors */
.text-resistance { color: #fca5a5; }
.text-support { color: #86efac; }

/* Notification styles */
.notification-unread { border-left: 4px solid #3b82f6 !important; }
.notification-read { border-left: 4px solid transparent !important; }

/* Font trading (monospace) */
.font-trading { font-family: var(--bs-font-monospace); }

/* Alert hint (yellow) */
.alert-hint {
  background-color: rgba(113, 63, 18, 0.3);
  border-color: rgba(161, 98, 7, 0.5);
  color: #fde68a;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Stack gaps */
.stack-3 { gap: 0.75rem; }
.stack-6 { gap: 1.5rem; }

/* BTC price color */
.text-btc { color: #facc15; }

/* Nav link styling */
.nav-link-dark {
  color: #9ca3af;
  text-decoration: none;
}
.nav-link-dark:hover {
  color: #fff;
}

/* Pagination button */
.btn-page {
  background-color: #1f2937;
  border: none;
  color: #d1d5db;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}
.btn-page:hover:not(:disabled) {
  background-color: #374151;
  color: #f3f4f6;
}
.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Unread notification badge (small red dot) */
.badge-unread {
  position: absolute;
  top: -0.25rem;
  right: -0.75rem;
  background-color: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Action card buttons (bot controls) */
.btn-action-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1.25rem;
  background-color: #111827;
  border: 1px solid #1f2937;
  color: #fff;
  border-radius: 0.5rem;
  transition: border-color 0.15s, background-color 0.15s;
}
.btn-action-card:hover {
  color: #fff;
}
.btn-action-card.btn-action-start:hover { border-color: #16a34a; background-color: rgba(22, 78, 46, 0.2); }
.btn-action-card.btn-action-stop:hover { border-color: #dc2626; background-color: rgba(127, 29, 29, 0.2); }
.btn-action-card.btn-action-pause:hover { border-color: #ca8a04; background-color: rgba(113, 63, 18, 0.2); }
.btn-action-card.btn-action-close { border-color: rgba(127, 29, 29, 0.5); }
.btn-action-card.btn-action-close:hover { border-color: #dc2626; background-color: rgba(127, 29, 29, 0.2); }

/* SVG icon sizes */
.icon-sm { width: 1.5rem; height: 1.5rem; }

/* Chart container */
.chart-container { height: 21rem; width: 100%; }

.dashboard-shell {
  position: relative;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid #1e293b;
  border-radius: 1rem;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 32%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.28);
}

.dashboard-title {
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
}

.dashboard-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #93c5fd;
}

.dashboard-banner {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #334155;
  border-radius: 0.85rem;
  font-size: 0.9rem;
}

.dashboard-banner-warning {
  background-color: rgba(120, 53, 15, 0.35);
  border-color: rgba(217, 119, 6, 0.5);
  color: #fde68a;
}

.dashboard-banner-danger {
  background-color: rgba(127, 29, 29, 0.35);
  border-color: rgba(220, 38, 38, 0.45);
  color: #fecaca;
}

.dashboard-inline-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.dashboard-section {
  border: 1px solid #1f2937;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(10, 15, 28, 0.98));
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.22);
}

.dashboard-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-meta {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dashboard-metric-card {
  height: 100%;
  padding: 1rem;
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.72);
}

.dashboard-card-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dashboard-metric-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-entry-card {
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 0.9rem;
  background: rgba(8, 15, 28, 0.74);
}

.dashboard-entry-grid,
.dashboard-field-grid {
  display: grid;
  gap: 0.9rem;
}

.dashboard-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-level-panel {
  height: 100%;
  padding: 1rem;
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 0.9rem;
  background: rgba(8, 15, 28, 0.74);
}

.dashboard-level-item,
.dashboard-mobile-card {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.78);
}

.dashboard-mobile-card {
  display: grid;
  gap: 0.85rem;
}

.dashboard-level-price {
  font-size: 1.05rem;
  font-weight: 700;
}

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

.dashboard-value {
  display: block;
  font-family: var(--bs-font-monospace);
  color: #f8fafc;
}

.dashboard-value-muted {
  color: #cbd5e1;
}

.dashboard-empty-state {
  padding: 1.25rem;
  border: 1px dashed rgba(71, 85, 105, 0.85);
  border-radius: 0.9rem;
  color: #94a3b8;
  text-align: center;
}

.dashboard-empty-state a {
  color: #f8fafc;
}

.dashboard-syncing,
.badge-live,
.badge-limited,
.badge-degraded {
  border: 1px solid transparent;
}

.badge-live {
  background-color: rgba(20, 83, 45, 0.72);
  border-color: rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
}

.badge-limited {
  background-color: rgba(113, 63, 18, 0.72);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.badge-degraded {
  background-color: rgba(127, 29, 29, 0.72);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.dashboard-toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1095;
  display: grid;
  gap: 0.75rem;
  width: min(calc(100vw - 2rem), 22rem);
}

.dashboard-toast {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.35);
}

.dashboard-toast-success {
  border-color: rgba(34, 197, 94, 0.4);
}

.dashboard-toast-danger {
  border-color: rgba(248, 113, 113, 0.4);
}

.dashboard-toast-warning {
  border-color: rgba(251, 191, 36, 0.4);
}

.dashboard-toast-title {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dashboard-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(8px);
}

.dashboard-modal {
  width: min(100%, 34rem);
  padding: 1.35rem;
  border: 1px solid #334155;
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 28, 0.98));
  box-shadow: 0 22px 48px rgba(2, 6, 23, 0.4);
}

.dashboard-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.65);
}

.dashboard-confirm-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

body.dashboard-modal-open {
  overflow: hidden;
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  border-radius: 0.45rem;
  background: rgba(51, 65, 85, 0.42);
}

.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.22), transparent);
  animation: dashboard-shimmer 1.4s infinite;
}

@keyframes dashboard-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.dashboard-sticky {
  position: sticky;
  top: 1rem;
}

@media (max-width: 1199.98px) {
  .dashboard-sticky {
    position: static;
  }
}

@media (max-width: 767.98px) {
  .dashboard-hero,
  .dashboard-section {
    padding: 1.1rem;
  }

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

  .dashboard-field-grid,
  .dashboard-position-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-toast-stack {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .chart-container {
    height: 18rem;
  }
}

/* Dashboard tabs layout */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-tab-bar {
  display: flex;
  gap: 0.25rem;
  background-color: #1f2937;
  border-radius: 0.6rem;
  padding: 0.25rem;
  flex-shrink: 0;
}

.dashboard-tab-btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: #9ca3af;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.dashboard-tab-btn:hover {
  color: #e5e7eb;
}

.dashboard-tab-btn.active {
  background-color: #374151;
  color: #f3f4f6;
}

.dashboard-tab-panels {
  overflow: visible;
}

@media (max-width: 767.98px) {
  .dashboard-layout {
    gap: 0.5rem;
  }

  .p-mobile-3 {
    padding: 0.75rem !important;
  }

  .dashboard-metric-card {
    padding: 0.6rem 0.75rem;
  }

  .dashboard-metric-value {
    font-size: 1.2rem;
  }

  .dashboard-entry-card {
    padding: 0.75rem;
  }
}

/* Order panel */
.order-panel-tabs {
  display: inline-flex;
  gap: 0.2rem;
  background-color: #1f2937;
  border-radius: 0.4rem;
  padding: 0.15rem;
}

.order-panel-tab {
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 0.3rem;
  background: transparent;
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.order-panel-tab:hover {
  color: #e5e7eb;
}

.order-panel-tab.active {
  background-color: #374151;
  color: #f3f4f6;
}

/* Order field card */
.order-field-card {
  padding: 1rem 1.1rem;
  background: rgba(8, 15, 28, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 0.7rem;
}

/* Order action grid */
.order-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.order-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 1.1rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.order-action-label {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.order-action-sub {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.order-action-buy {
  background-color: rgba(22, 78, 46, 0.55);
  border-color: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

.order-action-buy:hover {
  background-color: rgba(22, 78, 46, 0.9);
  border-color: rgba(34, 197, 94, 0.5);
  color: #bbf7d0;
}

.order-action-sell {
  background-color: rgba(127, 29, 29, 0.55);
  border-color: rgba(248, 113, 113, 0.22);
  color: #fca5a5;
}

.order-action-sell:hover {
  background-color: rgba(127, 29, 29, 0.9);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.backtest-month-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.backtest-month-nav-title {
  text-align: center;
}

.backtest-month-nav-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.backtest-month-nav-side {
  display: flex;
  align-items: center;
}

.backtest-month-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}

.backtest-month-nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.backtest-month-nav-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.backtest-month-nav-btn span {
  line-height: 1;
}