/* Minimal styling for shared top nav / profile dropdown */
.top-nav {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 999;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-grid-line);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-family-sans);
  color: var(--color-text-primary);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.nav-brand {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: 1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--color-text-primary);
}

.profile {
  position: relative;
}

.profile-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-elevated);
  position: relative;
  overflow: hidden;
}

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

/* When showing a letter, hide the image */
.profile-avatar[data-letter]:not([data-letter=""]) img {
  display: none;
}

/* Letter avatar styling */
.profile-avatar[data-letter]:not([data-letter=""])::before {
  content: attr(data-letter);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-transform: uppercase;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-ui-border);
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  padding: 0.5rem;
  min-width: 200px;
  box-sizing: border-box;
  display: none; /* hidden by default; visibility controlled via .open class */
}

/* Force-visible when open via class (overrides browser 'hidden' UA style) */
.profile-dropdown.open { display: block !important; }

.profile-info {
  padding: 0.5rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-grid-line);
  margin-bottom: 0.5rem;
}

.profile-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.profile-email {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.profile-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-verified {
  background: #3b82f6;
  color: white;
}

.badge-premium {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1f2937;
}

.profile-actions .btn,
.profile-actions a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--color-text-primary);
  text-decoration: none;
  box-sizing: border-box;
}

.profile-actions .btn:hover,
.profile-actions a:hover {
  background: var(--color-surface);
  border-radius: 4px;
}

.profile-actions hr {
  margin: 0.4rem 0;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.04);
}

@media (max-width: 520px) {
  .nav-inner { padding: 0.5rem; }
  .profile-avatar { width: 32px; height: 32px; }
  .profile-dropdown { min-width: 180px; right: 6px; }
}

/* Side menu sliding panel */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 300px;
  max-width: 90vw;
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 220ms ease;
  z-index: 9999;
  padding: 1rem;
  box-sizing: border-box;
  display: block; /* kept in DOM for accessibility; hidden visually via transform */
}
.side-menu.open {
  transform: translateX(0);
}
.side-menu .side-menu-close-btn {
  font-size: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* prevent body scroll when menu open */
.no-scroll { overflow: hidden !important; }

/* Inline login panel styles inside dropdown */
.login-panel { padding: 0.5rem 0.25rem; }
.menu-login-form input[type="email"],
.menu-login-form input[type="password"] {
  width: 100%;
  padding: 0.45rem 0.5rem;
  margin: 0.35rem 0 0.5rem 0;
  border: 1px solid var(--color-grid-line);
  border-radius: 6px;
  box-sizing: border-box;
  background: var(--color-surface);
  color: var(--color-text-primary);
}
.menu-login-form .login-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.login-error { color: var(--color-error); font-size: 0.9rem; margin-top: 0.5rem; }

/* Menu-specific link/button styles */
.btn-link {
  background: transparent;
  border: none;
  color: var(--color-primary);
  padding: 0;
  text-align: left;
}

.side-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.side-menu-list a {
  display: inline-block;
  padding: 0.6rem 0.4rem;
  color: var(--color-text-primary);
  text-decoration: none;
}

.donate-btn {
  display: inline-block;
  margin-top: 0.5rem;
}

/* small util for screen-reader only text */
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Login Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none; /* Start hidden */
  align-items: center;
  justify-content: center;
  z-index: 1300;
}

.modal-overlay.visible {
  display: flex; /* Show when visible class is added */
}

.modal {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--color-grid-line);
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 0.25rem;
}

.modal-content {
  padding: 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: var(--color-text-primary);
}

.form-group input {
  padding: 0.75rem;
  border: 1px solid var(--color-grid-line);
  border-radius: 4px;
  font-size: 1rem;
  background: var(--color-background);
  color: var(--color-text-primary);
}

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

.turnstile-container {
  display: flex;
  justify-content: center;
  min-height: 65px; /* Space for Turnstile widget */
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.login-error {
  color: var(--color-error, #e74c3c);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Toast notifications for auth feedback */
.auth-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 400px;
  pointer-events: none;
}

.auth-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.auth-toast-error {
  background: #fee;
  color: #c00;
  border-left: 4px solid #c00;
}

.auth-toast-success {
  background: #efe;
  color: #060;
  border-left: 4px solid #060;
}

@media (max-width: 520px) {
  .auth-toast {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
