/* Authentication Button */
.auth-button {
  position: fixed;
  bottom: 250px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1000;
  font-size: 24px;
  color: #333;
}

.auth-button:hover {
  background: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.auth-button.authenticated {
  background: linear-gradient(135deg, #4caf4f4b, #45a049df);
  color: white;
  border-color: #4CAF50;
}

/* Mobile positioning adjustments */
@media (max-width: 768px) {
  .auth-button {
    top: 10px;
    left: 10px;
    bottom: auto;
    right: auto;
    width: 45px;
    height: 45px;
    font-size: 20px;
    z-index: 1001; /* Ensure it's above map controls */
  }
}

/* Authentication Modal */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.auth-window {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(74,158,255,0.07);
  width: 100%;
  max-width: 400px;
  margin: 20px;
  overflow: hidden;
  animation: authModalSlideIn 0.3s ease-out;
  padding-top: 1.5em;
  padding-bottom: 1.2em;
  padding-left: 1.2em;
  padding-right: 1.2em;
}

/* Logo at top of auth modal, matching About popup */
.popup-logo {
  display: block;
  margin: 0 auto 1.1em auto;
  width: 70px;
  height: 70px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(74,158,255,0.07);
  background: #f6fbff;
}

@keyframes authModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.auth-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.auth-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.auth-close:hover {
  background: #f5f5f5;
  color: #333;
}

.auth-content {
  padding: 24px;
}

/* Auth Toggle Buttons */
.auth-toggle {
  display: flex;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-toggle-btn.active {
  background: white;
  color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Auth Form */
.auth-form {
  margin-bottom: 24px;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.auth-form input:focus {
  outline: none;
  border-color: #4CAF50;
}

.auth-form input::placeholder {
  color: #9ca3af;
}

.auth-submit {
  width: 100%;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-submit:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

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

/* Forgot Password Link */
.forgot-password-link {
  display: block;
  text-align: center;
  margin: 12px 0;
  color: #4CAF50;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.forgot-password-link:hover {
  color: #45a049;
  text-decoration: underline;
}

/* Secondary Button (for forgot password, cancel, etc.) */
.auth-secondary {
  width: 100%;
  background: transparent;
  color: #666;
  border: 2px solid #e1e5e9;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.auth-secondary:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #333;
}

/* Auth Toggle Links */
.auth-toggle-link {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: #666;
}

.auth-toggle-link a {
  color: #4CAF50;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

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

/* OAuth Divider */
.auth-divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
  color: #9ca3af;
  font-size: 14px;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e1e5e9;
  z-index: 1;
}

.auth-divider span {
  background: white;
  padding: 0 16px;
  position: relative;
  z-index: 2;
}

/* Google Auth Button */
.auth-google {
  width: 100%;
  background: white;
  color: #333;
  border: 2px solid #e1e5e9;
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.auth-google:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-google i {
  font-size: 18px;
  color: #ea4335;
}

/* Auth Messages */
.auth-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.auth-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.auth-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.auth-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* User Info Display (when logged in) */
.user-info {
  position: fixed;
  bottom: 310px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  z-index: 999;
  max-width: 250px;
  font-size: 14px;
  display: none;
  backdrop-filter: blur(8px);
}

.user-info.show {
  display: block;
  animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-email {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

/* When the same user-info is rendered inside the profile side-panel popup
   the popup uses a darker/translucent background. Ensure the email text
   is light and readable in that context without affecting the right-side
   user-info popup which is white. */
#profile-panel-popup .user-email,
.profile-panel-popup .user-email {
  color: #f1f5f9; /* light slate */
}

.user-actions {
  display: flex;
  gap: 8px;
}

.user-action-btn {
  background: #f8f9fa;
  border: 1px solid #e1e5e9;
  color: #666;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-action-btn:hover {
  background: #e9ecef;
  color: #333;
}

.user-action-btn.logout {
  color: #dc3545;
  border-color: #f5c6cb;
}

.user-action-btn.logout:hover {
  background: #f8d7da;
  border-color: #dc3545;
}

/* Loading States */
.auth-submit.loading,
.auth-google.loading {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}

.auth-submit.loading::after,
.auth-google.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .auth-window {
    margin: 10px;
    border-radius: 12px;
  }
  
  .auth-header {
    padding: 20px 20px 12px;
  }
  
  .auth-content {
    padding: 20px;
  }
  
  .user-info {
    right: 15px;
    bottom: 300px;
    max-width: 200px;
  }
}
