/* TradeEase Modern Dark Theme */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #182234;
  --bg-card-hover: #1e293b;
  --border: #243247;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.2);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.15);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.15);
  --yellow: #f59e0b;
  --purple: #a855f7;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Header & Ticker Bar */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.market-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.ticker-strip {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem 1.5rem;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.2);
  scrollbar-width: none;
}

.ticker-strip::-webkit-scrollbar {
  display: none;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.ticker-sym {
  color: var(--text-muted);
}

.ticker-price {
  font-weight: 700;
}

.badge-up {
  color: var(--green);
  background: var(--green-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.badge-down {
  color: var(--red);
  background: var(--red-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Nav Tabs */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.tab-btn.active {
  color: #fff;
  background: #1e293b;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

/* Main Container */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: #3b82f6;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Stat Box */
.stat-box {
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.stat-sub {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Screener Setup Cards */
.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s ease;
}

.setup-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.setup-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.setup-symbol {
  font-size: 1.2rem;
  font-weight: 800;
}

.setup-name {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setup-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.badge-cpr {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.badge-orb {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.badge-comm {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.setup-rationale {
  font-size: 0.83rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.setup-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: #111827;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
  text-align: center;
}

.level-item span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}

.level-item strong {
  color: #fff;
}

.setup-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-accent {
  background: #0284c7;
  color: #fff;
}
.btn-accent:hover {
  background: #0369a1;
}

.btn-green {
  background: #059669;
  color: #fff;
}
.btn-green:hover {
  background: #047857;
}

.btn-red {
  background: #dc2626;
  color: #fff;
}
.btn-red:hover {
  background: #b91c1c;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover {
  background: var(--bg-card);
  color: #fff;
  border-color: #64748b;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-input, .form-select {
  background: #111827;
  border: 1px solid var(--border);
  color: #fff;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th {
  background: #111827;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Checklist Items */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #111827;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.check-item:hover {
  border-color: #475569;
}

.check-item.done {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.check-item.done .check-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.check-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.check-item.done .check-box {
  background: var(--green);
  border-color: var(--green);
}

.check-box::after {
  content: '✓';
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  display: none;
}

.check-item.done .check-box::after {
  display: block;
}

.check-text {
  font-size: 0.88rem;
  font-weight: 500;
}

/* CPR Indicator Bar */
.cpr-bar-container {
  background: #111827;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.cpr-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.cpr-visual {
  position: relative;
  height: 28px;
  background: #1e293b;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
}

.cpr-zone {
  height: 100%;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.4), rgba(56, 189, 248, 0.4));
  border-left: 2px solid #a855f7;
  border-right: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  border: 1px solid var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .top-bar { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .setup-levels { grid-template-columns: 1fr; }
}
