/**
 * Appraisal Agent Design System v3.0 — Stitch Dark Navy
 *
 * Unified design tokens and component library for all frontend pages.
 * Consolidates custom CSS (main workspace) with Tailwind utilities into
 * a cohesive, production-ready design system.
 *
 * Colors (Stitch Theme):
 * - Primary: Blue (#2563EB) — main brand color, primary buttons
 * - Secondary: Cyan (#06B6D4) — CTAs, highlights, accent buttons
 * - Background: Deep Navy (#080E1E)
 * - Surfaces: Charcoal (#111827, #1C2537)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
  /* Primary Colors */
  --color-primary: #2563EB;
  --color-primary-soft: rgba(37, 99, 235, 0.14);
  --color-primary-hover: #1D4ED8;
  --color-primary-dim: #1E3A8A;

  /* Accent Colors */
  --color-accent: #06B6D4;
  --color-accent-soft: rgba(6, 182, 212, 0.14);
  --color-accent-hover: #0891B2;

  /* Backgrounds & Elevation */
  --color-bg: #080E1E;
  --color-bg-elevated-1: #111827;
  --color-bg-elevated-2: #1C2537;
  --color-bg-elevated-3: #243049;
  --color-bg-muted: #0a0e18;

  /* Text Colors */
  --color-text-primary: #F9FAFB;
  --color-text-secondary: #9CA3AF;
  --color-text-muted: #6B7280;
  --color-text-inverse: #080E1E;

  /* Semantic Colors */
  --color-success: #10B981;
  --color-success-soft: rgba(16, 185, 129, 0.14);
  --color-danger: #EF4444;
  --color-danger-soft: rgba(239, 68, 68, 0.14);
  --color-warning: #F59E0B;
  --color-warning-soft: rgba(245, 158, 11, 0.14);
  --color-info: #3B82F6;
  --color-info-soft: rgba(59, 130, 246, 0.14);

  /* Borders */
  --color-border-subtle: rgba(255, 255, 255, 0.08);
  --color-border-medium: rgba(255, 255, 255, 0.12);
  --color-border-strong: rgba(6, 182, 212, 0.35);
  --color-line: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.24);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.35);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 92px;
  --header-height: 60px;

  /* Simple Variable Aliases (for styles.css compatibility) */
  --bg: #080E1E;
  --bg-elevated: #111827;
  --bg-soft: #1C2537;
  --bg-muted: #0a0e18;
  --text: #F9FAFB;
  --muted: #9CA3AF;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --accent: #2563EB;
  --accent-soft: rgba(37, 99, 235, 0.14);
  --accent-highlight: #06B6D4;
  --accent-highlight-soft: rgba(6, 182, 212, 0.14);
  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --info: #3B82F6;
  --info-soft: rgba(59, 130, 246, 0.14);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* RESET & GLOBAL STYLES                                                      */
/* ─────────────────────────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg);
}

input,
textarea,
select {
  font: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-elevated-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12);
}

button {
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* COMPONENTS: BUTTONS                                                        */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.rb-btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.rb-btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.rb-btn-accent {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.rb-btn-accent:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
}

.rb-btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  border-color: var(--color-border-medium);
}

.rb-btn-ghost:hover {
  background: var(--color-bg-elevated-1);
  border-color: var(--color-border-strong);
}

.rb-btn-secondary {
  background: var(--color-bg-elevated-1);
  color: var(--color-text-primary);
  border-color: var(--color-border-subtle);
}

.rb-btn-secondary:hover {
  background: var(--color-bg-elevated-2);
}

.rb-btn-danger {
  background: var(--color-danger);
  color: white;
}

.rb-btn-danger:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-md);
}

.rb-btn-full {
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* COMPONENTS: FORM INPUTS                                                    */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-input,
.rb-textarea,
.rb-select {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  background: var(--color-bg-elevated-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
}

.rb-input:focus,
.rb-textarea:focus,
.rb-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12);
}

.rb-textarea {
  resize: vertical;
  min-height: 100px;
}

.rb-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rb-field {
  margin-bottom: 16px;
}

.rb-field:last-child {
  margin-bottom: 0;
}

.rb-hint {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* COMPONENTS: CARDS                                                          */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-card {
  background: var(--color-bg-elevated-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.rb-card:hover {
  border-color: var(--color-border-medium);
  box-shadow: var(--shadow-md);
}

.rb-card-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.rb-card-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.rb-card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* LAYOUT: CENTERED PAGE (Login/Signup)                                       */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-page-centered {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.rb-auth-card {
  width: 100%;
  max-width: 440px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* COMPONENTS: SIDEBAR & LAYOUT                                               */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.rb-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--color-border-subtle);
  background: rgba(8, 14, 30, 0.96);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  z-index: 40;
}

.rb-brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-extrabold);
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  flex-shrink: 0;
}

.rb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rb-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
  cursor: pointer;
  border-left: 2px solid transparent;
}

.rb-nav-item:hover {
  color: var(--color-text-primary);
  background: rgba(6, 182, 212, 0.08);
}

.rb-nav-item.active {
  color: var(--color-accent);
  background: rgba(6, 182, 212, 0.14);
  border-left-color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* COMPONENTS: HEADER                                                         */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: rgba(8, 14, 30, 0.98);
  backdrop-filter: blur(8px);
}

.rb-header-nav a {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
}

.rb-header-nav a:hover,
.rb-header-nav a.active {
  color: var(--color-text-primary);
}

.rb-icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rb-icon-button:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated-1);
}

.rb-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* MATERIAL SYMBOLS                                                           */
/* ─────────────────────────────────────────────────────────────────────────── */

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* GRADIENT UTILITIES                                                         */
/* ─────────────────────────────────────────────────────────────────────────── */

.aa-gradient {
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* UTILITY CLASSES                                                            */
/* ─────────────────────────────────────────────────────────────────────────── */

.rb-flex {
  display: flex;
}

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

.rb-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rb-gap-sm {
  gap: 8px;
}

.rb-gap-md {
  gap: 16px;
}

.rb-gap-lg {
  gap: 24px;
}

.rb-p-md {
  padding: 16px;
}

.rb-p-lg {
  padding: 24px;
}

.rb-mb-sm {
  margin-bottom: 8px;
}

.rb-mb-md {
  margin-bottom: 16px;
}

.rb-mb-lg {
  margin-bottom: 24px;
}

.rb-text-center {
  text-align: center;
}

.rb-text-right {
  text-align: right;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-bg-elevated-2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-bg-elevated-3);
}

/* Selection */
::selection {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
