:root {
  --bg-color: #0b0f19;
  --glass-bg: rgba(20, 25, 40, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-main: #f0f4f8;
  --text-muted: #8a9bb2;
  --accent-cyan: #00f0ff;
  --accent-purple: #8a2be2;
  --accent-red: #ff3b3b;
  --accent-green: #00e676;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Effects */
.grid-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: linear-gradient(var(--glass-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: -1;
  opacity: 0.3;
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -2;
  opacity: 0.4;
  animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
  top: -10%; left: -10%;
}

.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
  bottom: -10%; right: -5%;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, 30px) scale(1.1); }
  100% { transform: translate(-30px, -50px) scale(0.9); }
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 100vh;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
}

.brand h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand h1 span {
  color: var(--accent-cyan);
}

.brand .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.input-group input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  width: 250px;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.search-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

button.glow-on-hover {
  position: relative;
  border: none;
  background: linear-gradient(45deg, var(--accent-cyan), #0077ff);
  color: #fff;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 160px;
  display: flex;
  justify-content: center;
  align-items: center;
}

button.glow-on-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

button.glow-on-hover:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.loader-spinner {
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top: 3px solid #fff;
  width: 20px;
  height: 20px;
  -webkit-animation: spin 1s linear infinite; /* Safari */
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Alerts */
.alert-box {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--accent-cyan);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.alert-box.error { border-left-color: var(--accent-red); background: rgba(255, 0, 0, 0.05); }
.alert-box.success { border-left-color: var(--accent-green); background: rgba(0, 255, 0, 0.05); }

/* Charts Area */
.charts-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}

.chart-wrapper {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 400px;
}

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

.chart-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.chart-header h2 span {
  color: var(--text-muted);
  font-weight: 400;
}

.stat-badge {
  background: rgba(255,255,255,0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.canvas-container {
  position: relative;
  flex: 1;
  width: 100%;
}

/* Data Table Area */
.data-table-container {
  padding: 1.5rem;
  margin-top: 1rem;
}

.table-scroll-area {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.table-scroll-area::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-scroll-area::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.table-scroll-area::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

#raw-data-table {
  width: max-content; /* Allow table to stretch beyond container */
  border-collapse: separate; /* Required for sticky to work correctly with borders */
  border-spacing: 0;
  text-align: right;
  font-size: 0.85rem;
}

#raw-data-table th, #raw-data-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.02);
  white-space: nowrap;
  min-width: 70px;
}

#raw-data-table .super-header th {
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: 1rem;
}

#raw-data-table .sub-header th {
  position: sticky;
  top: 40px; /* Below super header */
  z-index: 9;
  background: rgba(20, 25, 40, 0.95);
  font-weight: 600;
  color: var(--text-muted);
}

.strike-col {
  position: sticky;
  left: 0;
  z-index: 11 !important; /* Highest z-index to stay above scrolled headers and rows */
  background: rgba(15, 20, 30, 0.98) !important;
  font-weight: 700;
  color: #fff;
  text-align: center !important;
  border-right: 2px solid rgba(255, 255, 255, 0.1) !important;
}

.call-header { background: rgba(0, 230, 118, 0.1); color: var(--accent-green); border-right: 2px solid rgba(255, 255, 255, 0.1) !important;}
.put-header { background: rgba(255, 59, 59, 0.1); color: var(--accent-red); }

/* Apply backgrounds to data blocks */
#raw-data-table tbody td:nth-child(n+2):nth-child(-n+14) {
  background: rgba(0, 230, 118, 0.02);
}
#raw-data-table tbody td:nth-child(n+15) {
  background: rgba(255, 59, 59, 0.02);
}
#raw-data-table tbody td:nth-child(14) {
  border-right: 2px solid rgba(255, 255, 255, 0.1) !important;
}

#raw-data-table tbody tr:hover td {
  background: rgba(0, 240, 255, 0.1) !important;
}
