/* gamerhost.ai — Mobile-first dark theme, Harmony style */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --border: #334155;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Mobile-first layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top nav bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.top-bar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.top-bar .logo span {
  color: var(--text-primary);
}

.top-bar nav {
  display: flex;
  gap: 4px;
}

.top-bar nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s;
}

.top-bar nav a:hover,
.top-bar nav a.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Main content area */
.main-content {
  flex: 1;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Page header */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--accent); }

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Server list */
.server-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.server-name {
  font-size: 16px;
  font-weight: 600;
}

.server-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.server-detail label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.server-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: rgba(34,197,94,0.15);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.3);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}

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

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-block {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

tr:hover td {
  background: rgba(139,92,246,0.05);
}

/* Bottom tab bar (mobile) */
.tab-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}

.tab-bar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px;
  transition: color 0.2s;
}

.tab-bar a.active {
  color: var(--accent);
}

.tab-bar a svg {
  width: 22px;
  height: 22px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  margin-bottom: 20px;
}

/* Loading */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  left: 16px;
  max-width: 400px;
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }

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

/* Plan cards */
.plan-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 24px 0;
}

.plan-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}

.plan-card.featured {
  border-color: var(--accent);
  position: relative;
}

.plan-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.plan-price {
  font-size: 40px;
  font-weight: 800;
  margin: 16px 0;
}

.plan-price span {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 400;
}

.plan-features {
  list-style: none;
  text-align: left;
  margin: 20px 0;
}

.plan-features li {
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features li::before {
  content: '\2713';
  color: var(--success);
  font-weight: 700;
}

/* Console log viewer */
.console-log {
  background: #000;
  color: #22c55e;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Responsive — tablet and up */
@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .plan-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .server-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .server-details {
    grid-template-columns: repeat(4, 1fr);
  }

  .main-content {
    padding: 24px;
  }

  .tab-bar { display: none; }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .main-content {
    padding: 32px;
  }
}

/* Safe area for mobile bottom bar */
.main-content {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

@media (min-width: 640px) {
  .main-content {
    padding-bottom: 32px;
  }
}

/* Landing page hero */
.hero {
  text-align: center;
  padding: 60px 20px;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero h1 .highlight {
  color: var(--accent);
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .hero h1 { font-size: 48px; }
  .hero p { font-size: 20px; }
}


/* Mobile fixes */
@media (max-width: 639px) {
  .hero {
    padding: 40px 16px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .hero p {
    font-size: 15px;
  }
  .hero-actions {
    flex-direction: column;
    gap: 10px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  .page-header h1 {
    font-size: 20px;
  }
  .game-catalog {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .game-card {
    padding: 20px !important;
  }
  .plan-cards {
    grid-template-columns: 1fr;
  }
  .plan-price {
    font-size: 32px;
  }
  .top-bar nav a {
    padding: 6px 8px;
    font-size: 13px;
  }
  .top-bar .logo {
    font-size: 16px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .server-card {
    flex-direction: column;
  }
  .server-details {
    grid-template-columns: 1fr 1fr;
  }
  .console-log {
    font-size: 10px;
    max-height: 250px;
  }
  /* Monitor charts stack vertically */
  .main-content > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Fix for iOS safe areas */
@supports (padding: max(0px)) {
  .main-content {
    padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
  }
  .tab-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Ensure text is visible on dark background */
body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}
html {
  height: -webkit-fill-available;
}
