/* ══════════════════════════════════════════════════════════════════
   Game Library – Plugin Styles
   ══════════════════════════════════════════════════════════════════ */

/* Container */
.gl-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Login Bar ── */

.gl-login-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.gl-connect-btn {
  color: #c7d5e0;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.gl-steam-btn {
  background: #1b2838;
  border: 1px solid #2a475e;
}

.gl-steam-btn:hover {
  background: #2a475e;
  color: #fff;
}

.gl-gog-btn {
  background: #2c1a4e;
  border: 1px solid #4a2d7a;
  color: #c7b3e8;
}

.gl-gog-btn:hover {
  background: #3d2566;
  color: #fff;
}

/* ── Profile Chips ── */

.gl-profile-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.gl-profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.gl-profile-chip.selected {
  border-color: #e67e22;
  background: rgba(230,126,34,0.1);
}

.gl-profile-chip:hover {
  background: rgba(255,255,255,0.1);
}

.gl-profile-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.gl-profile-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gl-profile-chip-name {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
}

.gl-profile-chip-platforms {
  display: flex;
  gap: 4px;
}

.gl-profile-chip-count {
  font-size: 11px;
  color: #667;
}

/* ── Platform Badges ── */

.gl-platform-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.gl-platform-badge.steam {
  background: rgba(27,40,56,0.8);
  color: #66c0f4;
  border: 1px solid #2a475e;
}

.gl-platform-badge.gog {
  background: rgba(44,26,78,0.8);
  color: #b388ff;
  border: 1px solid #4a2d7a;
}

/* ── Game Platform Icon ── */

.gl-game-platform-icon {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 6px;
  flex-shrink: 0;
}

.gl-game-platform-icon.steam {
  background: rgba(27,40,56,0.6);
  color: #66c0f4;
}

.gl-game-platform-icon.gog {
  background: rgba(44,26,78,0.6);
  color: #b388ff;
}

/* ── User cards grid (overview) ── */

.gl-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.gl-user-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--bg-tertiary);
}

.gl-user-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.gl-user-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

.gl-user-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-normal);
}

.gl-user-card-games {
  font-size: 13px;
  color: var(--text-faint);
}

.gl-user-card-updated {
  font-size: 11px;
  color: var(--text-faint);
}

/* ── Profile Cards ── */

.gl-profile-card-platforms {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ── Common games finder ── */

.gl-common-finder {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.gl-common-finder h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text-normal);
}

.gl-common-users {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.gl-common-check {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  padding: 6px 12px 6px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.gl-common-check.checked {
  background: rgba(230, 126, 34, 0.15);
}

.gl-common-check input {
  accent-color: var(--accent);
}

.gl-common-check-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.gl-common-find-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition);
}

.gl-common-find-btn:hover {
  filter: brightness(1.1);
}

.gl-common-find-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Search ── */

.gl-search {
  margin-bottom: 24px;
}

.gl-search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--text-normal);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.gl-search-input:focus {
  border-color: var(--accent);
}

.gl-search-input::placeholder {
  color: var(--text-faint);
}

/* ── Game list ── */

.gl-game-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gl-game-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.gl-game-item:hover {
  background: var(--bg-tertiary);
}

.gl-game-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.gl-game-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-normal);
}

.gl-game-playtime {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

.gl-game-owners {
  display: flex;
  gap: 4px;
}

.gl-game-owner-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--bg-tertiary);
}

/* ── Detail header (user view / common view) ── */

.gl-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.gl-back-btn {
  background: var(--bg-secondary);
  border: none;
  color: var(--text-normal);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition);
}

.gl-back-btn:hover {
  background: var(--bg-tertiary);
}

.gl-detail-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.gl-detail-info {
  flex: 1;
}

.gl-detail-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-normal);
}

.gl-detail-sub {
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.gl-refresh-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: color var(--transition);
}

.gl-refresh-btn:hover {
  color: var(--accent);
}

/* ── Link GOG Button ── */

/* ── Disconnect Button ── */

.gl-platform-detail {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.gl-disconnect-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 10px;
  padding: 0 3px;
  line-height: 1;
  border-radius: 3px;
  transition: all 0.2s;
}

.gl-disconnect-btn:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
}

.gl-link-gog-btn {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.gl-link-gog-btn:hover {
  background: rgba(168, 85, 247, 0.25);
}

/* ── Loading ── */

.gl-loading {
  text-align: center;
  padding: 48px;
  color: var(--text-faint);
  font-size: 14px;
}

/* ── Empty state ── */

.gl-empty {
  text-align: center;
  padding: 60px 20px;
}

.gl-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.gl-empty h3 {
  color: var(--text-normal);
  margin: 0 0 8px;
}

.gl-empty p {
  color: var(--text-faint);
  margin: 0;
  font-size: 14px;
}

/* ── Common game playtime chips ── */

.gl-common-playtimes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gl-common-pt {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ── Section title ── */

.gl-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-normal);
  margin: 0 0 12px;
}

/* ── Game count badge ── */

.gl-game-count {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: 8px;
  font-weight: 400;
}

/* ── Common view avatars in header ── */

.gl-detail-avatars {
  display: flex;
  gap: -8px;
}

.gl-detail-avatars img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  margin-left: -8px;
}

.gl-detail-avatars img:first-child {
  margin-left: 0;
}

/* ── Search results section title ── */

.gl-search-results-title {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* ── IGDB Enriched game items ── */

.gl-game-item.enriched {
  align-items: flex-start;
  min-height: 60px;
}

.gl-game-visual {
  flex-shrink: 0;
}

.gl-game-cover {
  width: 45px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
}

.gl-game-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gl-game-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gl-genre-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.gl-game-platforms {
  font-size: 10px;
  color: var(--text-muted, #888);
}

.gl-platform-tag {
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.gl-game-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.gl-game-rating {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 28px;
  text-align: center;
}

.gl-game-rating.high {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

.gl-game-rating.mid {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
}

.gl-game-rating.low {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.gl-enrich-btn {
  background: rgba(52, 152, 219, 0.15);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: #3498db;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.gl-enrich-btn:hover:not(:disabled) {
  background: rgba(52, 152, 219, 0.25);
}

.gl-enrich-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gl-enrich-btn.enriching {
  animation: gl-pulse 1.5s ease-in-out infinite;
}

@keyframes gl-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Filter Bar ── */

.gl-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.gl-filter-bar .gl-search-input {
  flex: 1;
}

.gl-sort-select {
  background: rgba(255, 255, 255, 0.06);
  color: #c7d5e0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  min-width: 120px;
}

.gl-sort-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
}

.gl-sort-select option {
  background: #1a1810;
  color: #c7d5e0;
}

/* ── Genre Filter Chips ── */

.gl-genre-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 0;
}

.gl-genre-chip {
  background: rgba(255, 255, 255, 0.06);
  color: #8899a6;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.gl-genre-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #c7d5e0;
}

.gl-genre-chip.active {
  background: rgba(230, 126, 34, 0.2);
  color: #e67e22;
  border-color: rgba(230, 126, 34, 0.4);
}

.gl-genre-chip.active.clear {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
  border-color: rgba(52, 152, 219, 0.4);
}

.gl-filter-count {
  color: #556;
  font-size: 12px;
  margin: 0 0 8px 0;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .gl-container {
    padding: 12px;
  }

  .gl-users-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .gl-login-bar {
    flex-direction: column;
  }
}

/* ── GOG Code Dialog (browser fallback) ── */
.gl-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.gl-dialog {
  background: #2a2620;
  border-radius: 6px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.gl-dialog h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  color: #fff;
}

.gl-dialog-hint {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 14px;
  line-height: 1.5;
}

.gl-dialog-input {
  width: 100%;
  padding: 10px 12px;
  background: #1a1810;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.gl-dialog-input:focus {
  border-color: #a855f7;
}

.gl-dialog-status {
  margin-top: 8px;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
}

.gl-dialog-status.loading {
  color: #a855f7;
}

.gl-dialog-status.success {
  color: #4caf50;
}

.gl-dialog-status.error {
  color: #e74c3c;
}

.gl-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.gl-dialog-cancel {
  padding: 8px 18px;
  background: #322d26;
  color: #ccc;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.gl-dialog-cancel:hover {
  background: #3a352d;
}

.gl-dialog-submit {
  padding: 8px 18px;
  background: #a855f7;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.gl-dialog-submit:hover:not(:disabled) {
  background: #9333ea;
}

.gl-dialog-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Admin Panel ── */

.gl-login-bar-spacer {
  flex: 1;
}

.gl-admin-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #888;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.gl-admin-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #ccc;
}

.gl-admin-panel {
  background: #2a2620;
  border-radius: 6px;
  padding: 0;
  max-width: 600px;
  width: 92%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.gl-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.gl-admin-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #fff;
}

.gl-admin-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.gl-admin-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.gl-admin-login {
  padding: 20px;
}

.gl-admin-login p {
  color: #aaa;
  margin: 0 0 12px;
  font-size: 14px;
}

.gl-admin-login-row {
  display: flex;
  gap: 8px;
}

.gl-admin-login-btn {
  background: #e67e22;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.gl-admin-login-btn:hover {
  background: #d35400;
}

.gl-admin-content {
  padding: 0;
  overflow-y: auto;
}

.gl-admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.gl-admin-status-text {
  font-size: 13px;
  color: #4caf50;
  flex: 1;
}

.gl-admin-refresh-btn,
.gl-admin-logout-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #aaa;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.gl-admin-refresh-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.gl-admin-logout-btn:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}

.gl-admin-list {
  padding: 8px 12px;
}

.gl-admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}

.gl-admin-item:last-child {
  border-bottom: none;
}

.gl-admin-item:hover {
  background: rgba(255,255,255,0.03);
}

.gl-admin-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gl-admin-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gl-admin-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
}

.gl-admin-item-details {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gl-admin-item-total {
  font-size: 11px;
  color: #667;
}

.gl-admin-delete-btn {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.gl-admin-delete-btn:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.4);
}
