/* ========================================================================== */
/* Design System — Apple Futuristic                                            */
/* Clean, spacious, refined. Inspired by iOS/macOS dark mode.                  */
/* ========================================================================== */

body {
  margin: 0;
  color: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Inter', 'Noto Sans SC', 'PingFang SC', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.47;
  background: #000000;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #1c1c1e;
  position: relative;
}

[data-theme="light"] body { background: #f5f5f7; color: #1d1d1f; }
[data-theme="light"] #root { background: #f5f5f7; }

.skip-to-content { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; z-index: -1; }

/* ─── Design Tokens ─── */
:root {
  --bg-base: #1c1c1e;
  --bg-secondary: #2c2c2e;
  --bg-tertiary: #3a3a3c;
  --bg-elevated: #48484a;
  --bg-hover: rgba(255,255,255,0.06);
  --bg-active: rgba(255,255,255,0.1);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --text-placeholder: #48484a;
  --accent: #007AFF;
  --accent-secondary: #5e5ce6;
  --accent-hover: #409cff;
  --accent-subtle: rgba(10,132,255,0.12);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);
  --border-accent: rgba(10,132,255,0.4);
  --success: #30d158;
  --danger: #ff453a;
  --warning: #ffd60a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 28px;
  --glass-bg: rgba(30,30,32,0.72);
  --glass-border: rgba(255,255,255,0.1);
  --glass-blur: 40px;
  --xbot-bg-secondary: var(--bg-secondary);
  --xbot-bg-input: rgba(0,0,0,0.3);
  --xbot-bg-elevated: var(--bg-hover);
  --xbot-bg-danger: rgba(255,69,58,0.15);
  --xbot-border: var(--border);
  --xbot-border-danger: rgba(255,69,58,0.3);
  --xbot-border-light: var(--border);
  --xbot-text-primary: var(--text-primary);
  --xbot-text-secondary: var(--text-secondary);
  --xbot-text-muted: var(--text-tertiary);
  --xbot-text-placeholder: var(--text-placeholder);
  --xbot-text-danger: #ff453a;
  --xbot-accent: var(--accent);
  --xbot-accent-blue: var(--accent);
  --xbot-text-link: var(--accent);
  --xbot-bg-surface: var(--bg-secondary);
  --xbot-text-code: var(--accent);
  --xbot-bg-code: rgba(0,0,0,0.4);
  --xbot-color-error: #dc2626;
  --xbot-bg-copy-btn: var(--bg-hover);
  --xbot-bg-copy-btn-hover: var(--bg-active);
  --xbot-img-brightness: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
[data-theme="light"] {
  --bg-base: #ffffff; --bg-secondary: #f2f2f7; --bg-tertiary: #e5e5ea; --bg-elevated: #d1d1d6;
  --bg-hover: rgba(0,0,0,0.04); --bg-active: rgba(0,0,0,0.08);
  --text-primary: #1d1d1f; --text-secondary: #6e6e73; --text-tertiary: #8e8e93; --text-placeholder: #c7c7cc;
  --accent: #007aff; --accent-secondary: #5856d6; --accent-hover: #0071e3;
  --border: rgba(0,0,0,0.08); --border-hover: rgba(0,0,0,0.15);
  --glass-bg: rgba(255,255,255,0.72); --glass-border: rgba(0,0,0,0.08); --glass-blur: 40px;
  --xbot-bg-secondary: #f2f2f7; --xbot-bg-input: rgba(0,0,0,0.04);
}

[data-theme="light"] .markdown-body pre { background: #f2f2f7 !important; }

[data-theme="light"] .markdown-body code { background: rgba(0,0,0,0.05); }

::selection { background: rgba(10,132,255,0.3); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ─── Markdown ─── */
.markdown-body { background: transparent !important; font-size: 15px; line-height: 1.6; }
.markdown-body p { margin: 0.4em 0; }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { margin: 0.7em 0 0.3em; font-weight: 600; letter-spacing: -0.02em; }
.markdown-body h1 { font-size: 1.3em; } .markdown-body h2 { font-size: 1.15em; } .markdown-body h3 { font-size: 1.05em; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body blockquote { border-left: 3px solid var(--accent); margin: 0.5em 0; padding: 0.2em 1em; background: var(--accent-subtle); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.markdown-body code { background: var(--bg-secondary); padding: 2px 6px; border-radius: 6px; font-size: 0.88em; }
.markdown-body pre { background: #000 !important; border-radius: var(--radius-md); padding: 1em; overflow-x: auto; margin: 0.5em 0; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
.markdown-body th,.markdown-body td { border: 1px solid var(--border); padding: 6px 10px; }
.markdown-body th { background: var(--bg-hover); }
.markdown-body img { max-width: 100%; border-radius: var(--radius-md); }
.markdown-body ul,.markdown-body ol { padding-left: 1.5em; }
.markdown-body li { margin: 0.1em 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 0.8em 0; }

/* ─── Animations ─── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes fadeInBackdrop { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOutBackdrop { from { opacity: 1; } to { opacity: 0; } }
.animate-fade-in { animation: fadeIn 0.2s ease; }

.toast { position: fixed; top: 16px; right: 16px; z-index: 9999; padding: 10px 18px; border-radius: var(--radius-md); font-size: 14px; animation: fadeIn 0.2s ease; }
.toast-success { background: rgba(48,209,88,0.15); color: #30d158; border: 1px solid rgba(48,209,88,0.2); }
.toast-error { background: rgba(255,69,58,0.15); color: #ff453a; border: 1px solid rgba(255,69,58,0.2); }
button { font-family: inherit; }
fieldset { border-width: 0; }

/* ─── Premium Micro-interactions ─── */
a, button, [role="button"], input, select, textarea, [tabindex] {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease, transform 0.1s ease;
}
button:active { transform: scale(0.98); }
button:disabled { transform: none; }
