@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg: #fafaf9;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f5f5f4;
  --bg-input: #f5f5f4;
  --text: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --border: #e7e5e4;
  --border-light: #f5f5f4;
  --danger: #ef4444;
  --success: #22c55e;
  --heart: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

/* ===== HEADER ===== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.header-left {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #f97316;
  letter-spacing: -0.5px;
}

.header-username {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  gap: 2px;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px;
  cursor: pointer;
  border-radius: 12px;
  position: relative;
  transition: all 0.2s;
  display: none; /* hidden on mobile, use bottom nav instead */
}

#notif-btn {
  display: flex; /* always visible, even on mobile */
}

.header-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.header-btn.notif-active {
  color: var(--primary);
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid white;
}

/* ===== BOTTOM NAV (mobile) ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
}

.nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ===== VIEWS ===== */
.view {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.active {
  display: block;
  overflow-y: auto;
}

#view-map.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-content {
  padding: 20px;
  padding-bottom: 20px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ===== MAP ===== */
#map {
  height: 50vh;
  min-height: 280px;
  flex-shrink: 0;
  position: relative;
}

/* Map markers — photo thumbnails */
.post-marker-photo {
  background: none !important;
  border: none !important;
}
.post-marker-photo img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid white;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
  display: block;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.post-marker-photo:hover img {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
}
.post-marker-photo .marker-tail {
  width: 10px;
  height: 10px;
  background: white;
  position: absolute;
  bottom: 2px;
  left: 50%;
  margin-left: -5px;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.15);
  z-index: -1;
}

/* Map markers — text-only bubbles */
.post-marker-text {
  background: none !important;
  border: none !important;
}
.post-marker-text .marker-bubble {
  background: white;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-marker-text:hover .marker-bubble {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.04);
}
.post-marker-text .marker-tail {
  width: 8px;
  height: 8px;
  background: white;
  position: absolute;
  bottom: 6px;
  left: 50%;
  margin-left: -4px;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  z-index: -1;
}

/* User location marker */
.user-marker .user-dot {
  width: 16px;
  height: 16px;
  background: #4285F4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(66,133,244,0.4), 0 0 0 6px rgba(66,133,244,0.12);
  animation: userPulse 3s ease-in-out infinite;
}

@keyframes userPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(66,133,244,0.4), 0 0 0 6px rgba(66,133,244,0.12); }
  50% { box-shadow: 0 2px 8px rgba(66,133,244,0.4), 0 0 0 14px rgba(66,133,244,0.04); }
}

/* ===== FAB ===== */
#fab-create {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-size: 28px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  z-index: 500;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#fab-create:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(99,102,241,0.45);
}

#fab-create:active {
  transform: scale(0.95);
}

/* ===== NEARBY FEED ===== */
#nearby-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  padding-bottom: 20px;
}

#nearby-feed h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 600;
}

/* ===== POST CARD ===== */
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.post-card:active {
  transform: scale(0.99);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.post-author {
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.post-author:hover {
  text-decoration: underline;
}

.post-time {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.post-text {
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 10px;
  word-wrap: break-word;
  color: var(--text);
}

.post-photo {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--bg-hover);
}

.post-photo-broken {
  display: none;
}

.post-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  padding-top: 8px;
}

.action-btn {
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}

.action-btn:hover {
  color: var(--primary);
}

.action-btn.liked {
  color: var(--heart);
}

.post-location-tag {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: auto;
  font-weight: 500;
}

/* ===== POST DETAIL SHEET ===== */
.sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}

.sheet-content {
  position: relative;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 20px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}

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

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-text {
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 14px;
  color: var(--text);
}

.detail-photo {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.detail-actions {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

/* Delete post (low-key inline) */
.detail-delete {
  text-align: center;
  padding: 12px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.delete-link {
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}

.delete-link:hover {
  color: var(--danger);
}

.delete-confirm-text {
  color: var(--text-secondary);
  font-size: 13px;
}

.delete-confirm-yes {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

.delete-confirm-yes:hover {
  opacity: 0.7;
}

/* ===== COMMENTS ===== */
.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.comment:last-child {
  border-bottom: none;
}

.comment-author {
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-right: 8px;
}

.comment-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.comment-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 8px;
}

.comment-input {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.comment-input input,
.chat-input input {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 11px 18px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.comment-input input:focus,
.chat-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.comment-input button,
.chat-input button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 11px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.comment-input button:hover,
.chat-input button:hover {
  background: var(--primary-light);
}

.comment-input button:active,
.chat-input button:active {
  transform: scale(0.96);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 24px;
  width: 100%;
  max-width: 540px;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 700;
}

.modal-content textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text);
  font-size: 16px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.2s;
}

.modal-content textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.post-location {
  color: var(--text-muted);
  font-size: 13px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-location::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") center/contain no-repeat;
}

.mask-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 4px 0 2px;
  user-select: none;
}

.mask-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.photo-btn {
  background: var(--bg-input);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  border: 1.5px solid var(--border);
}

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

.photo-btn input {
  display: none;
}

#photo-preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#photo-preview img {
  max-height: 80px;
  border-radius: var(--radius-sm);
}

/* GIF conversion progress */
.gif-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.gif-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.15s;
}

.gif-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

#gif-progress {
  width: 100%;
  margin-top: 8px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s;
}

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

.btn-primary:active {
  transform: scale(0.97);
}

.btn-small {
  background: var(--bg-input);
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* ===== MESSAGES / CONVERSATIONS ===== */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.conversation-item:hover {
  background: var(--bg-hover);
}

.conversation-item:active {
  transform: scale(0.99);
}

.conv-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

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

.conv-name {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.conv-preview {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-time {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

/* ===== CHAT ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 16px;
  background: var(--bg-card);
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}

.chat-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
}

.chat-bubble p {
  margin: 0;
}

.chat-bubble.sent {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}

.chat-bubble.received {
  background: var(--bg-card);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border-light);
}

.bubble-time {
  display: block;
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  font-weight: 500;
}

.chat-input {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}

/* ===== PROFILE ===== */
.profile-header {
  text-align: center;
  padding: 28px 0 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}

.profile-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.profile-bio {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 6px 0 12px;
  line-height: 1.4;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0;
  margin: 20px 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat {
  text-align: center;
  flex: 1;
  padding: 16px 0;
}

.stat + .stat {
  border-left: 1px solid var(--border-light);
}

.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: 2px;
}

.profile-ephemeral {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  line-height: 1.6;
  border: 1px solid var(--border-light);
}

.profile-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

/* ===== PROFILE POPUP ===== */
.profile-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.profile-popup-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.profile-popup-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
}
.profile-popup-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 24px;
  width: 90vw;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: scale(0.95);
  transition: transform 0.2s;
}
.profile-popup-overlay.visible .profile-popup-card {
  transform: scale(1);
}
.popup-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.popup-avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.popup-info h3 {
  font-size: 17px;
  margin-bottom: 2px;
}
.popup-bio {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.3;
}
.popup-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.popup-stats strong {
  color: var(--text);
  font-weight: 600;
}
.popup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.popup-tile {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.15s;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-tile:hover {
  opacity: 0.8;
}
.popup-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.popup-tile p {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px;
  text-align: center;
  line-height: 1.4;
}
.popup-tile img + p {
  display: none;
}
.popup-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}
.popup-actions .btn-primary,
.popup-actions .btn-small {
  flex: 1;
  margin: 0;
  padding: 10px 0;
  text-align: center;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-view-btn {
  text-decoration: none;
  text-align: center;
}

@media (max-width: 480px) {
  .popup-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .popup-grid .popup-tile:nth-child(n+4) {
    display: none;
  }
}

/* ===== WELCOME MODAL ===== */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.welcome-overlay.visible {
  opacity: 1;
}

.welcome-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255,255,255,0.5) inset;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
}

.welcome-overlay.visible .welcome-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 8px;
  line-height: 1;
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.welcome-username {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.welcome-username strong {
  color: #f97316;
  font-weight: 700;
}

.welcome-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.welcome-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  text-align: left;
}

.welcome-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.6);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.rule-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.welcome-rule strong {
  color: #f97316;
}

.welcome-footer {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-style: italic;
}

.welcome-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: #f97316;
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.3);
}

.welcome-btn:hover {
  background: #ea580c;
  box-shadow: 0 6px 24px rgba(249, 115, 22, 0.4);
}

.welcome-btn:active {
  transform: scale(0.97);
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 24px;
  font-size: 15px;
  line-height: 1.5;
}

.loading-text {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

.error-text {
  color: var(--danger);
  text-align: center;
  padding: 24px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
}

h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ===== LOADING OVERLAY ===== */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ===== POST HERE POPUP ===== */
.post-here-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}

.post-here-btn:hover {
  background: var(--primary-light);
}

.post-here-popup .leaflet-popup-content-wrapper {
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.post-here-popup .leaflet-popup-content {
  margin: 10px 12px;
}

.post-here-popup .leaflet-popup-tip {
  background: var(--bg-card);
}

/* ===== LEAFLET OVERRIDES ===== */

.leaflet-tooltip {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  box-shadow: var(--shadow-md);
  font-family: 'Inter', sans-serif;
}

.leaflet-tooltip-top::before {
  border-top-color: var(--border);
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  font-weight: 600 !important;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .header-btn {
    display: flex;
  }

  #bottom-nav {
    display: none;
  }

  .view {
    bottom: 0;
  }

  #fab-create {
    bottom: 24px;
  }

  #map {
    height: 55vh;
  }

  .modal {
    align-items: center;
  }

  .modal-content {
    border-radius: 20px;
    max-width: 520px;
  }

  .sheet-content {
    max-width: 600px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
  }
}

@media (min-width: 1024px) {
  #view-map.active {
    flex-direction: row;
  }

  #map {
    height: 100%;
    min-height: 0;
    flex: 1;
  }

  #nearby-feed {
    flex: 0 0 400px;
    width: 400px;
    border-left: 1px solid var(--border-light);
    background: var(--bg);
  }

  #fab-create {
    right: 420px;
  }
}

/* Toast */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text);
  color: var(--bg);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9000;
}
.toast.visible {
  opacity: 0.7;
  transform: translateX(-50%) translateY(0);
}

/* ===== NOTIFICATION MODAL ===== */
.notif-modal-card {
  max-width: 380px;
}
.notif-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.notif-modal-header h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}
.notif-master-row {
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--border-light);
}
.notif-sub-row {
  transition: opacity 0.2s;
}
.notif-blocked {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 12px;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.notif-toggles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}
.notif-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.notif-toggle-row:last-child {
  border-bottom: none;
}
.notif-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-toggle-label {
  font-size: 14px;
  font-weight: 600;
}
.notif-toggle-desc {
  font-size: 12px;
  color: var(--text-secondary);
}
.notif-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.notif-switch {
  width: 44px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.notif-switch::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.notif-checkbox:checked + .notif-switch {
  background: var(--primary);
}
.notif-checkbox:checked + .notif-switch::after {
  transform: translateX(18px);
}

/* ===== FEED TABS ===== */
.feed-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}
.feed-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.feed-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== ACTIVITY ITEMS ===== */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child {
  border-bottom: none;
}
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-icon.like-icon {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.activity-icon.comment-icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}
.activity-icon.follow-icon {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.activity-text strong {
  font-weight: 600;
  cursor: pointer;
}
.activity-text strong:hover {
  color: var(--primary);
}
.activity-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== FOLLOW LIST (profile) ===== */
.follow-list-section {
  margin-top: 16px;
}
.follow-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.follow-list-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.follow-list-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 8px;
}
.follow-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity 0.15s;
}
.follow-list-item:hover {
  opacity: 0.7;
}
.follow-list-item:last-child {
  border-bottom: none;
}
.follow-list-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.follow-list-name {
  font-size: 15px;
  font-weight: 600;
}
.stat.clickable {
  cursor: pointer;
}
.stat.clickable:hover .stat-num {
  color: var(--primary);
}
