/* ═══════════════════════════════════════════════════════════
   EkatraCore — Universal Theme Override
   Forces theme variables on ALL pages + inline styles
   Load LAST in <head> to override everything
   ═══════════════════════════════════════════════════════════ */

/* === BASE === */
html, body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: var(--font) !important;
  transition: background .3s ease, color .3s ease;
}

/* === LINKS === */
a:not(.open-btn):not(.btn):not([class*="btn-"]) { color: var(--accent) !important; }
a:not(.open-btn):not(.btn):not([class*="btn-"]):hover { color: var(--accent-hover) !important; }

/* === HEADINGS === */
h1, h2, h3, h4, h5 { color: var(--text-heading) !important; }

/* === NUKE ALL DARK BACKGROUNDS === */
[style*="background:#0f172a"],
[style*="background: #0f172a"],
[style*="background-color:#0f172a"],
[style*="background:#0b1120"],
[style*="background:#1e293b"],
[style*="background: #1e293b"],
[style*="background-color:#1e293b"],
[style*="background:#1a1a2e"],
[style*="background: #1a1a2e"],
[style*="background:#111827"],
[style*="background:#0d1117"] {
  background: var(--bg-card) !important;
}

/* === NUKE ALL DARK BORDERS === */
[style*="border:1px solid #334155"],
[style*="border: 1px solid #334155"],
[style*="border-color:#334155"],
[style*="border:1px solid #475569"],
[style*="border:2px dashed #475569"],
[style*="border:1px solid #0f3460"] {
  border-color: var(--border) !important;
}

/* === NUKE ALL DARK TEXT === */
[style*="color:#e2e8f0"], [style*="color: #e2e8f0"],
[style*="color:#f8fafc"], [style*="color: #f8fafc"],
[style*="color:#f1f5f9"], [style*="color: #f1f5f9"] {
  color: var(--text-primary) !important;
}
[style*="color:#94a3b8"], [style*="color: #94a3b8"],
[style*="color:#64748b"], [style*="color: #64748b"],
[style*="color:#cbd5e1"], [style*="color: #cbd5e1"] {
  color: var(--text-secondary) !important;
}

/* === CONTAINERS / SECTIONS === */
.container, .card, .panel, .section, .form-section,
.trade-card, .settings-card, [class*="card"], [class*="section"],
[class*="panel"], .form-card, .upload-zone, .chart-container,
.report-section, .step-content, .tab-content, .sync-section,
.collapsible, .collapsible-content, details, summary,
div[style*="border-radius"][style*="border:1px solid"],
div[style*="border-radius"][style*="padding"] {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}

/* === INPUTS === */
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="url"],
input[type="tel"], input[type="search"], input[type="time"],
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
textarea, select {
  background: var(--bg-inset) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 12px !important;
  font-family: var(--font) !important;
  font-size: 14px !important;
  transition: border-color .2s !important;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px var(--accent-light) !important;
}
::placeholder { color: var(--text-tertiary) !important; opacity: 1 !important; }

/* === BUTTONS PRIMARY === */
button[style*="background:#3b82f6"],
button[style*="background: #3b82f6"],
button[style*="background:#2563eb"],
button[style*="background:#059669"],
.btn-primary, .btn-save, [class*="btn-primary"],
button[style*="background:linear-gradient"] {
  background: var(--accent) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
  font-family: var(--font) !important;
  cursor: pointer !important;
  transition: all .2s !important;
}

/* === BUTTONS SECONDARY === */
button[style*="background:transparent"],
button[style*="background:#1e293b"],
.btn-secondary, .btn-cancel, .btn-outline {
  background: var(--bg-inset) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font) !important;
}

/* === DANGER BUTTONS (keep red) === */
button[style*="background:#ef4444"],
button[style*="background: #ef4444"],
.btn-danger, [class*="btn-danger"], [class*="btn-remove"],
button[style*="color:#ef4444"] {
  background: var(--danger) !important;
  color: #fff !important;
}

/* === SUCCESS BUTTONS (keep green) === */
button[style*="background:#22c55e"],
button[style*="background: #22c55e"],
button[style*="background:#10b981"] {
  background: var(--success) !important;
  color: #fff !important;
}

/* === WARNING BUTTONS === */
button[style*="background:#f59e0b"],
button[style*="border:1px solid #f59e0b"] {
  background: var(--warning) !important;
  color: #fff !important;
}

/* === TABS / STEPS === */
.tab, .step-btn, [class*="tab-btn"], [class*="step"] {
  font-family: var(--font) !important;
}

/* === TABLES === */
table { border-color: var(--border) !important; border-collapse: collapse !important; }
th { background: var(--bg-inset) !important; color: var(--text-secondary) !important; border-color: var(--border) !important; font-weight: 600 !important; }
td { border-color: var(--border) !important; color: var(--text-primary) !important; }
tr:hover td { background: var(--accent-light) !important; }

/* === UPLOAD ZONE === */
[style*="border:2px dashed"] {
  border: 2px dashed var(--border) !important;
  background: var(--bg-inset) !important;
  border-radius: var(--radius-md) !important;
}

/* === MODALS === */
.modal, .modal-content, [class*="modal-overlay"] > div,
.correction-modal, .correction-modal-overlay .correction-modal {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}

/* === LABELS === */
label, .form-label, [class*="label"]:not(button):not(a):not(span),
[style*="text-transform:uppercase"][style*="font-size:1"],
[style*="text-transform:uppercase"][style*="font-size:0."] {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
}

/* === LEARNING BAR / STATUS === */
.learning-bar {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}

/* === TRADE CARDS in manual-trade === */
div[style*="border-radius:12px"][style*="margin-bottom"],
div[style*="border-radius: 12px"][style*="margin-bottom"] {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* === HERO / GRADIENT SECTIONS === */
.hero, [class*="hero"],
[style*="background:linear-gradient(135deg,#1e1b4b"],
[style*="background:linear-gradient(135deg, #1e1b4b"] {
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* === DIVIDERS === */
hr { border-color: var(--border) !important; }

/* === SMOOTH TRANSITIONS === */
*, *::before, *::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}
/* Don't transition layout properties */
*:not(input):not(button):not(a) {
  transition-property: background-color, border-color, color;
}

/* === SELECTION === */
::selection {
  background: var(--accent) !important;
  color: #fff !important;
}
