:root {
  --bg-main: #050505;
  --bg-card: rgba(15, 10, 10, 0.65);
  --bg-card-solid: #0A0505;
  --bg-header: rgba(10, 5, 5, 0.85);
  --border-color: rgba(220, 38, 38, 0.15);
  --text-primary: #FFFFFF;
  --text-secondary: #9CA3AF;
  
  --color-buy: #10B981;
  --color-watch: #F59E0B;
  --color-reject: #EF4444;
  --color-info: #E11D48;
  
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(220, 38, 38, 0.12), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(153, 27, 27, 0.15), transparent 40%),
    linear-gradient(135deg, #000000 0%, #0a0000 100%);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 { font-weight: 600; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-secondary { color: var(--text-secondary); }
.text-buy { color: var(--color-buy); }
.text-watch { color: var(--color-watch); }
.text-reject { color: var(--color-reject); }
.text-info { color: var(--color-info); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--glass-shadow);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(90deg, #FF4B4B, #DC2626);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

main {
  padding: 2rem;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.grid-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.grid-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}


/* Cards & Glassmorphism */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Top Picks Styles */
.top-picks-wrapper {
  margin-bottom: 2rem;
}
.grid-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.pick-card {
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: linear-gradient(180deg, rgba(20, 10, 5, 0.8) 0%, rgba(10, 5, 5, 0.9) 100%);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.1);
  transition: all 0.3s ease;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.pick-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
}
.pick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.pick-rank {
  font-size: 1.25rem;
  font-weight: 800;
  color: #FBBF24;
  background: rgba(245, 158, 11, 0.15);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.4);
  flex-shrink: 0;
}
.pick-title {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-left: 1rem;
  min-width: 0;
}
.pick-score {
  text-align: right;
  flex-shrink: 0;
}
.pick-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.metric-box {
  background: rgba(0,0,0,0.3);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mb-6 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.text-xl { font-size: 1.25rem; }
.text-lg { font-size: 1.125rem; }

/* Buttons & Filters */
.filters-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.5);
  color: #FF4B4B;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.2);
}

.search-input {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  width: 300px;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
  border-color: var(--color-reject);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Table Container - Horizontal & Vertical Scroll */
.table-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 500px;
}

.table-container {
  overflow: auto;
  flex: 1;
  max-height: calc(100vh - 350px);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  min-width: 1800px; /* Ensure horizontal scroll */
}

th {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  padding: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--text-primary); }

td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.875rem;
  white-space: nowrap;
  background: var(--bg-card-solid);
}

tr {
  transition: background-color 0.2s ease;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Freeze First 6 Columns */
th:nth-child(1), td:nth-child(1) { position: sticky; left: 0; width: 60px; min-width: 60px; z-index: 20; border-right: 1px solid var(--border-color); }
th:nth-child(2), td:nth-child(2) { position: sticky; left: 60px; width: 120px; min-width: 120px; z-index: 20; border-right: 1px solid var(--border-color); }
th:nth-child(3), td:nth-child(3) { position: sticky; left: 180px; width: 180px; min-width: 180px; max-width: 180px; z-index: 20; border-right: 1px solid var(--border-color); overflow: hidden; text-overflow: ellipsis; }
th:nth-child(4), td:nth-child(4) { position: sticky; left: 360px; width: 70px; min-width: 70px; z-index: 20; border-right: 1px solid var(--border-color); }
th:nth-child(5), td:nth-child(5) { position: sticky; left: 430px; width: 100px; min-width: 100px; z-index: 20; border-right: 1px solid var(--border-color); }
th:nth-child(6), td:nth-child(6) { position: sticky; left: 530px; width: 100px; min-width: 100px; z-index: 20; border-right: 1px solid var(--border-color); }

th:nth-child(1), th:nth-child(2), th:nth-child(3), th:nth-child(4), th:nth-child(5), th:nth-child(6) { z-index: 30; background-color: #050202; }
td:nth-child(1), td:nth-child(2), td:nth-child(3), td:nth-child(4), td:nth-child(5), td:nth-child(6) { background-color: #0A0505; transition: background-color 0.2s ease; }
tr:hover td:nth-child(1), tr:hover td:nth-child(2), tr:hover td:nth-child(3), tr:hover td:nth-child(4), tr:hover td:nth-child(5), tr:hover td:nth-child(6) { background-color: #1A1111; }
tr:hover td { background-color: rgba(255, 255, 255, 0.08); }


/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.badge.buy { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.4)); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.6); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2); }
.badge.watch { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.4)); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.6); box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2); }
.badge.reject { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.4)); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.6); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2); }

/* Sliding Drawer */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0; right: -500px;
  width: 500px;
  height: 100vh;
  background: var(--bg-card-solid);
  border-left: 1px solid var(--border-color);
  z-index: 9999;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
}
.drawer.active {
  right: 0;
}

.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 5, 5, 0.9);
}

.drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.reason-box {
  background: rgba(0,0,0,0.2);
  border-left: 4px solid var(--color-info);
  padding: 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: 1rem;
}
.reason-box ul {
  list-style: none;
  margin-top: 0.5rem;
}
.reason-box li {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.25rem;
}
.reason-box li:last-child {
  border-bottom: none;
}
.status-pass { color: #34D399; font-weight: bold; }
.status-fail { color: #F87171; font-weight: bold; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* Responsive Base & Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
}
.mobile-menu-btn:hover {
  background: rgba(255,255,255,0.1);
}

.sidebar {
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  /* Disable sticky frozen columns on small screens as they break scrolling */
  th:nth-child(1), td:nth-child(1), th:nth-child(2), td:nth-child(2),
  th:nth-child(3), td:nth-child(3), th:nth-child(4), td:nth-child(4) {
    position: static;
  }
  
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .hide-on-mobile {
    display: none !important;
  }
  main {
    padding: 1rem;
  }
  header {
    padding: 1rem;
  }
  .grid-overview {
    grid-template-columns: 1fr;
  }
  .search-input {
    width: 100%;
  }
  .filters-bar {
    justify-content: flex-start;
  }
  .drawer {
    width: 100vw;
    right: -100vw;
  }
  .table-container {
    max-height: calc(100vh - 250px);
  }
}

/* Sidebar & Tabs Styles */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.nav-btn.active {
  background: rgba(220, 38, 38, 0.1);
  color: #FF4B4B;
  border-right: 3px solid #DC2626;
}
.nav-btn i {
  width: 20px;
  height: 20px;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Primary Buttons */
.btn-primary {
  background: linear-gradient(135deg, #DC2626, #991B1B);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
}
.btn-primary:active {
  transform: scale(0.98);
}

/* Custom Modal */
.custom-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.custom-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.custom-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--glass-shadow);
  transform: scale(0.9);
  transition: all 0.3s ease;
}
.custom-modal-overlay.active .custom-modal {
  transform: scale(1);
}
.custom-modal h3 {
  margin-bottom: 1rem;
}
.custom-modal input {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  margin-bottom: 1.5rem;
}
.custom-modal input:focus {
  outline: none;
  border-color: var(--color-info);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}
.btn-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.btn-cancel:hover {
  background: rgba(255,255,255,0.05);
}
