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

:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #121620;
  --bg-card: rgba(22, 28, 41, 0.6);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(52, 152, 219, 0.15);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverse: #0a0c10;
  
  /* Status Colors */
  --color-online: #10b981;
  --color-online-glow: rgba(16, 185, 129, 0.2);
  --color-offline: #6b7280;
  --color-offline-glow: rgba(107, 114, 128, 0.15);
  --color-starting: #f59e0b;
  --color-starting-glow: rgba(245, 158, 11, 0.2);
  --color-stopping: #ef4444;
  --color-stopping-glow: rgba(239, 68, 68, 0.2);

  /* Accents */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-xbox: #107c10;
  --accent-xbox-hover: #0e6c0e;

  /* Shadows & Effects */
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Navigation */
header {
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(10, 12, 16, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  text-decoration: none;
}

.logo svg {
  color: var(--accent-primary);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 0.35rem 1rem 0.35rem 0.35rem;
  border-radius: 50px;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--bg-primary);
  image-rendering: pixelated;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-left: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Layout Containers */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Hero Section */
.hero {
  margin-bottom: 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Server Cards Grid */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.server-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  backdrop-filter: blur(12px);
}

.server-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-primary);
  opacity: 0;
  transition: var(--transition);
}

.server-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), var(--border-glow);
}

.server-card:hover::before {
  opacity: 1;
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.server-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.server-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* State Modifier Styling */
.server-card.state-online::before { background: var(--color-online); }
.server-card.state-online .status-badge {
  background: var(--color-online-glow);
  color: var(--color-online);
}
.server-card.state-online .status-badge .dot {
  background: var(--color-online);
  box-shadow: 0 0 8px var(--color-online);
  animation: pulse 2s infinite;
}

.server-card.state-offline::before { background: var(--color-offline); }
.server-card.state-offline .status-badge {
  background: var(--color-offline-glow);
  color: var(--text-muted);
}
.server-card.state-offline .status-badge .dot {
  background: var(--color-offline);
}

.server-card.state-starting::before { background: var(--color-starting); }
.server-card.state-starting .status-badge {
  background: var(--color-starting-glow);
  color: var(--color-starting);
}
.server-card.state-starting .status-badge .dot {
  background: var(--color-starting);
  box-shadow: 0 0 8px var(--color-starting);
  animation: pulse-spin 1.5s infinite linear;
}

.server-card.state-stopping::before { background: var(--color-stopping); }
.server-card.state-stopping .status-badge {
  background: var(--color-stopping-glow);
  color: var(--color-stopping);
}
.server-card.state-stopping .status-badge .dot {
  background: var(--color-stopping);
  box-shadow: 0 0 8px var(--color-stopping);
  animation: pulse 1s infinite;
}

/* Connection Details */
.connection-details {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.detail-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.detail-label {
  color: var(--text-muted);
}

.detail-value {
  font-weight: 500;
}

/* Address Box with Click-to-copy */
.address-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: var(--transition);
}

.address-box:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.address-box svg {
  margin-left: 0.5rem;
  color: var(--text-muted);
}

/* Action Buttons */
.action-btn {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-start {
  background: var(--accent-primary);
  color: white;
}

.btn-start:hover:not(:disabled) {
  background: var(--accent-primary-hover);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.btn-start:disabled, .btn-stop:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-stop {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-stop:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Live Players Area */
.players-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.players-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.player-tag img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

/* Login Page Layout */
.login-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.login-card {
  max-width: 400px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.login-logo svg {
  color: var(--accent-primary);
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
}

.login-logo h1 {
  font-size: 1.65rem;
  font-weight: 800;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-xbox {
  background: var(--accent-xbox);
  color: white;
  text-decoration: none;
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(16, 124, 16, 0.2);
}

.btn-xbox:hover {
  background: var(--accent-xbox-hover);
  box-shadow: 0 6px 18px rgba(16, 124, 16, 0.4);
  transform: translateY(-1px);
}

.dev-login-form {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dev-login-form h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 700;
}

.form-group {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.btn-dev {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border: 1px solid var(--border-color);
}

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

/* Toast Message */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
}

.toast-success svg { color: var(--color-online); }
.toast-error svg { color: var(--color-stopping); }

/* Keyframes */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-spin {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  main {
    padding: 1.5rem 1rem;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .servers-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 1.75rem;
  }
}
