/**
 * GameHub - Profile, Auth, Downloads & Favorites Styles
 * Avatar, halaman profil, form login, daftar item, dan menu titik tiga.
 */

/* ===== Avatar (header & bottom nav) ===== */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  border: 1.5px solid transparent;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bottom-nav__item.active .avatar {
  border-color: var(--primary);
}

.header__btn .avatar {
  width: 24px;
  height: 24px;
}

/* ===== Profile Header (logged out) ===== */
.profile-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-md) var(--space-lg);
}

.profile-guest__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.profile-guest__icon svg {
  width: 28px;
  height: 28px;
}

.profile-guest__title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-guest__message {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  max-width: 260px;
  margin-bottom: var(--space-lg);
}

/* ===== Profile Card (logged in) ===== */
.profile-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-md);
}

.profile-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card__info {
  min-width: 0;
}

.profile-card__name {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-card__email {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Profile Stats ===== */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 var(--space-md) var(--space-lg);
}

.profile-stats__item {
  background: var(--bg-card);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.profile-stats__item:hover {
  background: var(--bg-card-hover);
}

.profile-stats__value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 2px;
}

.profile-stats__label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ===== Profile Menu List ===== */
.profile-menu {
  padding: 0 var(--space-md);
}

.profile-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.profile-menu__item:hover {
  color: var(--text-primary);
}

.profile-menu__item:last-child {
  border-bottom: none;
}

.profile-menu__item svg {
  width: 19px;
  height: 19px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.profile-menu__item span {
  flex: 1;
  font-size: 0.9375rem;
}

.profile-menu__item .chevron {
  width: 16px;
  height: 16px;
  color: var(--text-disabled);
}

.profile-menu__item--danger {
  color: var(--danger);
}

.profile-menu__item--danger svg {
  color: var(--danger);
}

/* ===== Auth Form ===== */
.auth-form {
  padding: 0 var(--space-md) var(--space-2xl);
  max-width: 380px;
  margin: 0 auto;
  width: 100%;
}

.auth-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-lg);
}

.auth-tabs__btn {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.auth-tabs__btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.form-field {
  margin-bottom: var(--space-md);
}

.form-field label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-field input {
  width: 100%;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 var(--space-md);
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-field--error input {
  border-color: var(--danger);
}

.form-field__error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-field--error .form-field__error {
  display: block;
}

.auth-form__submit {
  margin-top: var(--space-sm);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-disabled);
  font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.btn--google {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn--google:hover {
  background: var(--bg-elevated);
}

.btn--google svg {
  width: 18px;
  height: 18px;
}

.auth-form__note {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-top: var(--space-lg);
}

.auth-form__error {
  background: var(--danger-light);
  color: var(--danger);
  font-size: 0.8125rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  display: none;
}

.auth-form__error.visible {
  display: block;
}

/* ===== List Page (Downloads / Favorites) ===== */
.list-page__header {
  padding: var(--space-lg) var(--space-md) var(--space-md);
}

.list-page__title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.list-page__subtitle {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.list-page__body {
  padding: 0 var(--space-md) var(--space-xl);
}

/* ===== List Item with 3-dot menu ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

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

.list-item__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.list-item__info {
  flex: 1;
  min-width: 0;
}

.list-item__title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-item__status {
  color: var(--success);
}

.list-item__more {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.list-item__more:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.list-item__more svg {
  width: 18px;
  height: 18px;
}

/* ===== Context Menu (dropdown from 3-dot) ===== */
.context-menu {
  position: fixed;
  z-index: var(--z-modal);
  min-width: 190px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.context-menu.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.context-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 10px var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--transition-fast);
}

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

.context-menu__item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.context-menu__item--danger {
  color: var(--danger);
}

.context-menu__item--danger svg {
  color: var(--danger);
}

.context-menu__item--danger:hover {
  background: var(--danger-light);
}

.context-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) - 1);
  display: none;
}

.context-menu__backdrop.active {
  display: block;
}

/* ===== Empty state small variant reuse ===== */
.list-page .empty-state {
  padding: var(--space-2xl) var(--space-md);
}

/* ===== Firebase config notice ===== */
.config-notice {
  margin: var(--space-md);
  padding: var(--space-md);
  background: var(--warning);
  color: #1a1a1a;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.config-notice code {
  background: rgba(0, 0, 0, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .list-page__body,
  .list-page__header,
  .profile-menu,
  .auth-form {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
}
