/* ==========================================================================
   Amphora Design System — Global CSS Custom Properties
   ==========================================================================
   Platform-wide visual identity tokens. Extracted from amphora-theme.css.
   All components should reference these variables instead of hardcoding values.

   Sections:
     1. CSS Custom Properties (:root)
     2. Global / Base Styles
     3. Brand Text
     4. Audience Badge
     5. Focus States
     6. Reduced Motion
     7. Utility Classes
   ========================================================================== */


/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */

:root {
  /* Brand colors — Copper Aquamarine Dream */
  --amphora-primary: #C2642C;
  --amphora-primary-hover: #D6794D;
  --amphora-dark: #30525C;
  --amphora-accent: #4C848D;
  --amphora-accent-hover: #3a6e76;
  --amphora-success: #059669;
  --amphora-warning: #d97706;
  --amphora-error: #dc2626;

  /* Typography */
  --amphora-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --amphora-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
    'Source Code Pro', Menlo, Consolas, monospace;

  /* Layout */
  --sidebar-width: 420px;
  --header-height: 56px;
  --amphora-header-height: 56px;
  --amphora-tab-bar-height: 44px;
  --amphora-agent-status-height: 32px;

  /* Surfaces */
  --amphora-surface: #BFB9B5;
  --amphora-surface-alt: #f9fafb;
  --amphora-surface-white: #ffffff;
  --amphora-surface-raised: #e5e7eb;
  --amphora-border: #e5e7eb;
  --amphora-border-strong: #d1d5db;

  /* Text */
  --amphora-text: #111827;
  --amphora-text-secondary: #6b7280;
  --amphora-text-muted: #9ca3af;
  --amphora-text-placeholder: #9ca3af;
  --amphora-text-on-dark: #ffffff;

  /* Shadows */
  --amphora-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --amphora-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --amphora-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --amphora-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --amphora-transition: 150ms ease;
  --amphora-transition-slow: 250ms ease;

  /* Border radius */
  --amphora-radius-sm: 4px;
  --amphora-radius: 6px;
  --amphora-radius-lg: 8px;
  --amphora-radius-xl: 12px;
  --amphora-radius-full: 9999px;

  /* Code blocks */
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --code-border: #334155;

  /* Inline code */
  --code-inline-bg: #f3f4f6;
  --code-inline-text: #334155;
  --code-inline-border: #e2e8f0;

  /* Callout backgrounds */
  --callout-note-bg: #eff6ff;
  --callout-warning-bg: #fffbeb;
  --callout-error-bg: #fef2f2;
  --callout-success-bg: #ecfdf5;

  /* Badge variants */
  --amphora-badge-internal-bg: #fef3c7;
  --amphora-badge-internal-text: #92400e;

  /* Primary color alpha variants */
  --amphora-primary-subtle: rgba(194, 100, 44, 0.08);
  --amphora-primary-muted: rgba(194, 100, 44, 0.2);

  /* Table hover */
  --amphora-table-hover: #f3f4f6;

  /* Semantic backgrounds */
  --amphora-success-bg: #e8f7ee;
  --amphora-info-bg: #e1f0ff;
  --amphora-error-bg: #fef1f1;
  --amphora-error-bg-strong: #fdd;

  /* Blockquote */
  --amphora-blockquote-bg: #faf5ff;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* SLDS brand overrides — terracotta primary */
  --slds-c-button-brand-color-background: var(--amphora-primary);
  --slds-c-button-brand-color-border: var(--amphora-primary);
  --slds-c-button-brand-color-background-hover: var(--amphora-primary-hover);
  --slds-c-button-brand-color-border-hover: var(--amphora-primary-hover);
  --slds-g-color-brand-base-50: var(--amphora-primary);

  /* User menu dropdown */
  --amphora-menu-bg: var(--amphora-surface-white);
  --amphora-menu-border: var(--amphora-border);
  --amphora-menu-text: var(--amphora-text);
  --amphora-menu-name: var(--amphora-text);
  --amphora-menu-divider: var(--amphora-border);
  --amphora-menu-hover: var(--amphora-surface-alt);
  --amphora-menu-icon: var(--amphora-text-secondary);

  /* Chat-specific (backward compat) */
  --amphora-bg-chat-user: var(--amphora-surface-alt);
  --amphora-text-chat-user: var(--amphora-text);
  --amphora-bg-chat-agent: var(--amphora-surface-alt);
}


/* ==========================================================================
   Dark Theme — Neutral palette with brand accents preserved
   ========================================================================== */

[data-theme="dark"] {
  /* Brand colors — terracotta as accent on dark */
  --amphora-primary: #C2642C;
  --amphora-primary-hover: #D6794D;
  --amphora-dark: #30525C;
  --amphora-accent: #C2642C;
  --amphora-accent-hover: #D6794D;

  /* Surfaces — neutral dark grey, no blue tint */
  --amphora-surface: #1e1e1e;
  --amphora-surface-alt: #2a2a2a;
  --amphora-surface-white: #2a2a2a;
  --amphora-surface-raised: #161616;
  --amphora-border: #3e3e3c;
  --amphora-border-strong: #4e4e4e;

  /* Text — all white, terracotta for accent text */
  --amphora-text: #ffffff;
  --amphora-text-secondary: #ffffff;
  --amphora-text-muted: rgba(255, 255, 255, 0.6);
  --amphora-text-placeholder: rgba(255, 255, 255, 0.4);
  --amphora-text-on-dark: #ffffff;

  /* Deploy page — teal cards on dark background */
  --amphora-deploy-bg: #1e1e1e;
  --amphora-deploy-card-bg: #30525C;
  --amphora-deploy-card-border: rgba(255, 255, 255, 0.15);
  --amphora-deploy-card-text: #ffffff;
  --amphora-deploy-card-header-bg: #30525C;
  --amphora-deploy-card-icon: #C2642C;
  --amphora-deploy-tabs-bg: #1e1e1e;
  --amphora-deploy-tabs-border: rgba(255, 255, 255, 0.15);
  --amphora-deploy-tab-text: rgba(255, 255, 255, 0.6);
  --amphora-deploy-tab-hover: #ffffff;
  --amphora-deploy-tab-active: #C2642C;
  --amphora-deploy-history-hover: rgba(255, 255, 255, 0.08);
  --amphora-deploy-history-selected: rgba(194, 100, 44, 0.15);
  --amphora-deploy-subtle-bg: rgba(255, 255, 255, 0.06);
  --amphora-deploy-subtle-border: rgba(255, 255, 255, 0.1);
  --amphora-deploy-ring-track: rgba(255, 255, 255, 0.12);
  --amphora-deploy-badge-validation-bg: rgba(27, 82, 151, 0.25);
  --amphora-deploy-badge-validation: #7fb3ff;
  --amphora-deploy-badge-deploy-bg: rgba(46, 125, 50, 0.25);
  --amphora-deploy-badge-deploy: #81c784;
  --amphora-deploy-badge-test-bg: rgba(230, 81, 0, 0.25);
  --amphora-deploy-badge-test: #ffb74d;
  --amphora-deploy-error-bg: rgba(194, 57, 52, 0.15);
  --amphora-deploy-error-border: rgba(194, 57, 52, 0.4);
  --amphora-deploy-error-text: #f5a0a0;
  --amphora-deploy-fail-header-bg: rgba(194, 57, 52, 0.15);
  --amphora-deploy-fail-border: rgba(194, 57, 52, 0.3);
  --amphora-deploy-fail-count-bg: rgba(194, 57, 52, 0.2);
  --amphora-deploy-method-msg-bg: rgba(194, 57, 52, 0.15);
  --amphora-deploy-method-msg: #f5a0a0;

  /* Monitor page */
  --amphora-monitor-tabs-bg: #1e1e1e;
  --amphora-monitor-tabs-border: rgba(255, 255, 255, 0.15);
  --amphora-monitor-tab-text: rgba(255, 255, 255, 0.6);
  --amphora-monitor-tab-hover: #ffffff;
  --amphora-monitor-tab-active: #C2642C;
  --amphora-monitor-content-bg: #1e1e1e;

  /* Shadows — stronger for dark backgrounds */
  --amphora-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --amphora-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --amphora-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
  --amphora-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.2);

  /* Code blocks */
  --code-bg: #0d1117;
  --code-text: #ffffff;
  --code-border: #30363d;

  /* Inline code */
  --code-inline-bg: #2d333b;
  --code-inline-text: #ffffff;
  --code-inline-border: #444c56;

  /* Callout backgrounds */
  --callout-note-bg: #1a2332;
  --callout-warning-bg: #2a2010;
  --callout-error-bg: #2a1515;
  --callout-success-bg: #152a1a;

  /* Badge variants */
  --amphora-badge-internal-bg: #3a2e10;
  --amphora-badge-internal-text: #fcd34d;

  /* Primary alpha variants */
  --amphora-primary-subtle: rgba(214, 121, 77, 0.1);
  --amphora-primary-muted: rgba(214, 121, 77, 0.25);

  /* Table hover */
  --amphora-table-hover: rgba(255, 255, 255, 0.05);

  /* Semantic backgrounds */
  --amphora-success-bg: #1a2e1a;
  --amphora-info-bg: #1a2030;
  --amphora-error-bg: #2e1a1a;
  --amphora-error-bg-strong: #3d2020;

  /* Blockquote */
  --amphora-blockquote-bg: rgba(194, 100, 44, 0.1);

  /* SLDS component hooks — dark mode overrides */
  --slds-c-card-color-background: #2a2a2a;
  --slds-c-card-color-border: var(--amphora-primary);
  --slds-c-card-color-background-header: #1e1e1e;
  --slds-c-input-color-border: #5a5a6e;
  --slds-c-input-color-border-focus: var(--amphora-primary);
  --slds-c-input-shadow-color-focus: var(--amphora-primary);
  --slds-c-input-color-background-disabled: #333;

  /* User menu dropdown — terracotta on dark teal */
  --amphora-menu-bg: #30525C;
  --amphora-menu-border: rgba(255, 255, 255, 0.15);
  --amphora-menu-text: #D6794D;
  --amphora-menu-name: #C2642C;
  --amphora-menu-divider: rgba(255, 255, 255, 0.15);
  --amphora-menu-hover: rgba(255, 255, 255, 0.1);
  --amphora-menu-icon: #D6794D;

  /* Chat — teal user bubbles with terracotta text, dark grey agent bubbles */
  --amphora-bg-chat-user: #30525C;
  --amphora-text-chat-user: #D6794D;
  --amphora-bg-chat-agent: #2d2d2d;

  /* Scrollbar — lighter for dark backgrounds */
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.35);
}


/* ==========================================================================
   2. Global / Base Styles
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--amphora-font);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--amphora-text);
  background-color: var(--amphora-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

#main {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.35);
}


/* ==========================================================================
   3. Brand Text
   ========================================================================== */

.brand {
  font-weight: 600;
}

h1 .brand,
h2 .brand,
h3 .brand {
  font-weight: 800;
}


/* ==========================================================================
   3b. Header Subtitle — reusable for section labels next to the logo
   ========================================================================== */

.header-subtitle {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #cccccc;
  margin-left: 10px;
}


/* ==========================================================================
   4. Audience Badge
   ========================================================================== */

.audience-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--amphora-radius-full);
  background-color: var(--amphora-surface-alt);
  color: var(--amphora-text-secondary);
  line-height: 1.4;
}

.audience-badge--internal {
  background-color: var(--amphora-badge-internal-bg);
  color: var(--amphora-badge-internal-text);
}


/* ==========================================================================
   5. Focus States (keyboard navigation)
   ========================================================================== */

a:focus-visible {
  outline: 2px solid var(--amphora-primary);
  outline-offset: 2px;
}


/* ==========================================================================
   6. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ==========================================================================
   7. Utility Classes
   ========================================================================== */

.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;
}

.amphora-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amphora-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.amphora-panel {
  background: var(--amphora-surface);
  border: 1px solid var(--amphora-border);
  border-radius: var(--amphora-radius);
  overflow: hidden;
}
