/* static/css/layout.css */
/* ================================
   LAYOUT - THREE-COLUMN APP SHELL
   Edge Odds Design System
   ================================ */

/* ==========================================================
   APP CONTAINER — CSS Grid, three columns
   [sidebar 200px] [main flex] [signals 260px]
   ========================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--signals-width);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background: var(--bg-primary);
  font-family: var(--font-mono), var(--font-family), monospace;
}

/* ==========================================================
   LEFT SIDEBAR (.side-nav / .snav)
   ========================================================== */
.side-nav,
.snav {
  grid-row: 1 / -1;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Brand area */
.snav-brand {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.snav-brand .dim {
  color: var(--text-dim);
  font-weight: 500;
}

/* Sport selector dropdown */
.sport-sel {
  margin: 10px 10px 0;
  position: relative;
}
.sport-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono), monospace;
  cursor: pointer;
}
.sport-btn:hover {
  border-color: var(--text-ghost);
}
.sport-btn .arr {
  font-size: 10px;
  color: var(--text-dim);
}
.sport-drop {
  display: none;
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: 5px;
  padding: 3px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.sport-drop.show {
  display: block;
}
.sport-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 3px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.sport-opt:hover {
  background: #14141a;
  color: var(--text-primary);
}
.sport-opt.active {
  background: var(--accent-muted);
  color: var(--accent-hover);
}
.sport-opt .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.sport-opt .soon {
  font-size: var(--text-xs);
  color: var(--text-invisible);
  margin-left: auto;
}

/* Nav groups */
.ng {
  padding: 10px 6px 2px;
}
.ng-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-invisible);
  padding: 0 8px;
  margin-bottom: 3px;
}
.ni {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  position: relative;
}
.ni:hover {
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.ni.active {
  background: rgba(168, 85, 247, 0.06);
  color: var(--accent-hover);
}
.ni.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.ni .ic {
  width: 14px;
  text-align: center;
  font-size: 12px;
}
.ni .bdg {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0 4px;
  border-radius: 6px;
}
.ni .bdg.g {
  color: var(--success);
  background: rgba(74, 222, 128, 0.08);
}
.ni .bdg.p {
  color: var(--accent-hover);
  background: var(--accent-muted);
}

/* Sidebar bottom — live status */
.snav-bottom {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--border-default);
}
.snav-live {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: var(--bg-surface);
  border-radius: 5px;
  font-size: var(--text-xs);
  color: var(--text-ghost);
}
.snav-live .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--success);
  animation: snav-blink 2s infinite;
}
.snav-live .v {
  color: var(--success);
  font-weight: 600;
}
@keyframes snav-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ==========================================================
   TOP BAR (.tbar)
   42px height, spans main + signals columns
   ========================================================== */
.tbar {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-card);
  gap: 10px;
}
.tbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-display);
}
.tbar-crumb {
  font-size: 12px;
  color: var(--text-ghost);
  font-family: var(--font-mono), monospace;
}
.tbar-crumb span {
  color: var(--text-muted);
}

/* View tabs in top bar */
.vtabs {
  display: flex;
  gap: 0;
  margin-left: 16px;
}
.vtab {
  padding: 12px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-ghost);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: var(--font-mono), monospace;
}
.vtab:hover {
  color: var(--text-muted);
}
.vtab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}
.vtab .ct {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--accent-muted);
  color: var(--accent-hover);
  margin-left: 3px;
}

/* Top bar right section */
.tbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tbar-search {
  padding: 3px 8px;
  background: var(--bg-surface);
  border: 1px solid #16161e;
  border-radius: 3px;
  font-family: var(--font-mono), monospace;
  font-size: 12px;
  color: var(--text-muted);
  width: 130px;
}
.tbar-stat {
  font-size: var(--text-xs);
  color: var(--text-invisible);
  font-family: var(--font-mono), monospace;
}
.tbar-stat .v {
  font-weight: 600;
}
.tbar-stat .v.g {
  color: var(--success);
}
.tbar-stat .v.p {
  color: var(--accent-hover);
}

/* ==========================================================
   MAIN AREA
   ========================================================== */
.main-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Legacy .main class — kept for JS compatibility */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Filter strip --- */
.fstrip,
.filter-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--bg-surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fstrip::-webkit-scrollbar,
.filter-strip::-webkit-scrollbar {
  display: none;
}

/* Data scroll area */
.dscroll,
.data-scroll {
  flex: 1;
  overflow-y: auto;
}

/* ==========================================================
   SIGNALS SIDEBAR (.signals / .sigs)
   ========================================================== */
.signals,
.sigs {
  border-left: 1px solid var(--border-default);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================
   LEGACY LAYOUT ELEMENTS
   Kept for JS/HTML compatibility during migration
   ========================================================== */

/* --- Header (legacy) --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-default);
  height: var(--header-height);
}
.header__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}
.header__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* --- Sub-nav (legacy) --- */
.sub-nav {
  display: flex;
  gap: var(--space-1);
  padding: 0 var(--space-5);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-default);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-nav::-webkit-scrollbar {
  display: none;
}
.sub-nav__tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.sub-nav__tab:hover {
  color: var(--text-primary);
}
.sub-nav__tab--active {
  color: var(--accent);
}
.sub-nav__tab--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-2);
  right: var(--space-2);
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

/* --- More dropdown (legacy) --- */
.more-dropdown {
  position: relative;
  display: inline-flex;
}
.more-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text-muted);
  border: none;
  transition: all var(--transition-fast);
}
.more-dropdown__trigger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.more-dropdown__trigger--active {
  background: var(--accent);
  color: white;
}
.more-dropdown__trigger::after {
  content: '';
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
}
.more-dropdown__menu {
  display: none;
  position: fixed;
  min-width: 160px;
  padding: var(--space-1) 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.more-dropdown--open .more-dropdown__menu {
  display: block;
}
.more-dropdown__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.more-dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.more-dropdown__item--active {
  color: var(--accent);
}

/* --- Filter bar (legacy) --- */
.filter-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-default);
  overflow: visible;
}
.filter-bar__pills {
  display: flex;
  gap: var(--space-2);
}
.filter-bar__spacer {
  flex: 1;
}

/* --- Content area (legacy) --- */
.content {
  flex: 1;
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
}

/* --- Cards grid (legacy) --- */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ==========================================================
   MOBILE LAYOUT
   ========================================================== */

/* Mobile header */
.mh {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
}
.mh-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}
.mh-title .dim {
  color: var(--text-dim);
  font-weight: 500;
}
.mh-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mh-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--success);
  animation: snav-blink 2s infinite;
}
.mh-live {
  font-size: var(--text-xs);
  color: var(--text-invisible);
}

/* Mobile sport bar */
.m-sport-bar {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  gap: 8px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-surface);
}
.m-sport-trig {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid #16161e;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.m-sport-trig .arr {
  font-size: 9px;
  color: var(--text-dim);
}

/* Mobile view tabs */
.m-vtabs {
  display: flex;
  gap: 0;
  margin-left: auto;
}
.m-vt {
  padding: 4px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-ghost);
  border-bottom: 2px solid transparent;
}
.m-vt.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* Mobile filters */
.m-filters {
  display: flex;
  gap: 3px;
  padding: 6px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}
.m-filters::-webkit-scrollbar {
  display: none;
}
.m-fc {
  padding: 2px 7px;
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid #16161e;
  border-radius: 2px;
  color: var(--text-ghost);
  white-space: nowrap;
  flex-shrink: 0;
}
.m-fc.on {
  color: var(--accent-hover);
  border-color: var(--accent-border);
  background: rgba(168, 85, 247, 0.04);
}

/* Mobile signals banner */
.m-sig-banner {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--bg-surface);
}
.m-sig-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: snav-blink 2s infinite;
}
.m-sig-text {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-weight: 500;
}
.m-sig-text .v { font-weight: 700; }
.m-sig-text .g { color: var(--success); }
.m-sig-text .p { color: var(--accent-hover); }
.m-sig-text .r { color: var(--danger); }
.m-sig-btn {
  margin-left: auto;
  font-size: 10px;
  color: var(--accent-hover);
  font-weight: 600;
}

/* Mobile data area */
.m-data {
  padding: 0;
}

/* Mobile bottom tab bar */
.m-btm,
.m-bottom-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border-default);
  padding: 5px 0 8px;
}
.m-bt {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-invisible);
}
.m-bt .ic {
  font-size: 16px;
  margin-bottom: 1px;
  display: block;
}
.m-bt.active {
  color: var(--accent-hover);
}
.m-bt .b {
  font-size: 9px;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 6px;
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  margin-left: 1px;
}

/* Mobile signals full-screen sheet (toggled via JS) */
.m-sigs-open .signals {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 600;
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
}
.m-sigs-open .panel-overlay {
  display: block;
  z-index: 599;
}

/* Mobile signals sheet */
.m-sigs {
  max-width: 390px;
  background: var(--bg-primary);
  font-family: var(--font-mono), var(--font-family), monospace;
  min-height: 480px;
  border-radius: 12px;
  overflow: hidden;
}
.ms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
}
.ms-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.ms-close {
  font-size: 22px;
  color: var(--text-dim);
  cursor: pointer;
}
.ms-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px;
}
.ms-box {
  text-align: center;
  padding: 6px;
  background: #0b0b0e;
  border: 1px solid var(--border-default);
  border-radius: 4px;
}
.ms-bv {
  font-size: var(--text-lg);
  font-weight: 700;
}
.ms-bv.g { color: var(--success); }
.ms-bv.p { color: var(--accent-hover); }
.ms-bv.r { color: var(--danger); }
.ms-bv.y { color: var(--warning); }
.ms-bl {
  font-size: 9px;
  color: var(--text-ghost);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}
.ms-filters {
  display: flex;
  gap: 3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bg-surface);
}
.ms-f {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 2px;
  color: var(--text-ghost);
  border: 1px solid transparent;
}
.ms-f.on {
  border-color: #16161e;
  color: var(--text-muted);
}
.ms-f.arb {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.15);
}
.ms-f.ev {
  color: var(--accent-hover);
  border-color: rgba(168, 85, 247, 0.15);
}
.ms-scroll {
  padding: 6px 10px;
}
.ms-card {
  padding: 8px 10px;
  background: #0b0b0e;
  border: 1px solid #10101a;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
}
.ms-tag {
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.ms-tag.arb { background: rgba(74, 222, 128, 0.06); color: var(--success); }
.ms-tag.ev { background: rgba(168, 85, 247, 0.06); color: var(--accent-hover); }
.ms-tag.drift { background: rgba(251, 191, 36, 0.06); color: var(--warning); }
.ms-tag.short { background: rgba(248, 113, 113, 0.06); color: var(--danger); }
.ms-nm { color: var(--text-secondary); font-weight: 600; margin-bottom: 1px; }
.ms-dt { color: var(--text-ghost); font-size: var(--text-xs); }
.ms-dt .g { color: var(--success); }
.ms-dt .p { color: var(--accent-hover); }
.ms-dt .y { color: var(--warning); }
.ms-dt .r { color: var(--danger); }
.ms-tm { color: var(--text-invisible); font-size: 10px; margin-top: 2px; }

/* ==========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================== */

/* --- Mobile (<640px) --- */
@media (max-width: 639px) {
  .app {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }

  /* Hide sidebar and signals on mobile */
  .side-nav,
  .snav,
  .signals,
  .sigs {
    display: none;
  }

  .tbar {
    grid-column: auto;
  }

  .header {
    padding: var(--space-4);
    height: var(--header-height);
  }
  .header__title {
    font-size: var(--text-lg);
  }
  .sub-nav {
    padding: 0 var(--space-4);
  }
  .filter-bar {
    padding: var(--space-3) var(--space-4);
  }
  .content {
    padding: var(--space-3) var(--space-4);
  }

  /* Display toggling */
  .desktop-only {
    display: none !important;
  }
}

/* --- Tablet (640px - 1023px) --- */
@media (min-width: 640px) and (max-width: 1023px) {
  .app {
    grid-template-columns: 1fr var(--signals-width);
  }

  /* Hide sidebar on tablet */
  .side-nav,
  .snav {
    display: none;
  }

  .tbar {
    grid-column: 1 / -1;
  }

  /* Hide mobile-only elements */
  .mobile-only {
    display: none !important;
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  /* Hide mobile-only elements */
  .mobile-only {
    display: none !important;
  }

  /* Panel open — squeeze main area */
  .app--panel-open .main {
    margin-right: 300px;
  }
}

/* Tablet and up — generic mobile-only hide */
@media (min-width: 640px) {
  .mobile-only {
    display: none !important;
  }
  .mobile-cards {
    display: none;
  }
}
