/* ==========================================================================
   USER SYSTEM (LOCALSTORAGE) STYLES
   ========================================================================== */

/* Header Widget */
#user-widget-container {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.user-widget-login {
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
}

.user-widget.logged-in {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-soft);
}

.user-widget.logged-in:hover {
  background: var(--surface-active);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft-hover);
}

.user-avatar {
  background: var(--surface-search);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
  border: 1px solid var(--line);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.1;
}

.user-level {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
}

/* XP Animation */
.xp-flyup {
  position: fixed;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 0 10px white;
  pointer-events: none;
  z-index: 1000;
  animation: flyup 1.5s ease-out forwards;
}

@keyframes flyup {
  0% { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
  20% { transform: translate(-50%, -10px) scale(1.2); opacity: 1; }
  80% { transform: translate(-50%, -40px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50px) scale(1); opacity: 0; }
}

/* Login Modal */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.login-modal {
  background: var(--background);
  border: 2px solid var(--border-light);
  border-radius: 24px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  position: relative;
  text-align: center;
  animation: modalPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalPopIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.login-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s;
}

.login-modal-close:hover {
  color: var(--critical);
}

.login-modal h2 {
  color: var(--accent-strong);
  font-family: var(--font-heading);
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.login-modal p {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  text-align: left;
}

.login-form label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: -0.8rem;
}

.login-form input {
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border-light);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-form input:focus {
  border-color: var(--accent);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.avatar-option {
  font-size: 2rem;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-option:hover {
  background: var(--surface-active);
  transform: translateY(-2px);
}

.avatar-option.selected {
  border-color: var(--accent);
  background: var(--surface-success);
  box-shadow: 0 4px 12px rgba(45, 90, 60, 0.15);
  transform: translateY(-2px);
}

#login-submit {
  margin-top: 1rem;
}

#login-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* User Mini Stats in Header */
.user-stats-mini {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.user-mini-coin, .user-mini-streak {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(0,0,0,0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.user-mini-streak {
  color: #d68910;
  background: #fef0d9;
}

/* Achievement Toast */
.achievement-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-active);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 10000;
  animation: toastSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: all 0.3s ease;
}

@keyframes toastSlideUp {
  from { transform: translate(-50%, 100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.ach-icon {
  font-size: 2rem;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.ach-text {
  display: flex;
  flex-direction: column;
}

.ach-text strong {
  color: var(--gold-dark);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ach-text span {
  font-family: var(--font-heading);
  color: var(--primary-dark);
  font-size: 1.2rem;
}

