/* ============================================================
   Awall surface stylesheet: core.css
   Split from styles.css (F1, issue #186) — NO rule changes.
   Owns: reset, base, app-layout, theme-toggle, :root aliases, dark-theme legacy overrides (shared chrome)
   Concatenating every surfaces/*.css in base.html <link> order
   reproduces the original styles.css byte-for-byte.
   ============================================================ */
/* =========================================================
   Awall — Design System
   Reference: quickium.com aesthetic
   Light mode only. Custom CSS, no frameworks.
   ========================================================= */

/* ---------------------------------------------------------
   1. Dashboard-specific tokens
   Shared tokens (colors, spacing, radius, shadows, motion,
   font stacks) live in `apps/core/static/core/css/tokens.css`
   and are loaded BEFORE this file in every template.
   --------------------------------------------------------- */
:root {
  /* Sidebar — shared tokens come from tokens.css; aliases here keep
     existing dashboard rules readable without redefining values. */
  --sidebar-bg:         var(--color-sidebar-bg);
  --sidebar-text:       var(--color-sidebar-text);
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg:  var(--color-sidebar-active-bg);
  --sidebar-active-text:var(--color-sidebar-active-text);
  --sidebar-width:           240px;
  --sidebar-width-collapsed: 64px;
  --sidebar-width-current:   var(--sidebar-width);

  /* Typography (font sizes — sans/mono stacks come from tokens.css) */
  --font-family: var(--font-sans);
  --font-size-xs:   12px;
  --font-size-sm:   14px;
  --font-size-base: 15px;
  --font-size-md:   16px;
  --font-size-lg:   19px;
  --font-size-xl:   23px;
  --font-size-2xl:  29px;
  --font-size-3xl:  38px;

  /* Layout */
  --content-max-width: 1140px;
  --header-height:     64px;
}

/* ---------------------------------------------------------
   1b. Dark theme overrides — token overrides live in
   tokens.css; the rules below cover dashboard-only legacy
   colors that don't fit a generic semantic token.
   --------------------------------------------------------- */

/* Token-bound overrides (inherit from tokens.css dark theme) */
[data-theme="dark"] .status-tag--monitor {
  background-color: var(--color-monitor-bg);
  color: var(--color-monitor-text);
}

[data-theme="dark"] .notice--info    { color: var(--color-info-strong); }
[data-theme="dark"] .notice--warning { color: var(--color-warning-strong); }

[data-theme="dark"] .alert-success  { color: var(--color-success-strong); }
[data-theme="dark"] .alert-warning  { color: var(--color-warning-strong); }

[data-theme="dark"] .message-success,
[data-theme="dark"] .message-messages-success { color: var(--color-success-strong); }
[data-theme="dark"] .message-warning,
[data-theme="dark"] .message-messages-warning { color: var(--color-warning-strong); }
[data-theme="dark"] .message-info,
[data-theme="dark"] .message-messages-info    { color: var(--color-info-strong); }

[data-theme="dark"] .form-input:hover { border-color: var(--color-border); }

[data-theme="dark"] .provider-icon--openai {
  background: #022c22; color: #4ade80; border-color: #065f46;
}
[data-theme="dark"] .provider-icon--anthropic {
  background: #1c1200; color: #fbbf24; border-color: #92400e;
}
[data-theme="dark"] .provider-icon--groq {
  background: #2a1b00; color: #fb923c; border-color: #c2410c;
}
[data-theme="dark"] .provider-icon--google {
  background: #2e1065; color: #c4b5fd; border-color: #6d28d9;
}
[data-theme="dark"] .provider-icon--custom {
  background: #1e3a5f; color: #93c5fd; border-color: #2d52bd;
}

/* ---------------------------------------------------------
   Theme toggle button
   --------------------------------------------------------- */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 200;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
  padding: 0;
}

.theme-toggle:hover {
  color: var(--color-text-heading);
  background: var(--color-surface);
  box-shadow: var(--shadow-modal);
}

.theme-toggle:focus-visible {
  outline: none;
  color: var(--color-text-heading);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card), 0 0 0 3px var(--color-primary-focus-ring);
}

.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }

[data-theme="dark"] .theme-icon-sun  { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* Visually hidden but exposed to assistive tech.
   Use for screen-reader equivalents of visual-only content
   (e.g. the data-table alongside the bar chart). */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link (F4 #189): off-screen until focused, then slides in
   at top-left so keyboard users can bypass the sidebar nav. */
.skip-to-main {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-btn);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-modal);
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--transition-fast);
}
.skip-to-main:focus {
  transform: translateY(0);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Global reduced-motion guard (F4 #189): honour prefers-reduced-motion across
   the whole app. Per-component guards become redundant under this. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------
   2. Reset & base
   --------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 400;
  color: var(--color-text-body);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

img,
svg {
  display: block;
}

ul, ol {
  list-style: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ---------------------------------------------------------
   3. App layout (sidebar + main)
   --------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

