:root {
  --primary: rgb(108, 108, 244);
  --secondary: rgb(155, 108, 244);
  --accent: rgb(244, 108, 244);
  --neutral: rgb(45, 52, 54);
  --base-100: rgb(28, 33, 35);
  --info: rgb(108, 155, 244);
  --success: rgb(108, 244, 155);
  --warning: rgb(244, 155, 108);
  --error: rgb(244, 108, 108);
}

body {
  background: linear-gradient(135deg, rgb(28, 33, 35) 0%, rgb(45, 52, 54) 50%, rgb(28, 33, 35) 100%);
  min-height: 100vh;
  font-family: 'Outfit', sans-serif;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Glassmorphism */
.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-strong {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Accordion */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease-out,
    opacity 0.2s ease-out;
  opacity: 0;
}

.accordion-content.open {
  max-height: 2000px;
  opacity: 1;
  overflow-y: auto;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(108, 108, 244, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 108, 244, 0.7);
}

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

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

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

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgb(108, 108, 244);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Progress bar */
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

/* Compact table styles */
.compact-table {
  font-size: 0.875rem;
}

.compact-table th {
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.compact-table td {
  padding: 0.5rem 0.75rem;
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  font-size: 0.875rem;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: rgba(108, 108, 244, 0.2);
  color: white;
  border: 1px solid rgba(108, 108, 244, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: rgba(108, 108, 244, 0.3);
  border-color: rgba(108, 108, 244, 0.5);
}

.btn-success {
  background: rgba(108, 244, 155, 0.15);
  color: rgb(108, 244, 155);
  border: 1px solid rgba(108, 244, 155, 0.3);
}

.btn-success:hover:not(:disabled) {
  background: rgba(108, 244, 155, 0.25);
  border-color: rgba(108, 244, 155, 0.5);
}

.btn-secondary {
  background: rgba(108, 108, 244, 0.2);
  color: white;
  border: 1px solid rgba(108, 108, 244, 0.3);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(108, 108, 244, 0.3);
  border-color: rgba(108, 108, 244, 0.5);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Select dropdown styling - fixed visibility */
select {
  color: white;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(108, 108, 244, 0.3);
}

select:focus {
  outline: 2px solid rgba(108, 108, 244, 0.5);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgb(108, 108, 244);
}

select option {
  background: rgb(28, 33, 35);
  color: white;
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal-content {
  background: linear-gradient(135deg, rgb(35, 40, 42), rgb(45, 52, 54));
  border: 2px solid rgba(108, 108, 244, 0.3);
  border-radius: 16px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  color: white;
  width: 100%;
  transition: all 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: rgb(108, 108, 244);
  background: rgba(255, 255, 255, 0.08);
}

.modal-button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-button-primary {
  background: linear-gradient(135deg, rgb(108, 108, 244), rgb(155, 108, 244));
  border: none;
}

.modal-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 108, 244, 0.4);
}

.modal-button-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-button-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================
 RESPONSIVE DESIGN - MOBILE FIRST
 ============================================ */

/* Mobile: < 640px */
@media (max-width: 639px) {
  body {
    padding: 0;
  }

  .glass-strong,
  .glass,
  .glass-subtle {
    border-radius: 0;
  }

  header .flex {
    flex-direction: column !important;
    gap: 1rem;
  }

  header h1 {
    font-size: 1.875rem !important;
  }

  header .flex.gap-6 {
    justify-content: space-around;
    width: 100%;
  }

  .grid-cols-12 {
    grid-template-columns: 1fr !important;
  }

  .col-span-2,
  .col-span-10 {
    grid-column: span 1 !important;
  }

  .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  .grid-cols-3 {
    grid-template-columns: 1fr !important;
  }

  .compact-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
    max-height: 85vh;
  }

  .flex.gap-3 {
    flex-direction: column;
  }

  .flex-1 {
    width: 100%;
  }

  .p-6 {
    padding: 1rem !important;
  }

  .mb-6 {
    margin-bottom: 1rem !important;
  }

  .gap-6 {
    gap: 1rem !important;
  }

  .btn,
  button,
  select {
    min-height: 44px;
    font-size: 1rem;
  }
}

/* Tablet: 640px - 1023px */
@media (min-width: 640px) and (max-width: 1023px) {
  .grid-cols-12 {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .col-span-2 {
    grid-column: span 4 !important;
  }

  .col-span-10 {
    grid-column: span 4 !important;
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .modal-content {
    width: 85%;
    max-width: 600px;
  }

  .btn,
  button,
  select {
    min-height: 40px;
  }
}

/* Desktop: 1024px+ (default design) */
@media (min-width: 1024px) {
  .col-span-2 {
    position: sticky;
    top: 1.5rem;
    align-self: start;
  }
}

/* Large Desktop: 1536px+ */
@media (min-width: 1536px) {
  .container {
    max-width: 1536px;
    margin: 0 auto;
  }

  .grid-cols-3 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

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

  .pulse {
    animation: none !important;
  }

  .spinner {
    animation: none !important;
    border-top-color: transparent !important;
  }
}

/* ============================================
 ACCESSIBILITY - KEYBOARD NAVIGATION
 ============================================ */

*:focus-visible {
  outline: 2px solid rgb(108, 108, 244);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.btn:focus-visible {
  outline: 3px solid rgb(108, 108, 244);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(108, 108, 244, 0.2);
}

tr:focus {
  outline: 2px solid rgb(108, 108, 244);
  outline-offset: -2px;
  background: rgba(108, 108, 244, 0.1);
}

/* Map set card hover */
.map-set-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-set-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(108, 108, 244, 0.3);
  transform: translateY(-1px);
}
