/**
 * AtomicTask Flow - Design System
 * Version: 1.0.0
 * Last Updated: 2026-03-20
 * 
 * This file contains all design tokens and component styles for the AtomicTask Flow application.
 * Import this file in all HTML pages to ensure consistent design across the entire application.
 * 
 * Usage:
 *   <link rel="stylesheet" href="design-system.css">
 * 
 * Table of Contents:
 *   1. Design Tokens (Colors, Typography, Spacing, Effects)
 *   2. Base Styles & Resets
 *   3. Layout Components (Container, Grid, Flex)
 *   4. Glass Morphism System
 *   5. Button Components
 *   6. Form Components
 *   7. Card Components
 *   8. Navigation Components
 *   9. Status Badges & Pills
 *   10. Feedback Components (Alerts, Toasts)
 *   11. Animation & Transitions
 *   12. Utility Classes
 *   13. Page-Specific Overrides
 */

/* ==========================================================================
   1. DESIGN TOKENS - CSS Custom Properties
   ========================================================================== */

:root {
  /* --------------------------------------------------------------------------
     1.1 BRAND COLORS
     Primary brand color: Blue (#3B82F6)
     Use --color-primary-* for main actions, headers, and key UI elements
     -------------------------------------------------------------------------- */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;  /* Main brand color */
  --color-primary-600: #2563eb;  /* Hover state */
  --color-primary-700: #1d4ed8;  /* Active state */
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Secondary: Purple - for accents, highlights */
  --color-secondary-500: #8b5cf6;
  --color-secondary-600: #7c3aed;

  /* Semantic Colors */
  --color-success-500: #22c55e;   /* Completed, paid, approved */
  --color-success-600: #16a34a;
  --color-warning-500: #f97316;   /* Pending, attention needed */
  --color-warning-600: #ea580c;
  --color-danger-500: #ef4444;    /* Errors, overdue, declined */
  --color-danger-600: #dc2626;
  --color-info-500: #06b6d4;      /* Informational */

  /* --------------------------------------------------------------------------
     1.2 NEUTRAL COLORS (Light Mode)
     -------------------------------------------------------------------------- */
  --color-white: #ffffff;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  --color-black: #000000;

  /* --------------------------------------------------------------------------
     1.3 BACKGROUND COLORS (Light Mode)
     -------------------------------------------------------------------------- */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);

  /* --------------------------------------------------------------------------
     1.4 TEXT COLORS (Light Mode)
     -------------------------------------------------------------------------- */
  --text-primary: rgba(0, 0, 0, 0.87);
  --text-secondary: rgba(0, 0, 0, 0.60);
  --text-tertiary: rgba(0, 0, 0, 0.38);
  --text-disabled: rgba(0, 0, 0, 0.26);
  --text-inverse: #ffffff;

  /* --------------------------------------------------------------------------
     1.5 BORDER COLORS (Light Mode)
     -------------------------------------------------------------------------- */
  --border-light: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.20);

  /* --------------------------------------------------------------------------
     1.6 GLASS MORPHISM (Light Mode)
     Used for: Cards, modals, overlays on colorful backgrounds
     -------------------------------------------------------------------------- */
  --glass-bg: rgba(255, 255, 255, 0.70);
  --glass-bg-elevated: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-border-strong: rgba(255, 255, 255, 0.40);
  --glass-shadow: rgba(0, 0, 0, 0.08);
  --glass-shadow-elevated: rgba(0, 0, 0, 0.15);
  --glass-blur-light: 10px;
  --glass-blur-medium: 20px;
  --glass-blur-strong: 40px;
  
  /* Legacy aliases for backward compatibility with existing index-SVG.js */
  --blur-strength: var(--glass-blur-strong);
  --blur-medium: var(--glass-blur-medium);
  --blur-light: var(--glass-blur-light);

  /* --------------------------------------------------------------------------
     1.7 TYPOGRAPHY
     Font stack optimized for system fonts
     -------------------------------------------------------------------------- */
  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;      /* 12px - Captions, badges */
  --text-sm: 0.875rem;     /* 14px - Secondary text */
  --text-base: 1rem;       /* 16px - Body text */
  --text-lg: 1.125rem;     /* 18px - Lead text */
  --text-xl: 1.25rem;      /* 20px - H4 */
  --text-2xl: 1.5rem;      /* 24px - H3 */
  --text-3xl: 1.875rem;    /* 30px - H2 */
  --text-4xl: 2.25rem;     /* 36px - H1 */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* --------------------------------------------------------------------------
     1.8 SPACING SCALE
     Based on 4px grid system
     -------------------------------------------------------------------------- */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* --------------------------------------------------------------------------
     1.9 BORDER RADIUS
     -------------------------------------------------------------------------- */
  --radius-none: 0;
  --radius-sm: 0.375rem;   /* 6px - Small buttons, tags */
  --radius-md: 0.5rem;     /* 8px - Inputs, small cards */
  --radius-lg: 0.75rem;    /* 12px - Buttons, cards */
  --radius-xl: 1rem;       /* 16px - Large cards, modals */
  --radius-2xl: 1.25rem;   /* 20px - Extra large cards */
  --radius-3xl: 1.5rem;    /* 24px - Containers */
  --radius-full: 9999px;   /* Pills, avatars */

  /* --------------------------------------------------------------------------
     1.10 SHADOWS
     -------------------------------------------------------------------------- */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  
  /* Colored shadows for buttons */
  --shadow-primary: 0 4px 12px rgba(59, 130, 246, 0.3);
  --shadow-primary-hover: 0 6px 20px rgba(59, 130, 246, 0.4);
  --shadow-success: 0 4px 12px rgba(34, 197, 94, 0.3);
  --shadow-danger: 0 4px 12px rgba(239, 68, 68, 0.3);

  /* --------------------------------------------------------------------------
     1.11 TRANSITIONS & ANIMATION
     -------------------------------------------------------------------------- */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --------------------------------------------------------------------------
     1.12 Z-INDEX SCALE
     -------------------------------------------------------------------------- */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;

  /* --------------------------------------------------------------------------
     1.13 CONTAINER SIZES
     -------------------------------------------------------------------------- */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-max: 1440px;
}

/* ==========================================================================
   DARK MODE OVERRIDES
   Applied when .dark class is on <html> or data-theme="dark"
   ========================================================================== */
.dark,
[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #262626;
  --bg-elevated: #171717;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  /* Text Colors */
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-tertiary: rgba(255, 255, 255, 0.40);
  --text-disabled: rgba(255, 255, 255, 0.25);
  --text-inverse: #000000;

  /* Border Colors */
  --border-light: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);

  /* Glass Morphism (Dark) */
  --glass-bg: rgba(30, 30, 30, 0.70);
  --glass-bg-elevated: rgba(40, 40, 40, 0.85);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-strong: rgba(255, 255, 255, 0.20);
  --glass-shadow: rgba(0, 0, 0, 0.30);
  --glass-shadow-elevated: rgba(0, 0, 0, 0.50);
  
  /* Legacy aliases for backward compatibility */
  --blur-strength: var(--glass-blur-strong);
  --blur-medium: var(--glass-blur-medium);
  --blur-light: var(--glass-blur-light);

  /* Adjusted Primary for Dark */
  --color-primary-500: #60a5fa;  /* Lighter blue for dark bg */
  --color-primary-600: #3b82f6;
}

/* ==========================================================================
   2. BASE STYLES & RESETS
   ========================================================================== */

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

html {
  font-family: var(--font-family-base);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

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

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
}

.dark ::selection {
  background-color: var(--color-primary-700);
  color: var(--color-white);
}

/* ==========================================================================
   3. LAYOUT COMPONENTS
   ========================================================================== */

/* Container - Centers content with max-width */
.at-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .at-container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .at-container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* Container sizes */
.at-container--sm { max-width: var(--container-sm); }
.at-container--md { max-width: var(--container-md); }
.at-container--lg { max-width: var(--container-lg); }
.at-container--xl { max-width: var(--container-xl); }

/* Page wrapper - Full height flex column */
.at-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.at-page__content {
  flex: 1;
}

/* ==========================================================================
   4. GLASS MORPHISM SYSTEM
   Core glass effect used across the app
   ========================================================================== */

/* Base glass effect */
.at-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-medium));
  -webkit-backdrop-filter: blur(var(--glass-blur-medium));
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px var(--glass-shadow);
}

/* Light blur variant */
.at-glass--light {
  backdrop-filter: blur(var(--glass-blur-light));
  -webkit-backdrop-filter: blur(var(--glass-blur-light));
}

/* Strong blur variant */
.at-glass--strong {
  backdrop-filter: blur(var(--glass-blur-strong));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong));
}

/* Elevated glass (for modals, popovers) */
.at-glass--elevated {
  background: var(--glass-bg-elevated);
  border-color: var(--glass-border-strong);
  box-shadow: 0 20px 60px var(--glass-shadow-elevated);
}

/* Glass radius variants */
.at-glass--sm { border-radius: var(--radius-md); }
.at-glass--md { border-radius: var(--radius-lg); }
.at-glass--lg { border-radius: var(--radius-xl); }
.at-glass--xl { border-radius: var(--radius-2xl); }
.at-glass--2xl { border-radius: var(--radius-3xl); }

/* Legacy glass-card class (used in React app index-SVG.js) */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-strength)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-strength)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.glass-card:hover {
  transform: translateY(-2px);
  border-color: var(--glass-border-strong);
  box-shadow: 0 12px 40px var(--glass-shadow-elevated);
}

/* ==========================================================================
   5. BUTTON COMPONENTS
   Primary, Secondary, Ghost, and Icon button variants
   ========================================================================== */

/* Base button styles */
.at-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.at-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.at-btn:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* Primary Button (Blue gradient) */
.at-btn--primary {
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-secondary-500) 100%);
  color: var(--color-white);
  box-shadow: var(--shadow-primary);
}

.at-btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary-hover);
}

.at-btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Button (Outlined) */
.at-btn--secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-light));
  -webkit-backdrop-filter: blur(var(--glass-blur-light));
  border: 1px solid var(--glass-border-strong);
  color: var(--text-primary);
}

.at-btn--secondary:hover:not(:disabled) {
  background: var(--glass-bg-elevated);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Ghost Button (Text only) */
.at-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.at-btn--ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Success Button (Green) */
.at-btn--success {
  background: linear-gradient(135deg, var(--color-success-500) 0%, var(--color-success-600) 100%);
  color: var(--color-white);
  box-shadow: var(--shadow-success);
}

.at-btn--success:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* Danger Button (Red) */
.at-btn--danger {
  background: var(--color-danger-500);
  color: var(--color-white);
  box-shadow: var(--shadow-danger);
}

.at-btn--danger:hover:not(:disabled) {
  background: var(--color-danger-600);
  transform: translateY(-2px);
}

/* Button Sizes */
.at-btn--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}

.at-btn--lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.at-btn--xl {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-xl);
  border-radius: var(--radius-xl);
}

/* Full width button */
.at-btn--block {
  width: 100%;
}

/* Icon-only button */
.at-btn--icon {
  padding: var(--space-2);
  border-radius: var(--radius-lg);
}

.at-btn--icon.at-btn--sm {
  padding: var(--space-1);
}

/* Social Login Buttons */
.at-btn--social {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-light));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

.at-btn--social:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.at-btn--social .at-icon {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   6. FORM COMPONENTS
   Inputs, labels, form groups, and validation states
   ========================================================================== */

/* Form group wrapper */
.at-form-group {
  margin-bottom: var(--space-5);
}

.at-form-group--compact {
  margin-bottom: var(--space-4);
}

/* Form label */
.at-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.at-label--inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.at-label__hint {
  font-weight: var(--font-normal);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Text input */
.at-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-light));
  -webkit-backdrop-filter: blur(var(--glass-blur-light));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.at-input::placeholder {
  color: var(--text-tertiary);
}

.at-input:hover {
  border-color: var(--border-medium);
}

.at-input:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 4px var(--color-primary-100);
}

.dark .at-input:focus {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Input sizes */
.at-input--sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.at-input--lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
}

/* Textarea */
.at-textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

/* Input with icon */
.at-input-wrap {
  position: relative;
}

.at-input-wrap .at-input {
  padding-left: var(--space-10);
}

.at-input-wrap__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Validation states */
.at-input--error {
  border-color: var(--color-danger-500);
}

.at-input--error:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.at-input--success {
  border-color: var(--color-success-500);
}

.at-input--success:focus {
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

/* Checkbox and Radio */
.at-checkbox,
.at-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.at-checkbox input,
.at-radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary-500);
  cursor: pointer;
}

/* ==========================================================================
   7. CARD COMPONENTS
   Content containers with consistent styling
   ========================================================================== */

/* Base card */
.at-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-medium));
  -webkit-backdrop-filter: blur(var(--glass-blur-medium));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Card variants */
.at-card--flat {
  background: var(--bg-secondary);
  backdrop-filter: none;
  box-shadow: none;
}

.at-card--elevated {
  background: var(--glass-bg-elevated);
  box-shadow: var(--shadow-xl);
}

.at-card--bordered {
  border: 1px solid var(--border-medium);
}

/* Card sizes */
.at-card--sm { border-radius: var(--radius-lg); }
.at-card--md { border-radius: var(--radius-xl); }
.at-card--lg { border-radius: var(--radius-2xl); }

/* Card sections */
.at-card__header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.at-card__body {
  padding: var(--space-6);
}

.at-card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

/* Card title */
.at-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.at-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ==========================================================================
   8. NAVIGATION COMPONENTS
   Top nav, sidebar, tabs
   ========================================================================== */

/* Top Navigation */
.at-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-medium));
  -webkit-backdrop-filter: blur(var(--glass-blur-medium));
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-3) var(--space-4);
}

@media (min-width: 768px) {
  .at-nav {
    padding: var(--space-4) var(--space-6);
  }
}

.at-nav__container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: var(--container-max);
  margin: 0 auto;
}

/* Logo/Brand section */
.at-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.at-brand__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-secondary-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-size: var(--text-xl);
  box-shadow: var(--shadow-primary);
}

.at-brand__icon--lg {
  width: 60px;
  height: 60px;
  font-size: var(--text-3xl);
  border-radius: var(--radius-xl);
}

.at-brand__text {
  display: flex;
  flex-direction: column;
}

.at-brand__name {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.at-brand__tagline {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Tab Navigation */
.at-tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-light));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.at-tab {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.at-tab:hover {
  color: var(--text-primary);
  background: var(--glass-bg-elevated);
}

.at-tab--active {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-secondary-500));
  color: var(--color-white);
  box-shadow: var(--shadow-primary);
}

/* ==========================================================================
   9. STATUS BADGES & PILLS
   For indicating status, labels, categories
   ========================================================================== */

/* Base badge */
.at-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Badge variants by status */
.at-badge--success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.at-badge--warning {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: #fb923c;
}

.at-badge--danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.at-badge--info {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.at-badge--neutral {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

/* Secure/Trusted badge */
.at-badge--secure {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  margin-left: auto;
}

/* Status dot */
.at-status-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.at-status-dot--done { background: var(--color-success-500); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
.at-status-dot--inprogress { background: var(--color-primary-500); }
.at-status-dot--pending { background: var(--text-tertiary); }

/* ==========================================================================
   10. FEEDBACK COMPONENTS
   Alerts, toasts, error/success messages
   ========================================================================== */

/* Alert/Message Box */
.at-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  backdrop-filter: blur(var(--glass-blur-light));
  -webkit-backdrop-filter: blur(var(--glass-blur-light));
}

.at-alert__icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.at-alert--error {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.at-alert--success {
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
}

.at-alert--warning {
  background: rgba(249, 115, 22, 0.10);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: #fb923c;
}

.at-alert--info {
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

/* Toast Notification */
.at-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  backdrop-filter: blur(var(--glass-blur-medium));
  -webkit-backdrop-filter: blur(var(--glass-blur-medium));
  z-index: var(--z-toast);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  white-space: nowrap;
}

.at-toast--show {
  opacity: 1;
}

.at-toast--success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.at-toast--error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

/* Info Box (for tips, notes) */
.at-info-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-light));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.at-info-box__icon {
  color: var(--color-primary-500);
  margin-top: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   11. ANIMATION & TRANSITIONS
   Reusable animation keyframes
   ========================================================================== */

/* Fade In */
@keyframes at-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide Up */
@keyframes at-slide-up {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In (for modals) */
@keyframes at-scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Spinner */
@keyframes at-spin {
  to { transform: rotate(360deg); }
}

/* Pulse */
@keyframes at-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Float (for background orbs) */
@keyframes at-float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -50px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Shimmer (loading state) */
@keyframes at-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Animation utility classes */
.at-animate-fade { animation: at-fade-in var(--transition-base) forwards; }
.at-animate-slide-up { animation: at-slide-up var(--transition-slow) forwards; }
.at-animate-scale { animation: at-scale-in var(--transition-base) forwards; }
.at-animate-pulse { animation: at-pulse 2s ease-in-out infinite; }
.at-animate-float { animation: at-float 20s infinite ease-in-out; }

/* Spinner element */
.at-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--color-primary-500);
  border-radius: var(--radius-full);
  animation: at-spin 0.8s linear infinite;
}

/* ==========================================================================
   12. UTILITY CLASSES
   Quick helper classes for common patterns
   ========================================================================== */

/* Text utilities */
.at-text-center { text-align: center; }
.at-text-left { text-align: left; }
.at-text-right { text-align: right; }

.at-text-primary { color: var(--text-primary); }
.at-text-secondary { color: var(--text-secondary); }
.at-text-tertiary { color: var(--text-tertiary); }

.at-text-brand { color: var(--color-primary-500); }
.at-text-success { color: var(--color-success-500); }
.at-text-warning { color: var(--color-warning-500); }
.at-text-danger { color: var(--color-danger-500); }

/* Spacing utilities */
.at-m-0 { margin: 0; }
.at-mb-0 { margin-bottom: 0; }
.at-mb-2 { margin-bottom: var(--space-2); }
.at-mb-4 { margin-bottom: var(--space-4); }
.at-mb-6 { margin-bottom: var(--space-6); }

.at-mt-4 { margin-top: var(--space-4); }
.at-mt-6 { margin-top: var(--space-6); }

/* Display utilities */
.at-hidden { display: none; }
.at-block { display: block; }
.at-flex { display: flex; }
.at-grid { display: grid; }

.at-items-center { align-items: center; }
.at-justify-center { justify-content: center; }
.at-justify-between { justify-content: space-between; }

/* Size utilities */
.at-w-full { width: 100%; }
.at-h-full { height: 100%; }
.at-min-h-screen { min-height: 100vh; }

/* Divider */
.at-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.at-divider::before,
.at-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* Visually hidden (for accessibility) */
.at-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;
}

/* ==========================================================================
   13. PAGE-SPECIFIC PATTERNS
   Common layouts for specific page types
   ========================================================================== */

/* Auth Page Layout (login, signup, forgot password) */
.at-page--auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, #e0f2fe 0%, #ddd6fe 50%, #fce7f3 100%);
  background-attachment: fixed;
  position: relative;
  overflow: hidden;
}

.dark .at-page--auth {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
}

/* Background orbs for auth pages */
.at-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.at-orb {
  position: absolute;
  border-radius: var(--radius-full);
  filter: blur(80px);
  opacity: 0.3;
  animation: at-float 20s infinite ease-in-out;
}

.at-orb--1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(45deg, var(--color-primary-500), var(--color-primary-700));
  top: -10%;
  left: -10%;
}

.at-orb--2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(45deg, var(--color-secondary-500), var(--color-secondary-600));
  bottom: -10%;
  right: -10%;
  animation-delay: 7s;
}

.at-orb--3 {
  width: 350px;
  height: 350px;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.35), rgba(200, 210, 255, 0.25));
  top: 50%;
  left: 50%;
  animation-delay: 14s;
}

.dark .at-orb--3 {
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(200, 210, 255, 0.05));
}

/* Auth card (centered container) */
.at-auth-card {
  width: 100%;
  max-width: 450px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-strong));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-3xl);
  box-shadow: 0 8px 32px var(--glass-shadow);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* Portal Page Layout */
.at-page--portal {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(34, 197, 94, 0.10) 0%, transparent 65%),
    radial-gradient(ellipse 50% 60% at 85% 100%, rgba(99, 102, 241, 0.09) 0%, transparent 65%),
    var(--bg-primary);
}

/* Portal nav - sticky with blur */
.at-nav--portal {
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(var(--glass-blur-medium));
  border-bottom: 1px solid var(--border-light);
}

/* Progress bar (used in portal) */
.at-progress {
  background: var(--border-light);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
}

.at-progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-success-500), #4ade80);
  transition: width 0.6s ease;
}

/* List items (tasks, invoices, estimates) */
.at-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}

.at-list-item:last-child {
  border-bottom: none;
}

/* Stats grid */
.at-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.at-stat {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.at-stat__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.at-stat__value {
  font-size: var(--text-2xl);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
}

.at-stat__label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* Modal/Overlay */
.at-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.at-modal-overlay--show {
  opacity: 1;
}

.at-modal {
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(var(--glass-blur-strong));
  -webkit-backdrop-filter: blur(var(--glass-blur-strong));
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px var(--glass-shadow-elevated);
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

.at-modal-overlay--show .at-modal {
  transform: scale(1);
}

/* Loading Screen */
.at-loading-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a1a 50%, #000000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.at-loading-screen__logo {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-secondary-500));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: at-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
}

.at-loading-screen__title {
  color: var(--color-white);
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.at-loading-screen__subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
}

/* ==========================================================================
   RESPONSIVE UTILITIES
   Mobile-specific adjustments
   ========================================================================== */

@media (max-width: 768px) {
  /* Reduce glass blur on mobile for performance */
  .at-glass,
  .at-card,
  .at-input {
    backdrop-filter: blur(var(--glass-blur-light));
    -webkit-backdrop-filter: blur(var(--glass-blur-light));
  }
  
  /* Smaller padding on mobile */
  .at-card__body {
    padding: var(--space-4);
  }
  
  .at-card__header,
  .at-card__footer {
    padding: var(--space-4);
  }
  
  /* Stack social buttons on mobile */
  .at-btn--social {
    width: 100%;
  }
  
  /* Hide decorative orbs on mobile */
  .at-orb {
    opacity: 0.2;
  }
  
  /* Smaller brand icon on mobile */
  .at-brand__icon--lg {
    width: 50px;
    height: 50px;
    font-size: var(--text-xl);
  }
}

@media (max-width: 480px) {
  /* Further reduce padding on small screens */
  .at-page--auth {
    padding: var(--space-2);
  }
  
  .at-auth-card {
    border-radius: var(--radius-xl);
  }
  
  .at-form-group {
    margin-bottom: var(--space-4);
  }
}

/* ==========================================================================
   PRINT STYLES
   Hide interactive elements when printing
   ========================================================================== */

@media print {
  .at-nav,
  .at-btn,
  .at-toast,
  .at-modal-overlay,
  .at-orbs {
    display: none !important;
  }
  
  .at-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}


/* ==========================================================================
   RECOVERED FEATURES - March 21
   ========================================================================== */

/* Nav Menu - No blur on panel */
.nav-menu-blur,
.nav-menu-active .nav-panel,
.nav-menu-active .nav-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Quick Action Button (for FAB and Dashboard) */
.at-btn--quick-action {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  width: 110px;
  min-width: 110px;
  padding: var(--space-3) var(--space-2);
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-secondary);
}

.at-btn--quick-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.at-btn--quick-action.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.28);
  color: var(--text-primary);
}

/* Messages Button Specific */
.at-btn--messages .icon,
.at-btn--messages.active .icon {
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.5);
}

/* FAB Inner Buttons */
.fab-button {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur-medium));
  -webkit-backdrop-filter: blur(var(--glass-blur-medium));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  transition: all var(--transition-base);
}

.fab-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Hide Messages navigation tab */
.hidden-nav-item,
[data-nav="messages"],
nav button:has-text("Messages"),
.nav-item:has-text("Messages") {
    display: none !important;
}




/* Header Grid Layout */
.app-header-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 1280px) {
  .app-header-grid {
    grid-template-columns: auto 1fr;
  }
}

/* FORCE nav panel to have no blur - override everything */
.fixed.top-0.right-0.h-full.w-full.sm\:w-80,
.fixed.top-0.right-0.h-full.sm\:w-80,
[class*="fixed"][class*="top-0"][class*="right-0"][class*="h-full"][class*="w-full"][class*="sm:w-80"] {
  background-color: #1a1a24 !important;
  background: #1a1a24 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}
