/* Professional Auth System - Glass Design */
#auth-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: authFadeIn 0.3s ease-out;
}

#auth-modal.show {
  display: flex;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 16, 32, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-container {
  position: relative;
  width: min(480px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: authSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Custom scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.auth-container::-webkit-scrollbar {
  width: 6px;
}

.auth-container::-webkit-scrollbar-track {
  background: transparent;
}

.auth-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.auth-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  display: flex;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.auth-logo {
  font-size: 32px;
  margin-right: 16px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.auth-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #6da3ff, #9c6dff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-title p {
  margin: 2px 0 0;
  font-size: 14px;
  opacity: 0.7;
  font-weight: 500;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  transform: scale(1.1);
}

.auth-content {
  padding: 24px;
}

.auth-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card {
  display: flex;
  align-items: center;
  padding: 20px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-card:hover::before {
  opacity: 1;
}

.auth-card:active {
  transform: translateY(0) scale(0.98);
}

.guest-card:hover {
  border-color: var(--warn);
  box-shadow: 0 8px 32px rgba(255, 209, 102, 0.2);
}

.premium-card:hover {
  border-color: var(--good);
  box-shadow: 0 8px 32px rgba(87, 227, 159, 0.2);
}

.login-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(109, 163, 255, 0.2);
}

.auth-card-icon {
  font-size: 28px;
  margin-right: 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.auth-card-content h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.auth-card-content p {
  margin: 0 0 8px;
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.4;
}

.auth-card-note {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: inline-block;
}

.guest-card .auth-card-note {
  color: var(--warn);
  background: rgba(255, 209, 102, 0.15);
}

.premium-card .auth-card-note {
  color: var(--good);
  background: rgba(87, 227, 159, 0.15);
}

.login-card .auth-card-note {
  color: var(--accent);
  background: rgba(109, 163, 255, 0.15);
}

/* Form Styles */
.auth-form {
  max-width: 100%;
}

.auth-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 16px;
  transition: color 0.2s ease;
}

.auth-back:hover {
  color: var(--fg);
}

.auth-form h3 {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.google-auth-btn {
  width: 100%;
  padding: 16px;
  background: #4285f4;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
  margin-bottom: 20px;
}

.google-auth-btn:hover {
  background: #3367d6;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.3);
}

.google-icon {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.google-icon svg {
  width: 16px;
  height: 16px;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
  font-size: 14px;
  color: var(--muted);
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.auth-divider span {
  background: var(--glass);
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

.auth-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.auth-inputs input {
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.auth-inputs input::placeholder {
  color: var(--muted);
}

.auth-inputs input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(109, 163, 255, 0.1);
}

.auth-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(109, 163, 255, 0.3);
}

.auth-submit:active {
  transform: translateY(0);
}

/* User Info Display */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

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

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.logout-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  z-index: 10001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  background: rgba(87, 227, 159, 0.9);
}

.toast-error {
  background: rgba(255, 107, 136, 0.9);
}

.toast-warning {
  background: rgba(255, 209, 102, 0.9);
}

.toast-info {
  background: rgba(109, 163, 255, 0.9);
}

/* Responsive Design */
@media (max-width: 480px) {
  .auth-container {
    width: 95vw;
    margin: 0 auto;
  }
  
  .auth-header {
    padding: 16px 20px 12px;
  }
  
  .auth-content {
    padding: 20px;
  }
  
  .auth-card {
    padding: 16px;
  }
  
  .auth-card-icon {
    font-size: 24px;
    margin-right: 12px;
  }
  
  .auth-card-content h3 {
    font-size: 16px;
  }
  
  .auth-card-content p {
    font-size: 13px;
  }
}

/* Animation for showing auth modal */
@keyframes slideInAuth {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enhanced Settings Modal Styles */
.settings-section {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0;
}

.settings-section:last-child {
  border-bottom: none;
}

/* Settings Modal Scrollability */
#settingsModal .modal-content {
  max-height: 85vh;
}

#settingsModal .modal-body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#settingsModal .modal-body::-webkit-scrollbar {
  width: 6px;
}

#settingsModal .modal-body::-webkit-scrollbar-track {
  background: transparent;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#settingsModal .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.settings-section h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.settings-section h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

/* Account Info Styles */
.account-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-card {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  gap: 16px;
}

.account-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 18px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

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

.account-details {
  flex: 1;
}

.account-type {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.account-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.account-desc, .account-email {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 2px;
}

.account-created {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

.create-account-btn, .account-menu-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-account-btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

.account-menu-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.account-warning, .account-benefits {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.account-warning {
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.3);
  color: var(--warn);
}

.account-benefits {
  background: rgba(87, 227, 159, 0.1);
  border: 1px solid rgba(87, 227, 159, 0.3);
  color: var(--good);
}

.warning-icon, .benefit-icon {
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Account Menu */
.account-menu {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 8px;
  margin-top: 8px;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-align: left;
}

.account-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.account-menu-item.danger {
  color: var(--bad);
}

.account-menu-item.danger:hover {
  background: rgba(255, 107, 136, 0.1);
}

.menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Save Status */
.save-status {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.save-status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.save-status-item:last-child {
  margin-bottom: 12px;
}

.status-label {
  font-size: 14px;
  color: var(--muted);
}

.status-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.status-value.enabled {
  color: var(--good);
}

.save-now-btn {
  width: 100%;
  padding: 10px;
  background: var(--good);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-now-btn:hover {
  background: #45d084;
  transform: translateY(-1px);
}

/* Reset Section */
.reset-section {
  background: var(--card);
  border: 1px solid rgba(255, 107, 136, 0.3);
  border-radius: 12px;
  padding: 16px;
}

.reset-info {
  margin-bottom: 16px;
}

.reset-info .hint {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

/* Game Settings */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.setting-item label {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.setting-item input[type="checkbox"] {
  width: 44px;
  height: 24px;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-item input[type="checkbox"]:checked {
  background: var(--accent);
}

.setting-item input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.setting-item input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

/* Profile Update Modal Styles */
.profile-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  background: rgba(11, 16, 32, 0.9);
  backdrop-filter: blur(8px);
}

.profile-modal.show {
  display: flex;
}

.profile-form {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  width: min(400px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
}

.profile-form h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.profile-form .auth-inputs {
  margin-bottom: 20px;
}

.profile-form .auth-inputs input {
  margin-bottom: 12px;
}

.profile-form-actions {
  display: flex;
  gap: 12px;
}

.profile-form-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-form-actions .save-btn {
  background: var(--accent);
  color: white;
}

.profile-form-actions .save-btn:hover {
  background: var(--accent-2);
}

.profile-form-actions .cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-form-actions .cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
