/* ==================== BASE & RESET ==================== */
@layer base {
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hide scrollbar but allow scroll */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==================== SPLASH SCREEN ==================== */
.splash-bg {
  background: #1a0e08;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 80%, rgba(255,107,53,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 80% 20%, rgba(229,90,37,0.1) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(255,140,90,0.06) 0%, transparent 50%);
}

.splash-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 0;
}

.splash-content {
  animation: splashFadeIn 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 1;
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.splash-orb-1 {
  width: 300px; height: 300px;
  background: rgba(255,107,53,0.12);
  top: -80px; left: -60px;
  animation: orbFloat1 8s ease-in-out infinite;
}
.splash-orb-2 {
  width: 200px; height: 200px;
  background: rgba(255,209,102,0.08);
  bottom: -40px; right: -40px;
  animation: orbFloat2 10s ease-in-out infinite;
}
.splash-orb-3 {
  width: 150px; height: 150px;
  background: rgba(255,140,90,0.1);
  top: 40%; right: 10%;
  animation: orbFloat3 7s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, 30px) scale(1.1); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-25px, -20px) scale(1.05); }
}
@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-15px, 15px); }
}

.splash-title {
  background: linear-gradient(135deg, #fff 0%, #ffd6c0 50%, #ffaa80 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-campus-btn {
  position: relative;
  background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.splash-campus-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,107,53,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.splash-campus-btn:hover {
  border-color: rgba(255,107,53,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,107,53,0.15), 0 2px 8px rgba(0,0,0,0.3);
}

.splash-campus-btn:hover::before {
  opacity: 1;
}

.splash-campus-btn:active {
  transform: translateY(0px) scale(0.98);
}

.splash-emoji-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  transition: all 0.35s ease;
}

.splash-campus-btn:hover .splash-emoji-ring {
  background: rgba(255,107,53,0.15);
  border-color: rgba(255,107,53,0.3);
  box-shadow: 0 0 20px rgba(255,107,53,0.15);
}

.splash-campus-stagger-1 { animation-delay: 0.05s; }
.splash-campus-stagger-2 { animation-delay: 0.12s; }
.splash-campus-stagger-3 { animation-delay: 0.19s; }
.splash-campus-stagger-4 { animation-delay: 0.26s; }
.splash-campus-stagger-5 { animation-delay: 0.33s; }

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

.splash-campus-animate {
  opacity: 0;
  animation: campusSlideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.animate-bounce-slow {
  animation: bounce-slow 2s ease-in-out infinite;
}

.splash-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,107,53,0.3) 50%, transparent 100%);
}

.splash-skip {
  color: rgba(255,255,255,0.35);
  transition: color 0.3s ease;
  letter-spacing: 0.05em;
}

.splash-skip:hover {
  color: rgba(255,255,255,0.7);
}

/* ==================== MAP STYLES ==================== */
#map {
  background: #f0f0f0;
}

.dark #map {
  background: #1a1a2e;
}

/* Custom Map Popups */
.leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 220px !important;
}

.leaflet-popup-tip {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.popup-card {
  cursor: pointer;
}

.popup-card-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.popup-card-body {
  padding: 12px;
}

.popup-card-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1a1a1a;
}

.popup-card-meta {
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-card-rating {
  color: #f59e0b;
  font-weight: 700;
}

.popup-card-btn {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  background: #FF6B35;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.popup-card-btn:hover {
  background: #E55A25;
}

/* Custom Marker Styles */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  border: 2px solid white;
  transition: transform 0.2s, box-shadow 0.2s;
}

.custom-marker:hover {
  transform: rotate(-45deg) scale(1.2);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.custom-marker span {
  transform: rotate(45deg);
  font-size: 16px;
  line-height: 1;
}

.custom-marker.highlighted {
  transform: rotate(-45deg) scale(1.3);
  box-shadow: 0 5px 20px rgba(255, 107, 53, 0.5);
  z-index: 9999 !important;
}

/* Campus Marker Bounce Animation */
.campus-marker-icon {
  animation: campusBounce 2s ease-in-out infinite;
}
@keyframes campusBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Marker Cluster Styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(255, 107, 53, 0.2) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: #FF6B35 !important;
  color: white !important;
  font-weight: 700;
  font-size: 13px;
}

/* ==================== BOTTOM SHEET ==================== */
.bottom-sheet-handle {
  touch-action: none;
}

/* ==================== RANDOM PICK ==================== */
.random-pick-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: transform 0.1s linear;
}

.random-pick-card {
  width: 80%;
  padding: 16px;
  margin: 8px 0;
  background: white;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.random-pick-card.active {
  background: linear-gradient(135deg, #FF6B35, #FF8C5A);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
}

@keyframes spinCards {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

/* ==================== DETAIL PANEL ==================== */
.detail-swiper .swiper-pagination-bullet {
  background: white !important;
  opacity: 0.5;
}

.detail-swiper .swiper-pagination-bullet-active {
  opacity: 1 !important;
  width: 20px;
  border-radius: 4px;
}

/* ==================== DARK MODE ==================== */
.dark .leaflet-popup-content-wrapper {
  background: #1E293B !important;
}

.dark .leaflet-popup-tip {
  background: #1E293B !important;
}

.dark .popup-card-name {
  color: #f1f5f9;
}

.dark .popup-card-meta {
  color: #94a3b8;
}

.dark .popup-card-body {
  background: #1E293B;
}

.dark .leaflet-control-zoom a {
  background: #1E293B !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

.dark .leaflet-control-attribution {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #94a3b8 !important;
}

.dark .leaflet-control-attribution a {
  color: #64748b !important;
}

/* ==================== TRANSITIONS ==================== */
.slide-up-enter-active,
.slide-up-leave-active {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-up-enter-from,
.slide-up-leave-to {
  transform: translateY(100%);
}

/* ==================== CUSTOM SCROLLBAR (Desktop) ==================== */
@media (min-width: 1024px) {
  ::-webkit-scrollbar {
    width: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
  }

  .dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
  }

  .dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
  }
}

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

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid currentColor;
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* ==================== USER LOCATION ==================== */
.user-location-dot {
  width: 16px;
  height: 16px;
  background: #4285F4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.5);
  position: relative;
}

.user-location-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(66, 133, 244, 0.15);
  border-radius: 50%;
  animation: userLocationPulse 2s ease-out infinite;
}

@keyframes userLocationPulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.2s forwards;
  white-space: nowrap;
}

.toast-success { background: rgba(34, 197, 94, 0.9); }
.toast-error { background: rgba(239, 68, 68, 0.9); }
.toast-info { background: rgba(59, 130, 246, 0.9); }

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

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

/* ==================== LEAFLET FIX ==================== */
.leaflet-container {
  font-family: inherit !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
  border-radius: 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}
