/* EloTracker Auth, Favorites & Game Library UI */

/* Header slot */
.auth-header-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
}

.auth-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-signin-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.dark .auth-signin-btn {
  background: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .auth-signin-btn:hover {
  background: #374151;
  border-color: #6b7280;
}

.auth-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  max-width: 11rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-user-btn:hover {
  background: #f3f4f6;
}

.dark .auth-user-btn {
  background: #1f2937;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .auth-user-btn:hover {
  background: #374151;
}

.auth-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 9999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.auth-user-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: 14rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  padding: 0.35rem;
  z-index: 60;
}

.dark .auth-dropdown {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.auth-dropdown-head {
  padding: 0.5rem 0.65rem 0.55rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.25rem;
}

.dark .auth-dropdown-head {
  border-bottom-color: #374151;
}

.auth-dropdown-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .auth-dropdown-name {
  color: #f9fafb;
}

.auth-dropdown-handle {
  font-size: 0.76rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .auth-dropdown-handle {
  color: #9ca3af;
}

.auth-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  border: 0;
  background: transparent;
  color: #1f2937;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.auth-dropdown-item:hover {
  background: #f3f4f6;
}

.dark .auth-dropdown-item {
  color: #e5e7eb;
}

.dark .auth-dropdown-item:hover {
  background: #374151;
}

.auth-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

.dark .auth-dropdown-divider {
  background: #374151;
}

.auth-dropdown-danger {
  color: #b91c1c;
}

.dark .auth-dropdown-danger {
  color: #fca5a5;
}

/* Auth Modal */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal-backdrop[hidden] {
  display: none !important;
}

.auth-modal-card {
  width: 100%;
  max-width: 26rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  padding: 1.5rem;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}

.dark .auth-modal-card {
  background: #1f2937;
  border-color: #374151;
  color: #f9fafb;
}

.auth-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.dark .auth-modal-close {
  color: #9ca3af;
}

.dark .auth-modal-close:hover {
  background: #374151;
  color: #ffffff;
}

.auth-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.25rem;
}

.dark .auth-modal-title {
  color: #f9fafb;
}

.auth-modal-subtitle {
  font-size: 0.86rem;
  color: #6b7280;
  margin: 0 0 1rem;
}

.dark .auth-modal-subtitle {
  color: #9ca3af;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #f3f4f6;
  border-radius: 0.6rem;
  margin-bottom: 1rem;
}

.dark .auth-tabs {
  background: #111827;
}

.auth-tab {
  border: 0;
  border-radius: 0.45rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
}

.dark .auth-tab {
  color: #9ca3af;
}

.auth-tab.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.dark .auth-tab.is-active {
  background: #374151;
  color: #ffffff;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.62rem 1rem;
  border-radius: 0.55rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.auth-google-btn:hover {
  background: #f9fafb;
}

.dark .auth-google-btn {
  background: #111827;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .auth-google-btn:hover {
  background: #1f2937;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.95rem 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.dark .auth-or::before,
.dark .auth-or::after {
  background: #374151;
}

.auth-field {
  margin-bottom: 0.8rem;
}

.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.auth-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.3rem;
}

.dark .auth-label {
  color: #d1d5db;
}

.auth-input,
.auth-select,
.auth-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.9rem;
  line-height: 1.4;
}

.auth-input:focus,
.auth-select:focus,
.auth-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.dark .auth-input,
.dark .auth-select,
.dark .auth-textarea {
  background: #111827;
  border-color: #4b5563;
  color: #f9fafb;
}

.auth-submit-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.55rem;
  border: 0;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.auth-submit-btn:hover {
  background: #1d4ed8;
}

.auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-link-btn:hover {
  text-decoration: underline;
}

.dark .auth-link-btn {
  color: #60a5fa;
}

.auth-banner {
  padding: 0.65rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.84rem;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.auth-banner-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.dark .auth-banner-error {
  background: rgba(127, 29, 29, 0.35);
  border-color: #991b1b;
  color: #fecaca;
}

.auth-banner-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.dark .auth-banner-success {
  background: rgba(6, 78, 59, 0.35);
  border-color: #047857;
  color: #a7f3d0;
}

/* Player Profile Favorite Button */
.favorite-player-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.65rem;
  padding: 0.32rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.15s ease;
}

.favorite-player-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.dark .favorite-player-btn {
  background: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark .favorite-player-btn:hover {
  background: #374151;
}

.favorite-player-btn.is-favorited {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.dark .favorite-player-btn.is-favorited {
  background: rgba(180, 83, 9, 0.28);
  border-color: #f59e0b;
  color: #fcd34d;
}

.favorite-player-star {
  font-size: 0.95rem;
  line-height: 1;
}

/* Game Viewer Library Widget */
.game-library-widget {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e5e7eb;
}

.dark .game-library-widget {
  border-top-color: #374151;
}

.game-library-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #1f2937;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.game-library-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.dark .game-library-btn {
  background: #111827;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark .game-library-btn:hover {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #dbeafe;
}

.game-library-btn.is-saved {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}

.dark .game-library-btn.is-saved {
  background: rgba(6, 95, 70, 0.32);
  border-color: #10b981;
  color: #6ee7b7;
}

.game-library-editor {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-library-editor[hidden] {
  display: none !important;
}

.game-library-actions {
  display: flex;
  gap: 0.4rem;
}

.game-library-save-btn {
  flex: 1;
  padding: 0.38rem 0.65rem;
  border-radius: 0.45rem;
  border: 0;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.game-library-remove-btn {
  padding: 0.38rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid #fecaca;
  background: transparent;
  color: #b91c1c;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.dark .game-library-remove-btn {
  border-color: #7f1d1d;
  color: #fca5a5;
}

/* Account & Library Hub Layout */
.account-shell {
  max-width: 72rem;
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .account-shell {
    grid-template-columns: 16.5rem 1fr;
    align-items: start;
  }
}

.account-sidebar {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
  padding: 1.25rem 1rem;
}

.dark .account-sidebar {
  background: #1f2937;
  border-color: #374151;
}

.account-profile-head {
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.85rem;
}

.dark .account-profile-head {
  border-bottom-color: #374151;
}

.account-avatar-lg {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.account-display-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.dark .account-display-name {
  color: #f9fafb;
}

.account-handle {
  font-size: 0.82rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.dark .account-handle {
  color: #9ca3af;
}

.account-since {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.35rem;
}

.dark .account-since {
  color: #9ca3af;
}

.account-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.account-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.55rem;
  border: 0;
  background: transparent;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.account-nav-btn:hover {
  background: #f3f4f6;
}

.dark .account-nav-btn {
  color: #d1d5db;
}

.dark .account-nav-btn:hover {
  background: #374151;
}

.account-nav-btn.is-active {
  background: #2563eb;
  color: #ffffff;
}

.account-nav-count {
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(107, 114, 128, 0.16);
}

.account-nav-btn.is-active .account-nav-count {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.account-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
  padding: 1.35rem;
  min-height: 22rem;
}

.dark .account-panel {
  background: #1f2937;
  border-color: #374151;
}

.account-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.dark .account-panel-header {
  border-bottom-color: #374151;
}

.account-panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.dark .account-panel-title {
  color: #f9fafb;
}

.library-folder-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.library-folder-pill {
  padding: 0.32rem 0.72rem;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.dark .library-folder-pill {
  background: #111827;
  border-color: #4b5563;
  color: #d1d5db;
}

.library-folder-pill.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.library-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.dark .library-card {
  border-color: #374151;
  background: #111827;
}

.library-card-main {
  min-width: 14rem;
  flex: 1 1 18rem;
}

.library-card-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  text-decoration: none;
}

.library-card-title:hover {
  color: #2563eb;
}

.dark .library-card-title {
  color: #f9fafb;
}

.dark .library-card-title:hover {
  color: #60a5fa;
}

.library-card-meta {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.2rem;
}

.dark .library-card-meta {
  color: #9ca3af;
}

.library-card-note {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #374151;
  font-style: italic;
}

.dark .library-card-note {
  color: #d1d5db;
}

.library-rating-box {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.library-rating-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.dark .library-rating-val {
  color: #f9fafb;
}

.library-rating-delta.is-up {
  color: #059669;
  font-weight: 600;
  font-size: 0.82rem;
}

.library-rating-delta.is-down {
  color: #dc2626;
  font-weight: 600;
  font-size: 0.82rem;
}

.library-card-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.library-small-btn {
  padding: 0.34rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.library-small-btn:hover {
  background: #f3f4f6;
}

.dark .library-small-btn {
  background: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
}

.library-small-btn.is-danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.dark .library-small-btn.is-danger {
  color: #fca5a5;
  border-color: #7f1d1d;
}

.account-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #6b7280;
}

.dark .account-empty {
  color: #9ca3af;
}

.account-logged-out {
  max-width: 28rem;
  margin: 2rem auto;
  text-align: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 2rem 1.5rem;
}

.dark .account-logged-out {
  background: #1f2937;
  border-color: #374151;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 36rem;
}

.account-section-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.75rem;
}

.dark .account-section-heading {
  color: #f9fafb;
}

/* Toast */
.auth-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 90;
  background: #111827;
  color: #ffffff;
  padding: 0.65rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dark .auth-toast {
  background: #f9fafb;
  color: #111827;
}
