/* gtav-servers.css - Minimalist Redesign */

/* Hide the category widget placeholder on this page */
.widget_block:has(.custom-menu) {
  display: none !important;
}

.gtav-server-info {
  border-radius: 6px;
  padding: 16px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid hsl(240, 8%, 18%);
  background: var(--glance-card-bg);
  transition: all 0.2s ease;
}

.gtav-server-info:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--glance-bg-inset);
  transform: translateX(2px);
}

/* Left section: Icon + Server Info */
.gtav-server-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.gtav-server-icon-container {
  position: relative;
  flex-shrink: 0;
}

.gtav-server-icon {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid var(--glance-border);
  object-fit: cover;
  background-color: #222;
}

.gtav-source-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid var(--glance-card-bg);
  background-color: var(--glance-card-bg);
  object-fit: contain;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.gtav-server-info-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* Allow text truncation */
}

.gtav-server-name-header {
  font-family: "Google Sans", sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--glance-text-highlight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gtav-server-gamemode {
  color: var(--glance-text-muted);
  font-size: 12px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right section: Players + Actions */
.gtav-server-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.gtav-server-players {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.gtav-player-count {
  font-weight: 700;
  color: #8ab4f8;
  font-size: 20px;
  line-height: 1;
}

.gtav-player-limit {
  color: var(--glance-text-muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 2px;
}

.gtav-server-actions {
  display: flex;
  gap: 6px;
}

.gtav-connect-button,
.gtav-discord-button,
.gtav-website-button {
  background-color: #262626;
  color: #bbb;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 7px 12px;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.gtav-connect-button {
  border-color: #28a745;
  background-color: #28a745;
  color: #fff;
}

.gtav-discord-button {
  border-color: #5865f2;
  background-color: transparent;
  color: #5865f2;
}

.gtav-website-button {
  border-color: var(--glance-primary);
  background-color: transparent;
  color: var(--glance-primary);
  border-color: var(--glance-primary);
}

.gtav-connect-button:hover {
  background-color: #218838;
  border-color: #218838;
  transform: translateY(-1px);
}

.gtav-discord-button:hover {
  background-color: #5865f2;
  color: #fff;
  transform: translateY(-1px);
}

.gtav-website-button:hover {
  background-color: var(--glance-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* FiveM and RageMP specific styling */
.fivem-server {
  border-left: 4px solid #f39c12;
}

.fivem-server .gtav-source-badge {
  border-color: #f39c12;
}

.ragemp-server {
  border-left: 4px solid #e74c3c;
}

.ragemp-server .gtav-source-badge {
  border-color: #e74c3c;
}

/* Title and header styling */
.container-gtav-title {
  text-align: center;
  margin-bottom: 24px;
}

.gtav-servers-title {
  font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono",
    monospace;
  color: #d97757;
  font-size: 24px;
  margin-bottom: 0px !important;
}

.total-players-gtav {
  font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono",
    monospace;
  font-size: 14px;
  color: var(--glance-text-highlight);
  background: var(--glance-bg-inset);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--glance-border);
  display: inline-block;
  margin-bottom: 16px;
  text-align: center;
  transition: all 0.2s ease;
  font-weight: 500;
}

.total-players-gtav:hover {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.player-count-gtav {
  font-weight: bold;
  color: #8ab4f8;
  font-size: 18px;
}

.loading-player-count-gtav {
  color: transparent;
  font-style: italic;
}

.server-count-gtav {
  color: #8ab4f8;
  font-weight: bold;
}

.last-fetched-time-gtav {
  text-align: center;
  color: var(--glance-text-muted);
  font-size: 12px;
  margin-top: 16px;
  font-style: italic;
}

/* Loading and error states */
#gtav-servers-container {
  min-height: 400px;
  transition: min-height 0.3s ease;
}

#gtav-servers-container:not(:empty) {
  min-height: auto;
}

.gtav-loading {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.gtav-loading p {
  font-style: italic;
  font-size: 15px;
  margin: 12px 0 0 0;
}

.gtav-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #2a2a2a;
  border-top: 3px solid #007aff;
  border-radius: 50%;
  animation: gtav-spin 1s linear infinite;
  margin: 0 auto 12px auto;
}

@keyframes gtav-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.gtav-loading-placeholder {
  max-width: 900px;
  margin: 0 auto;
}

.gtav-server-placeholder {
  background: var(--glance-card-bg);
  border: 1px solid var(--glance-border);
  border-radius: 6px;
  height: 74px;
  margin: 6px 0;
  opacity: 0.6;
  animation: gtav-pulse 1.5s ease-in-out infinite;
}

@keyframes gtav-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
}

.gtav-error {
  text-align: center;
  padding: 40px;
  color: #e74c3c;
  font-weight: 600;
  background-color: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

/* Hover effects for player count */
.gtav-server-info:hover .gtav-player-count {
  color: #d97757;
  text-shadow: 0 0 8px rgba(231, 146, 93, 0.4);
}

.total-players-gtav:hover .player-count-gtav {
  color: #8ab4f8;
}

/* Animation for new data updates */
@keyframes gtav-highlight {
  0% {
    color: #f2f2f2;
    text-shadow: 0 0 10px rgba(0, 122, 255, 0.7);
  }
  100% {
    color: #007aff;
    text-shadow: none;
  }
}

.gtav-player-count.highlight-update {
  animation: gtav-highlight 1.3s ease-in-out;
}

/* Server status indicators */
.gtav-server-info.offline .gtav-player-count {
  color: #666;
  font-size: 16px;
  font-weight: normal;
}

.gtav-server-info.offline .gtav-player-count::after {
  content: " (Offline)";
  font-size: 11px;
  color: #555;
}

/* Download container styling */
.gtav-download-container {
  position: relative;
  margin-bottom: 20px;
  margin-top: 20px;
}

.gtav-download-container .extension-promo-widget {
  max-width: 100%;
}

/* Extension Promo Widget */
.extension-promo-widget {
  background: var(--glance-card-bg);
  border: 1px solid var(--glance-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.extension-promo-widget h4 {
  color: var(--glance-text-highlight);
  font-size: 17px;
  margin-top: 0;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.extension-promo-widget:hover h4 {
  color: #fff;
}

.extension-promo-widget p {
  color: #888;
  font-size: 13px;
  margin-bottom: 16px;
}

.extension-promo-widget img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 18px;
  -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

.promo-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.promo-button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  position: relative;
  transition: all 0.2s ease;
  margin: 0;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.promo-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: #ffffff !important;
}

.promo-button:active {
  transform: translateY(0px);
  filter: brightness(0.95);
}

.promo-button.chrome {
  background-color: #0f9d58;
}

.promo-button.firefox {
  background-color: #5b2d90;
}

/* Mobile responsive design */
@media screen and (max-width: 768px) {
  .gtav-server-info {
    padding: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }

  .gtav-server-left {
    width: 100%;
    gap: 10px;
  }

  .gtav-server-icon {
    width: 36px;
    height: 36px;
  }

  .gtav-source-badge {
    width: 18px;
    height: 18px;
  }

  .gtav-server-name-header {
    font-size: 14px;
  }

  .gtav-server-gamemode {
    font-size: 11px;
  }

  .gtav-server-right {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .gtav-server-players {
    flex-direction: row;
    gap: 4px;
    align-items: baseline;
    min-width: auto;
  }

  .gtav-player-count {
    font-size: 18px;
  }

  .gtav-player-limit {
    font-size: 12px;
    margin-top: 0;
  }

  .gtav-server-actions {
    gap: 6px;
  }

  .gtav-connect-button {
    padding: 6px 10px;
    font-size: 11px;
  }

  .gtav-discord-button,
  .gtav-website-button {
    display: none;
  }

  .gtav-servers-title {
    font-size: 20px;
  }

  .total-players-gtav {
    font-size: 13px;
    padding: 8px 14px;
  }

  .player-count-gtav {
    font-size: 16px;
  }

  .gtav-download-container {
    display: none !important;
  }

  .gtav-server-placeholder {
    height: 88px;
  }
}

/* Tablet responsive */
@media screen and (max-width: 1024px) and (min-width: 769px) {
  .gtav-server-info {
    gap: 12px;
  }

  .gtav-server-name-header {
    font-size: 14px;
  }

  .gtav-discord-button,
  .gtav-website-button {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* Enhanced Error Message Styling */
.gtav-error h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #f2f2f2;
}

.gtav-error p {
  margin: 0;
  color: #c58383;
  font-size: 14px;
  font-weight: normal;
}

.gtav-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}
.gtav-modal {
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}
.gtav-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.gtav-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
}
.gtav-modal-title {
  font-family: "Google Sans", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}
.gtav-modal-content {
  color: #bbb;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.gtav-modal-content p {
  margin: 0 0 12px 0;
}
.gtav-modal-content strong {
  color: #e0e0e0;
}
.gtav-modal-steps {
  background: #252525;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
}
.gtav-modal-steps ol {
  margin: 8px 0;
  padding-left: 20px;
}
.gtav-modal-steps li {
  margin: 6px 0;
  color: #ccc;
}
.gtav-modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.gtav-modal-button {
  padding: 10px 20px;
  border-radius: 6px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.gtav-modal-button.primary {
  background: #007aff;
  color: white;
}
.gtav-modal-button.primary:hover {
  background: #0066dd;
}
.gtav-modal-button.secondary {
  background: #333;
  color: #e0e0e0;
  border: 1px solid #444;
}
.gtav-modal-button.secondary:hover {
  background: #3a3a3a;
}
.gtav-download-link {
  color: #007aff;
  text-decoration: none;
  font-weight: 500;
}
.gtav-download-link:hover {
  text-decoration: underline;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 768px) {
  .gtav-modal {
    padding: 20px;
    max-width: 95%;
  }
  .gtav-modal-title {
    font-size: 16px;
  }
  .gtav-modal-content {
    font-size: 13px;
  }
  .gtav-modal-buttons {
    flex-direction: column;
  }
  .gtav-modal-button {
    width: 100%;
  }
}
