/**
 * DevPulse v3.0 - Main Styles
 * Premium GitHub Analytics Dashboard
 * Modern, responsive, and accessible CSS framework
 */

/* ================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ================================ */

:root {
  /* Color Palette */
  --color-primary: #667eea;
  --color-primary-dark: #5a67d8;
  --color-primary-light: #7c3aed;
  --color-accent: #ed8936;
  --color-accent-dark: #dd6b20;
  
  /* Status Colors */
  --color-success: #48bb78;
  --color-warning: #ed8936;
  --color-error: #f56565;
  --color-info: #4299e1;
  
  /* Neutral Colors - Light Theme */
  --color-background: #ffffff;
  --color-surface: #f7fafc;
  --color-surface-elevated: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-text-primary: #1a202c;
  --color-text-secondary: #4a5568;
  --color-text-muted: #718096;
  --color-text-inverse: #ffffff;
  
  /* 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 -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Typography */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;
  
  /* Font Sizes */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* Layout */
  --container-max-width: 1200px;
  --header-height: 4rem;
  --sidebar-width: 280px;
  
  /* Breakpoints (for reference, used in media queries) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* ================================
   DARK THEME VARIABLES
   ================================ */

[data-theme="dark"] {
  /* Neutral Colors - Dark Theme */
  --color-background: #0f1419;
  --color-surface: #1a1f2e;
  --color-surface-elevated: #252d3d;
  --color-border: #2d3748;
  --color-border-light: #374151;
  --color-text-primary: #f7fafc;
  --color-text-secondary: #cbd5e0;
  --color-text-muted: #a0aec0;
  --color-text-inverse: #1a202c;
  
  /* Adjusted shadows for dark theme */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* ================================
   GLOBAL STYLES & RESET
   ================================ */

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

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

/* Remove focus outline for mouse users, keep for keyboard users */
body:not(.user-is-tabbing) *:focus {
  outline: none !important;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* ================================
   TYPOGRAPHY
   ================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

strong {
  font-weight: var(--font-weight-semibold);
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.875em;
  padding: 0.125rem 0.25rem;
  background-color: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ================================
   ACCESSIBILITY
   ================================ */

/* Skip link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }
  
  [data-theme="dark"] {
    --color-border: #ffffff;
  }
}

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

/* ================================
   LAYOUT COMPONENTS
   ================================ */

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-xl);
  }
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: var(--space-lg) 0;
}

/* ================================
   LOADING SCREEN
   ================================ */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-container {
  text-align: center;
  color: var(--color-text-inverse);
}

.loading-logo {
  margin-bottom: var(--space-lg);
}

.logo-icon {
  width: 4rem;
  height: 4rem;
  animation: pulse 2s ease-in-out infinite;
}

.loading-text h2 {
  color: var(--color-text-inverse);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-sm);
}

.loading-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-xl);
}

.loading-progress {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: var(--color-text-inverse);
  border-radius: var(--radius-full);
  animation: progressSlide 2s ease-in-out infinite;
}

/* ================================
   HEADER
   ================================ */

.app-header {
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition: all var(--transition-normal);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-logo .logo-icon {
  width: 2rem;
  height: 2rem;
  color: var(--color-primary);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.brand-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.brand-version {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.action-button {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.action-button:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.action-button:active {
  transform: translateY(0);
}

.action-button svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Theme toggle specific styles */
.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* Fullscreen toggle specific styles */
.fullscreen-exit {
  display: none;
}

.fullscreen-active .fullscreen-enter {
  display: none;
}

.fullscreen-active .fullscreen-exit {
  display: block;
}

/* ================================
   SEARCH SECTION
   ================================ */

.search-section {
  margin-bottom: var(--space-4xl);
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.search-header {
  margin-bottom: var(--space-2xl);
}

.search-title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

/* Search Form */
.search-form {
  margin-bottom: var(--space-xl);
}

.search-input-group {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.search-input-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-md);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  height: 3.5rem;
  padding: 0 var(--space-md) 0 3rem;
  font-size: var(--font-size-lg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  font-family: var(--font-family-primary);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-background);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.clear-button {
  position: absolute;
  right: var(--space-sm);
  width: 2rem;
  height: 2rem;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 2;
}

.clear-button:hover {
  background: var(--color-error);
  color: var(--color-text-inverse);
}

.clear-button svg {
  width: 1rem;
  height: 1rem;
}

.search-button {
  height: 3.5rem;
  padding: 0 var(--space-xl);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
  min-width: 120px;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.search-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

.search-button .button-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Search Suggestions */
.search-suggestions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.suggestions-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-right: var(--space-sm);
}

.suggestion-chip {
  padding: 0.375rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family-mono);
}

.suggestion-chip:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 640px) {
  .search-input-group {
    flex-direction: column;
  }
  
  .search-button {
    width: 100%;
    justify-content: center;
  }
  
  .search-suggestions {
    justify-content: flex-start;
  }
  
  .brand-text {
    display: none;
  }
  
  .search-title {
    font-size: var(--font-size-3xl);
  }
  
  .search-subtitle {
    font-size: var(--font-size-base);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-sm);
  }
  
  .search-title {
    font-size: var(--font-size-2xl);
  }
  
  .header-actions {
    gap: var(--space-xs);
  }
}

/* ================================
   ANIMATIONS
   ================================ */

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes progressSlide {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

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

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

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
  animation: slideInUp 0.6s ease-out;
}

.animate-slide-down {
  animation: slideInDown 0.6s ease-out;
}

/* ================================
   UTILITY CLASSES
   ================================ */

/* Display */
.hidden { display: none !important; }
.block { display: block !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }

/* Flexbox */
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }

/* Text */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

/* Colors */
.text-primary { color: var(--color-primary) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-error { color: var(--color-error) !important; }
.text-success { color: var(--color-success) !important; }

/* Spacing */
.m-0 { margin: 0 !important; }
.mb-sm { margin-bottom: var(--space-sm) !important; }
.mb-md { margin-bottom: var(--space-md) !important; }
.mb-lg { margin-bottom: var(--space-lg) !important; }

/* Border radius */
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* ================================
   PRINT STYLES
   ================================ */

@media print {
  .no-print {
    display: none !important;
  }
  
  .app-header,
  .search-section,
  .action-button {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .dashboard {
    display: block !important;
  }
}
