/**
 * Portal Dark Theme - Apple Quality (macOS Big Sur/Sonoma Style)
 * 
 * @package RivaClientPortal
 * @version 1.0.0
 */

:root {
  /* Apple Dark Theme Colors */
  --rcp-bg-primary: #000000;
  --rcp-bg-secondary: #1C1C1E;
  --rcp-bg-tertiary: #2C2C2E;
  --rcp-surface: rgba(255, 255, 255, 0.05);
  --rcp-surface-elevated: rgba(255, 255, 255, 0.08);
  --rcp-surface-hover: rgba(255, 255, 255, 0.12);
  --rcp-surface-pressed: rgba(255, 255, 255, 0.16);
  
  /* Text Colors - Improved Contrast */
  --rcp-text-primary: #FFFFFF; /* Pure white for maximum contrast */
  --rcp-text-secondary: #A0A0A0; /* Lighter gray for better readability */
  --rcp-text-tertiary: #808080; /* Medium gray */
  --rcp-text-quaternary: #606060; /* Darker gray */
  
  /* Accent Colors (Apple System Colors) */
  --rcp-blue: #0A84FF;
  --rcp-blue-hover: #0056CC;
  --rcp-green: #30D158;
  --rcp-green-hover: #1D7A2F;
  --rcp-orange: #FF9F0A;
  --rcp-orange-hover: #CC7A00;
  --rcp-red: #FF453A;
  --rcp-red-hover: #CC3629;
  --rcp-purple: #AF52DE;
  --rcp-purple-hover: #8B2CBF;
  --rcp-pink: #FF2D92;
  --rcp-pink-hover: #CC2475;
  --rcp-yellow: #FFD60A;
  --rcp-yellow-hover: #CCAB08;
  
  /* Status Colors */
  --rcp-success: var(--rcp-green);
  --rcp-warning: var(--rcp-orange);
  --rcp-error: var(--rcp-red);
  --rcp-info: var(--rcp-blue);
  
  /* Glassmorphism */
  --rcp-blur: blur(40px);
  --rcp-blur-light: blur(20px);
  --rcp-glass-bg: rgba(255, 255, 255, 0.05);
  --rcp-glass-border: rgba(255, 255, 255, 0.1);
  
  /* Gradient Animation Controls */
  --gradient-speed: 15s; /* Default animation speed */
  --gradient-color-1: #0A84FF; /* Blue */
  --gradient-color-2: #AF52DE; /* Purple */
  --gradient-color-3: #30D158; /* Green */
  --rcp-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  /* Shadows */
  --rcp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --rcp-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --rcp-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --rcp-shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.5);
  
  /* Spacing (4px grid system) */
  --rcp-space-1: 4px;
  --rcp-space-2: 8px;
  --rcp-space-3: 12px;
  --rcp-space-4: 16px;
  --rcp-space-5: 20px;
  --rcp-space-6: 24px;
  --rcp-space-8: 32px;
  --rcp-space-10: 40px;
  --rcp-space-12: 48px;
  --rcp-space-16: 64px;
  --rcp-space-20: 80px;
  
  /* Border Radius */
  --rcp-radius-sm: 6px;
  --rcp-radius-md: 8px;
  --rcp-radius-lg: 12px;
  --rcp-radius-xl: 16px;
  --rcp-radius-2xl: 20px;
  --rcp-radius-full: 50%;
  
  /* Z-Index Scale - Consistent Stacking Context */
  --rcp-z-base: 1;
  --rcp-z-dropdown: 1000;
  --rcp-z-sticky: 100;
  --rcp-z-fixed: 1000;
  --rcp-z-modal-backdrop: 10000;
  --rcp-z-modal: 10001;
  --rcp-z-popover: 10002;
  --rcp-z-tooltip: 10003;
  --rcp-z-toast: 10004;
  --rcp-z-max: 99999;
  
  /* Typography */
  --rcp-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --rcp-font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  
  /* Font Sizes */
  --rcp-text-xs: 11px;
  --rcp-text-sm: 13px;
  --rcp-text-base: 15px;
  --rcp-text-lg: 17px;
  --rcp-text-xl: 19px;
  --rcp-text-2xl: 21px;
  --rcp-text-3xl: 25px;
  --rcp-text-4xl: 31px;
  --rcp-text-5xl: 37px;
  
  /* Font Weights */
  --rcp-font-light: 300;
  --rcp-font-normal: 400;
  --rcp-font-medium: 500;
  --rcp-font-semibold: 600;
  --rcp-font-bold: 700;
  
  /* Line Heights */
  --rcp-leading-tight: 1.2;
  --rcp-leading-normal: 1.4;
  --rcp-leading-relaxed: 1.6;
  
  /* Transitions */
  --rcp-transition-fast: 0.15s ease;
  --rcp-transition-normal: 0.2s ease;
  --rcp-transition-slow: 0.3s ease;
  
  /* Z-Index Scale - Fixed Stacking Context */
  --rcp-z-dropdown: 10000;
  --rcp-z-sticky: 10020;
  --rcp-z-fixed: 10030;
  --rcp-z-modal-backdrop: 10040;
  --rcp-z-modal: 10050;
  --rcp-z-popover: 10060;
  --rcp-z-tooltip: 10070;
  --rcp-z-toast: 10080;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--rcp-font-family);
  font-size: var(--rcp-text-base);
  font-weight: var(--rcp-font-normal);
  line-height: var(--rcp-leading-normal);
  color: var(--rcp-text-primary);
  background: var(--rcp-bg-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Gradient Animation */
@keyframes gradientShift {
  0%, 100% { 
    background-position: 0% 50%; 
  }
  50% { 
    background-position: 100% 50%; 
  }
}

/* Portal Page with Gradient Animation */
body.rcp-portal-page {
  background: linear-gradient(
    135deg,
    var(--gradient-color-1),
    var(--gradient-color-2),
    var(--gradient-color-3)
  );
  background-size: 400% 400%;
  animation: gradientShift var(--gradient-speed) ease infinite;
}

/* Disable animations for users who prefer reduced motion */
body.rcp-no-animations {
  animation: none !important;
}

body.rcp-no-animations.rcp-portal-page {
  background: var(--rcp-bg-primary);
}

/* Focus Styles */
*:focus {
  outline: 2px solid var(--rcp-blue);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

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

::-moz-selection {
  background: var(--rcp-blue);
  color: var(--rcp-text-primary);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--rcp-text-quaternary);
  border-radius: var(--rcp-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--rcp-text-tertiary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--rcp-text-quaternary) var(--rcp-bg-secondary);
}

/* 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;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --rcp-surface: rgba(255, 255, 255, 0.15);
    --rcp-surface-elevated: rgba(255, 255, 255, 0.2);
    --rcp-text-secondary: #B0B0B0;
  }
}

/* Dark Mode (explicit) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Print Styles */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  abbr[title]:after {
    content: " (" attr(title) ")";
  }
  
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}
