/* ==========================================================================
   StockRipple POS - Main Design System & Animation Engine
   ========================================================================== */

:root {
  /* Brand Color Palette */
  --color-primary: #3b5bfd;
  --color-primary-hover: #2b4be7;
  --color-primary-active: #1f3ecf;
  --color-primary-subtle: rgba(59, 91, 253, 0.1);

  --color-secondary: #64748b;
  --color-secondary-subtle: rgba(100, 116, 139, 0.1);

  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-subtle: rgba(16, 185, 129, 0.12);

  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-subtle: rgba(245, 158, 11, 0.12);

  --color-danger: #f43f5e;
  --color-danger-hover: #e11d48;
  --color-danger-subtle: rgba(244, 63, 94, 0.12);

  --color-info: #06b6d4;
  --color-info-subtle: rgba(6, 182, 212, 0.12);

  /* Light Canvas & Surfaces */
  --color-bg-canvas: #f8fafc;
  --color-bg-surface: #ffffff;
  --color-bg-surface-elevated: #ffffff;
  --color-bg-subtle: #f1f5f9;
  --color-bg-muted: #e2e8f0;

  /* Borders */
  --color-border: #e2e8f0;
  --color-border-subtle: #f1f5f9;
  --color-border-focus: #3b5bfd;

  /* Typography Colors */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-text-inverted: #ffffff;

  /* Font Stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px labels */
  --text-sm: 0.875rem;   /* 14px body */
  --text-base: 1rem;     /* 16px inputs */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px headers */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 2rem;      /* 32px metric numbers */

  /* Spacing Scale (4px base unit) */
  --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 */

  /* Border Radius Scale */
  --radius-xs: 0.25rem;  /* 4px */
  --radius-sm: 0.375rem; /* 6px */
  --radius-md: 0.5rem;   /* 8px - inputs & buttons */
  --radius-lg: 0.75rem;  /* 12px - cards */
  --radius-xl: 1rem;     /* 16px - modals */
  --radius-2xl: 1.5rem;  /* 24px - dashboard widgets */
  --radius-full: 9999px;

  /* Layered Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Transitions */
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

a {
  text-decoration: none !important;
}

/* Sleek Slim Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-canvas);
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--duration-normal) var(--ease-smooth),
              color var(--duration-normal) var(--ease-smooth);
}

.font-mono {
  font-family: var(--font-mono) !important;
}

/* Base Keyframe Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes pulseLive {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.15);
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-smooth) forwards;
}

.animate-slide-up {
  animation: slideUp var(--duration-normal) var(--ease-smooth) forwards;
}

.animate-slide-right {
  animation: slideInRight var(--duration-normal) var(--ease-smooth) forwards;
}

.animate-shake {
  animation: shake 400ms var(--ease-smooth);
}

.animate-pulse-live {
  animation: pulseLive 2s infinite ease-in-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* App Mobile Fullscreen Modal & Bottom Sheet Overrides */
@media (max-width: 767.98px) {
  .modal-dialog {
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
  }
  .modal-content {
    border-radius: 0 !important;
    min-height: 100% !important;
    border: none !important;
  }
  .modal-body {
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
  }
}

/* Accessibility: Reduced Motion Support */
@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;
  }
}

/* App Shell Structure Styles */
#app-root {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

#app-sidebar {
  width: 240px;
  flex-shrink: 0;
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.dark #app-sidebar {
  background-color: #0c111d !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#app-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--color-bg-canvas);
}

.dark #app-main-wrapper {
  background-color: #090d16 !important;
}

#app-header {
  height: 64px;
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.dark #app-header {
  background-color: #0c111d !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#app-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Toast Container positioning */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

#toast-container .toast {
  pointer-events: auto;
}

/* Card & Surface Custom Stylings */
.surface-card {
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.surface-card:hover {
  border-color: rgba(59, 91, 253, 0.3);
}

/* Interactive Element Focus standard */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
