/* Premium Apple-style UI - Performance Optimized */

/* ========== Performance Optimizations ========== */
* {
  will-change: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* GPU acceleration for smooth transitions */
.card,
.btn,
.nav-link,
.modal,
.dropdown {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ========== Apple-style Cards ========== */
.card {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  box-shadow: 
    0 0.5px 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.05),
    0 4px 16px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 0.5px 0 1px rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.1),
    0 4px 8px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.1),
    0 16px 32px rgba(0, 0, 0, 0.1);
}

/* ========== Premium Buttons ========== */
.btn {
  position: relative;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  contain: layout style paint;
}

.btn-primary {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: none;
}

.btn-primary:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  background: rgba(6, 182, 212, 0.12);
  transform: translateY(0);
}

/* ========== Smooth Scrolling ========== */
.Content {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Custom scrollbar */
.Content::-webkit-scrollbar {
  width: 8px;
}

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

.Content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: background 0.2s;
}

.Content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========== Smooth Animations ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========== Input Fields ========== */
.input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.input:focus {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--brand);
  box-shadow:
    0 0 0 3px rgba(var(--brand-rgb, 6, 182, 212), 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ========== Navigation Rail Optimization ========== */
.NavRail {
  will-change: transform;
  contain: layout style paint;
}

.nav-link {
  position: relative;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
  transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link.active::before {
  height: 24px;
}

/* ========== Modal Improvements ========== */
.modal {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 
    0 24px 48px rgba(0, 0, 0, 0.4),
    0 12px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ========== Loading States ========== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ========== Performance Metrics ========== */
.metric-card {
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  contain: layout style paint;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 8px;
}

/* ========== Tables ========== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  contain: layout style paint;
}

.table th {
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.table tr {
  transition: background 0.15s ease;
}

.table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

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

/* ========== Mobile Optimizations ========== */
@media (max-width: 768px) {
  .card {
    border-radius: 12px;
  }
  
  .btn {
    padding: 12px 24px;
    font-size: 16px;
  }
  
  .metric-value {
    font-size: 24px;
  }
}