/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: 10000;
  box-shadow: var(--shadow-md);
  gap: var(--space-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.topbar-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  z-index: 10;
  transition: transform var(--transition-normal);
}

.topbar-logo.pulsing {
  animation: logo-heartbeat 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px var(--accent-violet));
  cursor: pointer;
}

@keyframes logo-heartbeat {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.topbar-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 44px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.theme-btn {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-btn:hover {
  transform: scale(1.1);
  border-color: var(--border-color);
}

.theme-btn.active {
  border-color: var(--accent-violet);
  box-shadow: 0 0 8px var(--accent-violet);
}

.theme-btn[data-theme="neon"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-btn[data-theme="ocean"] {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
}

.theme-btn[data-theme="forest"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.theme-btn[data-theme="sunset"] {
  background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
}

.theme-btn[data-theme="royal"] {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.theme-btn[data-theme="light"] {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Buttons */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.icon-btn:hover {
  background: var(--hover-bg);
  border-color: var(--border-color);
}

.btn-gradient {
  padding: 10px 24px;
  border-radius: 24px;
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.btn-gradient:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-gradient:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 10px 24px;
  border-radius: 24px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-secondary:hover {
  background: var(--hover-bg);
}

.btn-full {
  width: 100%;
}

.link-btn {
  color: var(--accent-violet);
  font-weight: 500;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.link-btn:hover {
  color: var(--accent-cyan);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  border: 2px solid var(--border-color);
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
}

/* Post Popup (Leaflet) */
.post-popup {
  min-width: 200px;
  max-width: 300px;
}

.post-popup-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.post-popup-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.post-popup-category {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gradient-primary);
  color: white;
}

.post-popup-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin: var(--space-sm) 0;
  line-height: 1.4;
}

.post-popup-media {
  width: 100%;
  height: 150px;
  border-radius: 8px;
  object-fit: cover;
  margin: var(--space-sm) 0;
}

.post-popup-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

.post-popup-user {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  color: var(--text-muted);
}

.post-popup-actions {
  display: flex;
  gap: var(--space-xs);
}

.post-popup-btn {
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.post-popup-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

/* Perfil con actualización disponible (glow suave) */
@keyframes profile-update-glow {
  0% {
    box-shadow: 0 0 0px rgba(34, 197, 94, 0.0), 0 0 0px rgba(34, 197, 94, 0.0);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.6), 0 0 32px rgba(34, 197, 94, 0.4);
    transform: scale(1.06);
  }
  100% {
    box-shadow: 0 0 0px rgba(34, 197, 94, 0.0), 0 0 0px rgba(34, 197, 94, 0.0);
    transform: scale(1);
  }
}

#profileBtn.update-available {
  border-color: rgba(34, 197, 94, 0.7);
  color: #bbf7d0;
  animation: profile-update-glow 1.8s ease-in-out infinite;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 35, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Splash Screen */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 160px;
  height: 160px;
  margin-bottom: 24px;
  animation: splashPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
}

.splash-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  animation: fadeInUp 0.8s ease;
}

.splash-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  animation: fadeInUp 1s ease;
}

.splash-loader {
  width: 200px;
  height: 4px;
  background: rgba(102, 126, 234, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.splash-loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: 2px;
  animation: loadProgress 1.5s ease-out forwards;
}

@keyframes splashPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 30px rgba(102, 126, 234, 0.9));
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loadProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  min-width: 300px;
  padding: var(--space-md);
  border-radius: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: #43e97b;
}

.toast.error {
  border-color: #f5576c;
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.toast-close {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 var(--space-sm);
  }

  .topbar-title {
    display: none;
  }

  .theme-switcher {
    gap: 2px;
  }
  
  .theme-btn {
    width: 9px;
    height: 9px;
  }

  .topbar-logo {
    width: 80px;
    height: 80px;
  }

  .toast-container {
    left: 20px;
    right: 20px;
  }

  .toast {
    min-width: auto;
  }
}

/* Map marker styling */
.custom-marker {
  position: relative;
  transform: translate3d(0, 0, 0);
}

.marker-pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(15, 15, 35, 0.85);
}

.marker-label {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.leaflet-marker-icon.custom-marker {
  background: transparent;
  border: none;
}

/* Ghost visitors: small pulsing light points (Red) - Less intrusive */
.ghost-marker-wrapper {
  background: transparent;
  border: none;
}

.ghost-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 100, 100, 0.6);
  box-shadow: 0 0 4px rgba(255, 0, 0, 0.4);
  animation: ghost-pulse 2s ease-in-out infinite;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes ghost-pulse {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
}

/* Phantom Users (Google Maps imports) */
.phantom-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid #fbbf24; /* Amber border */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: transform var(--transition-fast);
}

.phantom-marker:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
  background: #fffbeb;
}

/* Admin Styles */
.admin-stat-card {
  background: #0f0f15;
  border: 1px solid #333;
  padding: 20px;
  border-radius: 4px;
  color: #0f0;
  font-family: monospace;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.3; }
}