/* Ultra-Lightweight Modern Styles - Optimized for Performance */
:root {
  --primary: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body.modern {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 14px;
}

/* Radio button styling for mode selection */
input[type="radio"]:checked + span {
  font-weight: 600;
  color: var(--primary);
}

label:has(input[type="radio"]:checked) {
  background-color: rgba(37, 99, 235, 0.08);
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px var(--primary);
}

/* Smooth transitions */
input, select, textarea, button, label {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

/* Button enhancements */
button {
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  letter-spacing: 0.01em;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Chart container - responsive and lightweight */
.chart-wrap {
  position: relative;
  height: clamp(220px, 35vh, 400px);
  background: white;
  border-radius: 0.75rem;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Cards with subtle shadow */
.card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.15s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Stat cards */
.stat-card {
  background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
  border-left: 3px solid var(--primary);
}

.stat-card.success {
  border-left-color: var(--success);
}

.stat-card.warning {
  border-left-color: var(--warning);
}

.stat-card.danger {
  border-left-color: var(--danger);
}

/* Table enhancements */
table {
  border-collapse: separate;
  border-spacing: 0;
}

table thead th {
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  padding: 0.75rem 1rem;
}

table tbody tr {
  transition: background-color 0.1s;
}

table tbody tr:hover {
  background-color: var(--gray-50);
}

table tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
}

/* Table optimizations for mobile */
@media (max-width: 640px) {
  table {
    font-size: 0.75rem;
  }
  
  table thead th {
    padding: 0.5rem 0.5rem;
    font-size: 0.7rem;
  }
  
  table tbody td {
    padding: 0.625rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .chart-wrap {
    height: clamp(180px, 30vh, 300px);
  }
}

/* Loading animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth scrolling */
html {
  scroll-padding-top: 2rem;
}

/* Input enhancements */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  font-size: 0.9375rem;
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.badge-info {
  background-color: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }
  
  .chart-wrap {
    height: auto;
    page-break-inside: avoid;
  }
  
  button, footer {
    display: none;
  }
}
