/* ==========================================================================
   Authentication & User Profile Styles - Global Trail Explorer
   ========================================================================== */

/* Full-Screen Auth Gate Overlay */
#authOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: radial-gradient(circle at 50% 20%, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98)),
              url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M0 80 L30 50 L60 70 L100 30 L100 100 L0 100 Z" fill="rgba(255,255,255,0.02)"/></svg>');
  background-size: cover;
  backdrop-filter: blur(20px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#authOverlay.hidden,
html.user-authenticated #authOverlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none !important;
}

/* Auth Card */
.auth-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  max-width: 460px;
  width: 100%;
  padding: 32px 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: authCardEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardEntrance {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(234, 88, 12, 0.15);
  border: 1px solid rgba(234, 88, 12, 0.4);
  color: #fb923c;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin: 4px 0 0 0;
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* Tab Switcher (Sign In / Create Account) */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tab-btn {
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.auth-tab-btn.active {
  background: var(--primary, #ea580c);
  color: white;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.35);
}

/* Auth Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-form-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.auth-form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: white;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  display: none;
}

.auth-error-msg.visible {
  display: block;
}

.btn-auth-submit {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
  margin-top: 4px;
}

.btn-auth-submit:hover {
  background: linear-gradient(135deg, #fb923c, #f97316);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
}

/* Demo Logins Section */
.auth-demo-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

.auth-demo-divider::before, .auth-demo-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-demo-divider:not(:empty)::before { margin-right: 10px; }
.auth-demo-divider:not(:empty)::after { margin-left: 10px; }

.auth-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-demo-login {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  transition: all 0.2s ease;
  text-align: left;
}

.btn-demo-login:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.btn-demo-login .demo-avatar {
  font-size: 1.3rem;
  line-height: 1;
}

.btn-demo-login .demo-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.btn-demo-login .demo-name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-demo-login .demo-role {
  font-size: 0.65rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* Guest / Offline Access Button */
.btn-guest-access {
  background: transparent;
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 9px;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-guest-access:hover {
  border-color: #94a3b8;
  color: white;
  background: rgba(255, 255, 255, 0.04);
}

/* Top Navigation User Profile Badge & Dropdown Menu */
.user-profile-badge-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 5px 12px 5px 6px;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.78rem;
  font-weight: 700;
  user-select: none;
}

.user-profile-badge:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #f97316;
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  line-height: 1;
}

.user-badge-pill {
  background: #ea580c;
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Profile Dropdown Menu */
.user-profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 10000;
  animation: menuDrop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-profile-menu.open {
  display: flex;
}

@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-menu-header {
  padding: 8px 10px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-menu-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
}

.profile-menu-email {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.profile-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.profile-menu-item.logout {
  color: #f87171;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
  padding-top: 8px;
}

.profile-menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.profile-menu-item.admin-link {
  color: #fb923c;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.profile-menu-item.admin-link:hover {
  background: rgba(234, 88, 12, 0.15);
  color: #fdba74;
}

/* ==========================================================================
   Admin Portal Dashboard Modal Styles
   ========================================================================== */
.admin-modal-container {
  max-width: 820px !important;
  width: 95% !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0 16px 0;
}

.admin-stat-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-stat-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
}

.admin-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.admin-search-input {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: white;
  font-size: 0.82rem;
  outline: none;
}

.admin-search-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.admin-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.5);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.admin-table th {
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-avatar {
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  background: #334155;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
}

.role-badge.admin {
  background: #ef4444;
  color: white;
}

.role-badge.demo {
  background: #f97316;
  color: white;
}

.role-badge.member {
  background: #10b981;
  color: white;
}

.role-badge.guest {
  background: #64748b;
  color: white;
}

.btn-delete-user {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-user:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-1px);
}

.btn-delete-user:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #64748b;
}

/* Admin Dashboard Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.admin-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.admin-tab-btn.active {
  background: var(--primary, #ea580c);
  color: white;
  border-color: #ea580c;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.3);
}

.admin-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-feedback-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  display: none;
}

.admin-feedback-banner.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.admin-feedback-banner.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
