/* ==========================================================================
   VaultFlow AI — Core Design System & Design Tokens
   Theme: Sovereign Dark Glassmorphism (High-Precision Financial UI)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Curated Financial HSL */
  --bg-primary: #07090e;
  --bg-secondary: #0c1017;
  --bg-tertiary: #131924;
  --bg-card: rgba(16, 22, 34, 0.75);
  --bg-card-hover: rgba(22, 30, 48, 0.85);
  --bg-card-active: rgba(28, 40, 64, 0.9);
  
  /* Brand Accents */
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7928ca;
  --accent-violet: #8e2de2;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-crimson: #ff0055;
  
  /* Gradients */
  --grad-primary: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --grad-purple: linear-gradient(135deg, #8e2de2 0%, #4facfe 100%);
  --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-danger: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --grad-card: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
  --grad-glow: radial-gradient(circle at 50% 0%, rgba(79, 172, 254, 0.15) 0%, transparent 70%);

  /* Borders & Outlines */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(79, 172, 254, 0.35);
  --border-success: rgba(16, 185, 129, 0.4);
  --border-warning: rgba(245, 158, 11, 0.4);
  --border-danger: rgba(244, 63, 94, 0.4);

  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #07090e;

  /* Shadows & Glassmorphic Blur */
  --blur-glass: blur(16px);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(79, 172, 254, 0.25);
  --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.2);

  /* Layout & Spacing */
  --sidebar-width: 270px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Smoothing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(79, 172, 254, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(142, 45, 226, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.03) 0%, transparent 60%);
  background-attachment: fixed;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* App Shell Layout */
#app-root {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background: rgba(12, 16, 23, 0.85);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  padding: 24px 18px;
  gap: 24px;
  transition: transform var(--transition-normal);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: var(--bg-primary);
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .brand-tagline {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Persona Switcher Selector */
.persona-selector-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.persona-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.persona-select-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.persona-select-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.2);
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  flex-grow: 1;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
}

.nav-link.active {
  color: var(--text-main);
  background: rgba(79, 172, 254, 0.1);
  border-color: var(--border-highlight);
  font-weight: 600;
}

.nav-link .nav-icon {
  font-size: 1.15rem;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  color: var(--accent-cyan);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-badge.badge-ai {
  background: rgba(142, 45, 226, 0.2);
  color: #c084fc;
  border: 1px solid rgba(142, 45, 226, 0.35);
}

.nav-badge.badge-guard {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Sidebar Footer & Privacy Heartbeat */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.privacy-pill-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border-success);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

.privacy-pill-text {
  font-size: 0.72rem;
  color: #34d399;
  font-weight: 600;
  display: flex;
  flex-direction: column;
}

.privacy-subtext {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  width: calc(100% - var(--sidebar-width));
}

/* Top Navigation Bar */
.top-header {
  height: var(--header-height);
  background: rgba(7, 9, 14, 0.8);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-title-box h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-title-box p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Main View Container */
.view-container {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex-grow: 1;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.view-section.active {
  display: block;
}

/* Responsive Grid Utilities */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-split-7-5 {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 24px;
}

.grid-split-8-4 {
  display: grid;
  grid-template-columns: 8fr 4fr;
  gap: 24px;
}

@media (max-width: 1200px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-split-7-5, .grid-split-8-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }
  .grid-cols-4, .grid-cols-3, .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 0 16px;
  }
  .view-container {
    padding: 20px 16px;
  }
}

/* Print Optimization for CPA & Tax Recordkeeping */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-sidebar,
  .top-header,
  .header-actions,
  .btn,
  .dropzone-container,
  .persona-selector-card,
  .sidebar-footer,
  .modal-overlay {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .card-glass {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .card-title, .card-subtitle, strong {
    color: #000000 !important;
  }
  .data-table th {
    background: #f0f0f0 !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
  }
  .data-table td {
    color: #222222 !important;
    border-bottom: 1px solid #dddddd !important;
  }
  .view-section {
    display: block !important;
  }
  #view-overview, #view-invoices, #view-tabpfn, #view-voice, #view-privacy {
    display: none !important;
  }
  #view-tax {
    display: block !important;
  }
}
