@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --twilight-dark: #0f0e17;
  --twilight-slate: #1a1625;
  --twilight-purple: #6366f1;
  --twilight-indigo: #4f46e5;
  --twilight-pink: #ec4899;
  --twilight-blue: #3b82f6;
  --twilight-text: #e2e8f0;
  --twilight-muted: #94a3b8;
  --twilight-border: #2d2640;
  --twilight-hover: #251e3e;
}

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

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--twilight-dark);
  color: var(--twilight-text);
  min-height: 100vh;
  overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
  background: var(--twilight-slate);
}

::-webkit-scrollbar-thumb {
  background: var(--twilight-purple);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--twilight-indigo);
}

/* Animations - GPU Accelerated */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideIn {
  from {
    transform: translate3d(-100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Card Styles */
.card {
  background: var(--twilight-slate);
  border: 1px solid var(--twilight-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  will-change: transform;
}

.card:hover {
  border-color: var(--twilight-purple);
  transform: translate3d(0, -2px, 0);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
}

.card-gradient {
  background: linear-gradient(135deg, var(--twilight-slate) 0%, var(--twilight-dark) 100%);
  position: relative;
  overflow: hidden;
}

.card-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(99, 102, 241, 0.1), transparent);
  transform: translate3d(-100%, 0, 0);
  transition: transform 0.6s ease;
  will-change: transform;
}

.card-gradient:hover::before {
  transform: translate3d(100%, 0, 0);
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--twilight-purple), var(--twilight-indigo));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--twilight-hover);
  color: var(--twilight-text);
  border: 1px solid var(--twilight-border);
}

.btn-secondary:hover {
  background: var(--twilight-purple);
  border-color: var(--twilight-purple);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
}

/* Input Styles */
.input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--twilight-dark);
  border: 1px solid var(--twilight-border);
  border-radius: 10px;
  color: var(--twilight-text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.input:focus {
  outline: none;
  border-color: var(--twilight-purple);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* Select Styles */
.select {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--twilight-dark);
  border: 1px solid var(--twilight-border);
  border-radius: 10px;
  color: var(--twilight-text);
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.select:focus {
  outline: none;
  border-color: var(--twilight-purple);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Badge Styles */
.badge {
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid #10b981;
}

.badge-suspended {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid #ef4444;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid #f59e0b;
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border: 1px solid #3b82f6;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--twilight-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--twilight-hover);
}

.table th {
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--twilight-purple);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--twilight-border);
}

.table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--twilight-border);
  color: var(--twilight-text);
}

.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover {
  background: var(--twilight-hover);
}

/* Stat Card */
.stat-card {
  background: linear-gradient(135deg, var(--twilight-slate), var(--twilight-dark));
  border: 1px solid var(--twilight-border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  animation: pulse-glow 3s infinite;
}

.stat-card .stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--twilight-purple), var(--twilight-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  color: var(--twilight-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 14, 23, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--twilight-slate);
  border: 1px solid var(--twilight-border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

/* Alert Styles */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  animation: fadeIn 0.5s ease;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: #f59e0b;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
  color: #3b82f6;
}

/* Code/Monospace */
.code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--twilight-dark);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--twilight-purple);
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--twilight-border);
  border-top: 3px solid var(--twilight-purple);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-gradient {
  background: linear-gradient(135deg, var(--twilight-purple), var(--twilight-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-glow {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

.transition-all {
  transition: all 0.3s ease;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Tables - Horizontal scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 600px;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  /* Stat Cards */
  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-value {
    font-size: 2rem;
  }

  /* Buttons */
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }

  /* Modals */
  .modal {
    width: 95%;
    padding: 1.5rem;
  }

  /* Forms */
  .input, .select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Grid layouts */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  /* Typography */
  h1 {
    font-size: 1.75rem !important;
  }

  h2 {
    font-size: 1.5rem !important;
  }

  h3 {
    font-size: 1.25rem !important;
  }

  /* Smaller padding */
  .card {
    padding: 0.875rem;
    border-radius: 12px;
  }

  /* Stat cards */
  .stat-card .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .stat-card .stat-value {
    font-size: 1.75rem;
  }

  /* Buttons smaller */
  .btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }

  /* Badge smaller */
  .badge {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
  }

  /* Alert smaller */
  .alert {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
  }
}

/* Touch-friendly */
@media (hover: none) and (pointer: coarse) {
  .btn, .input, .select, a {
    min-height: 44px; /* iOS recommendation */
    min-width: 44px;
  }

  .table tbody tr {
    cursor: pointer;
  }
}
