/* StellarX light-mode overrides. Import after page CSS defines --bg etc.
 * Works for all dashboards (profile, accounts, account-details, blog, reset,
 * 404, status) that use the standard --bg / --bg2 / --text palette. */
:root[data-theme="light"] {
  --bg: #F8F9FB;
  --bg2: #ffffff;
  --bg3: #F1F2F6;
  --bg4: #E8EAF0;
  --bg-card: #ffffff;
  --bg-soft: #F8F9FB;
  --bg-hover: #F1F2F6;
  --border: #E5E7EB;
  --border2: #D1D5DB;
  --border-strong: rgba(0,0,0,.12);
  --text: #0F172A;
  --text2: #475569;
  --text3: #94A3B8;
  --text4: rgba(15,23,42,.28);
  /* Accent colors unchanged — violet/cyan/green/red work on both */
}

/* Body backgrounds */
:root[data-theme="light"] body,
:root[data-theme="light"] html { background: #F8F9FB; color: #0F172A; }

/* Input surfaces that were explicitly dark */
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background: #ffffff !important;
  color: #0F172A !important;
  border-color: #D1D5DB !important;
}
:root[data-theme="light"] .field-input,
:root[data-theme="light"] .form-input {
  background: #ffffff !important;
  color: #0F172A !important;
  border: 1px solid #D1D5DB !important;
}

/* Code blocks */
:root[data-theme="light"] code,
:root[data-theme="light"] pre {
  background: #F1F2F6;
  color: #475569;
}

/* Generic links stay readable */
:root[data-theme="light"] a { color: #5B2FDF; }
:root[data-theme="light"] a:hover { color: #00B8CC; }

/* Toggle button styling — small circular button used on nav bars */
.sx-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg3, #151030);
  border: 1px solid var(--border, #1f1a3a);
  color: var(--text, #fff);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background .15s, border-color .15s;
  padding: 0;
  font-family: inherit;
}
.sx-theme-btn:hover { background: var(--bg4, #1a1540); border-color: var(--violet, #7B4FFF); }

/* Global mobile safety — prevent horizontal overflow on any page */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, svg:not(.keep-svg-size) { max-width: 100%; height: auto; }

/* iOS-safe viewport on mobile */
@media (max-width: 900px) {
  /* Respect notch/status bar on all pages that use a sidebar or top area */
  .sidebar, .topbar, .nav, nav, aside {
    padding-top: env(safe-area-inset-top) !important;
  }
  /* Any bottom-fixed element gets safe-area bottom padding */
  .bottom-bar, .mobile-bar, [data-mobile-bar] {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
}

/* Ensure tables scroll on mobile instead of breaking layout */
@media (max-width: 640px) {
  .orders-table, table.orders-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  /* 44px+ touch targets on buttons (WCAG) */
  button, .btn, .card-btn, .copy-btn, .save-btn, .refresh-btn, .tab { min-height: 40px; }
  /* Don't let long words break layout */
  .ref-link, .field-value, .check-note { word-break: break-word; overflow-wrap: anywhere; }
  /* Form inputs: full-width + readable */
  input, select, textarea { font-size: 16px !important; /* prevents iOS auto-zoom */ }
  /* Tabs always scroll horizontally */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}
