/* ============================
   Quicôté - Global Styles
   Brand: Blue (#0000FF) × White
   ============================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --blue: #0000FF;
  --blue-light: #4444FF;
  --blue-dark: #0000CC;
  --white: #FFFFFF;
  --gray-50: #F8F8FF;
  --gray-100: #F0F0F8;
  --gray-200: #E0E0EE;
  --gray-400: #9999BB;
  --gray-600: #666688;
  --gray-800: #333355;
  --black: #111133;
  --spotify: #1DB954;
  --apple: #FC3C44;
  --radius: 12px;
  --radius-lg: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--black);
  color: var(--black);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================
   Loading Screen
   ============================ */

.loading {
  position: fixed;
  inset: 0;
  background: var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s;
}

.loading-logo {
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--white);
  margin-bottom: 1rem;
}

.loading-text {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================
   App Shell
   ============================ */

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Map（フルスクリーン） */
#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* フローティングヘッダー */
.float-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  pointer-events: none;
}

.header-logo {
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--blue);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 16px;
  border-radius: 50px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  pointer-events: auto;
}

.btn-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.avatar-placeholder {
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 600;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* 現在地ボタン */
.btn-locate {
  position: fixed;
  bottom: 120px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  transition: transform 0.15s;
}

.btn-locate:active {
  transform: scale(0.92);
}

/* Leaflet marker override */
.spot-marker {
  background: var(--blue);
  border: 3px solid var(--white);
  border-radius: 50%;
  width: 28px !important;
  height: 28px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 255, 0.4);
  transition: transform 0.2s;
}

.spot-marker:hover {
  transform: scale(1.2);
}

.spot-marker.nearby {
  background: var(--white);
  border-color: var(--blue);
  animation: pulse-marker 2s infinite;
}

@keyframes pulse-marker {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 255, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(0, 0, 255, 0); }
}

/* User position marker */
.user-marker {
  background: none !important;
  border: none !important;
}

.user-dot {
  width: 14px;
  height: 14px;
  background: var(--blue);
  border: 3px solid var(--white);
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 255, 0.5);
}

.user-ring {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 0, 255, 0.25);
  border-radius: 50%;
  position: absolute;
  top: -10px;
  left: -10px;
  animation: pulse-ring 2s infinite;
}

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

/* Leaflet tooltip override */
.spot-tooltip {
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.spot-tooltip::before {
  border-top-color: var(--black) !important;
}

/* ============================
   Nearby Bar（Zenly風ピル）
   ============================ */

.nearby-bar {
  position: fixed;
  bottom: calc(32px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: slide-up-pill 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slide-up-pill {
  from { transform: translateX(-50%) translateY(80px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

.nearby-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: transform 0.15s;
}

.nearby-pill:active {
  transform: scale(0.95);
}

.nearby-pulse {
  width: 8px;
  height: 8px;
  background: #66AAFF;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(100,170,255,0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(100,170,255,0); }
}

.nearby-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
}

.nearby-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
}

.nearby-arrow {
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

/* ============================
   Modal
   ============================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0 0 calc(20px + var(--safe-bottom));
  animation: slide-up 0.3s ease-out;
  color: var(--black);
}

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

.modal-small {
  padding: 32px 24px calc(32px + var(--safe-bottom));
}

.btn-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 12px 12px 0 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
}

/* Spot Detail */
.spot-photo {
  width: 100%;
  height: 260px;
  background: linear-gradient(135deg, var(--blue) 0%, #4444FF 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}

.spot-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.55) 100%);
}

.spot-photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px 20px;
  z-index: 2;
}

.spot-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  margin: 0;
}

.modal-body {
  padding: 16px 20px 0;
}

.spot-description {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 16px;
  min-height: 4px;
}

/* Distance Badge */
.distance-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.distance-badge.near {
  background: rgba(100, 255, 160, 0.25);
  color: #00CC66;
  border: 1px solid rgba(100, 255, 160, 0.4);
}

.distance-badge.near::before {
  content: '●';
  font-size: 0.5rem;
  animation: pulse-dot 1.5s infinite;
}

.distance-badge.far {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
}

/* Playlist */
.playlist-section {
  padding: 0 20px;
  margin-top: 8px;
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  margin-bottom: 12px;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.track-art {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--gray-200);
  object-fit: cover;
  flex-shrink: 0;
}

.track-info {
  flex: 1;
  min-width: 0;
}

.track-title {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 0.8rem;
  color: var(--gray-600);
}

.track-by {
  font-size: 0.7rem;
  color: var(--gray-400);
  margin-top: 2px;
}

.track-reactions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.reaction-chip {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--gray-100);
  cursor: pointer;
}

.reaction-chip.active {
  background: rgba(0, 0, 255, 0.1);
}

.empty-message {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.9rem;
  padding: 28px 0;
  line-height: 1.8;
}

.empty-message span {
  font-size: 0.8rem;
  color: var(--gray-200);
}

/* Music Links */
.music-links {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-music {
  flex: 1;
  padding: 13px 10px;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 0.1s, opacity 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.02em;
}

.btn-music:active { transform: scale(0.96); opacity: 0.85; }

.btn-spotify { background: var(--spotify); color: var(--white); border-radius: 50px; }
.btn-apple   { background: var(--black);   color: var(--white); border-radius: 50px; }

/* Playlist header */
.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Add Track Inline Button */
.btn-add-inline {
  padding: 5px 14px;
  border: 1.5px solid var(--blue);
  border-radius: 50px;
  background: transparent;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-inline:hover { background: rgba(0,0,255,0.06); }

/* ============================
   Login Modal
   ============================ */

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 24px;
}

.btn-login {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-login:hover {
  background: var(--blue-light);
}

/* ============================
   Utility
   ============================ */

@media (min-width: 481px) {
  .modal-content {
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    max-height: 80vh;
  }
}
