/* ============================================
   Agiones CMS - Base Reset & Layout
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Base Typography */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* Page Wrapper */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* Accessibility - Screen reader only */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid #4a90d9;
  outline-offset: 2px;
}

/* Utility Classes */
.muted {
  opacity: 0.7;
}

.small {
  font-size: 0.875rem;
}

/* Basic Form Elements */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* Links */
a {
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-xs {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

/* Inline Form */
.inline-form {
  display: inline;
  margin: 0;
}

/* Cards */
.card {
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-auth {
  max-width: 400px;
  margin: 3rem auto;
  text-align: center;
}

/* Custom HTML */
.custom-html {
  padding: 1rem;
  text-align: center;
}

/* GDPR Banner */
.gdpr-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  flex-wrap: wrap;
}

.gdpr-content {
  flex: 1;
  min-width: 200px;
}

.gdpr-actions {
  display: flex;
  gap: 0.5rem;
}

.gdpr-link {
  text-decoration: underline;
  margin-left: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .gdpr-banner {
    flex-direction: column;
    text-align: center;
  }

  .gdpr-content,
  .gdpr-actions {
    width: 100%;
  }
}

/* ============================================
   Server Player Count Badge
   ============================================ */
.server-players-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--surface-secondary, #2a2a3a);
  color: var(--text-muted, #888);
  transition: all 0.2s ease;
}

.server-players-badge .players-icon {
  font-size: 0.75rem;
}

.server-players-badge .players-count {
  min-width: 2rem;
  text-align: center;
}

.server-players-badge.online {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.server-players-badge.offline {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.server-players-badge.online .players-icon::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 3px;
  animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* ============================================
   Server Detail - Live Status
   ============================================ */
.server-status-live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--surface-secondary, #1a1a2a);
  border-radius: 6px;
  font-size: 0.9rem;
}

.server-status-live .status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted, #666);
}

.server-status-live .status-indicator.loading {
  background: #888;
  animation: pulse-status 1s infinite;
}

.server-status-live .status-indicator.online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.server-status-live .status-indicator.offline {
  background: #ef4444;
}

.server-status-live .status-indicator.unknown {
  background: #f59e0b;
}

.server-status-live .status-text {
  color: var(--text-primary, #ddd);
}

.server-status-live .status-text strong {
  color: #22c55e;
  font-weight: 600;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================
   Server Row Main - Description + Status
   ============================================ */
.server-row-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-top: 0.5rem;
}

.server-row-main .server-description {
  flex: 1;
  min-width: 0;
}

.server-status-inline {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ============================================
   Mobile Responsive Enhancements
   ============================================ */
@media (max-width: 768px) {
  /* Server Row Mobile */
  .server-row {
    padding: 1rem !important;
  }

  .server-row-header {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .server-name-address {
    width: 100%;
  }

  .server-name {
    font-size: 1.1rem;
  }

  .server-name a {
    display: block;
    margin-bottom: 0.3rem;
  }

  .server-hashtags {
    flex-wrap: wrap;
    margin-top: 0.3rem;
  }

  .hashtag-badge {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.4rem !important;
  }

  .server-address-inline {
    margin-top: 0.3rem;
  }

  .server-actions-top {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .server-info-inline {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }

  .server-row-main {
    flex-direction: column;
    gap: 0.75rem;
  }

  .server-status-inline {
    width: 100%;
    justify-content: flex-start;
  }

  .server-players-badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Home Header Mobile */
  .home-header {
    padding: 1.5rem 1rem !important;
    text-align: center;
  }

  .home-header h1 {
    font-size: 1.5rem !important;
  }

  .home-intro-single-line {
    font-size: 0.9rem;
  }

  .home-search {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .search-input,
  .sort-select {
    width: 100% !important;
  }

  /* Featured Section Mobile */
  .featured-header {
    font-size: 1.1rem !important;
    padding: 0 1rem;
  }

  .featured-section {
    padding: 0 !important;
  }

  .server-row.featured {
    border-radius: 0 !important;
    margin: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }

  /* Editorial Mobile */
  .editorial-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .editorial-card {
    padding: 1rem !important;
  }

  .editorial-card h3 {
    font-size: 1rem !important;
  }

  /* FAQ Mobile */
  .faq-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .faq-item h3 {
    font-size: 0.95rem !important;
  }

  /* Pagination Mobile */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem !important;
  }

  .pagination .page {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.85rem;
  }

  /* Server Detail Mobile */
  .server-detail-header {
    flex-direction: column !important;
    gap: 1rem !important;
    text-align: center;
  }

  .server-detail-votes {
    order: -1;
  }

  .server-status-live {
    justify-content: center;
  }

  .server-links {
    flex-direction: column;
    gap: 0.5rem;
  }

  .link-btn {
    width: 100%;
    text-align: center;
  }

  /* Navigation Mobile */
  .site-nav {
    flex-wrap: wrap;
    padding: 0.75rem !important;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 0.5rem !important;
    margin-top: 0.5rem;
  }

  .nav-links a {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }

  /* Cards Mobile */
  .card {
    padding: 1rem !important;
    border-radius: 12px !important;
  }

  /* Comments Mobile */
  .comment-list {
    gap: 0.75rem;
  }

  .comment {
    padding: 0.75rem !important;
  }

  /* Discord Card Mobile */
  .discord-card {
    padding: 1rem !important;
  }

  .discord-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .discord-stat {
    flex: 1;
    min-width: 80px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .server-name {
    font-size: 1rem;
  }

  .ip-badge {
    font-size: 0.75rem !important;
    padding: 0.2rem 0.4rem !important;
  }

  .btn-primary,
  .btn-secondary {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }

  .stat-value {
    font-size: 1rem !important;
  }
}
