
/* Friends tiles (Profile -> Friends section) */
.friends-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.friend-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--gray-200); box-shadow: var(--shadow); cursor: pointer; width: 100%; text-align: left; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.dark-mode .friend-tile { background: var(--gray-200); border-color: var(--gray-300); }
.friend-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.friend-tile:active { transform: translateY(0); filter: brightness(0.98); }
.friend-tile-icon { width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(59,130,246,0.1); color: var(--primary); }
.dark-mode .friend-tile-icon { background: rgba(96,165,250,0.15); }
.friend-tile-info { display: flex; flex-direction: column; }
.friend-tile-label { font-size: 12px; color: var(--gray-600); font-weight: 600; }
.friend-tile-count { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.dark-mode .friend-tile-count { color: var(--gray-900); }
.friend-tile-chevron { margin-left: auto; color: var(--gray-600); }
/* subtle chevron to indicate navigation on mobile */
.friend-tile::after { content: '›'; margin-left: auto; color: var(--gray-600); font-weight: 600; font-size: 18px; }

/* Mobile-friendly layout for Friends tiles */
@media (max-width: 480px) {
  .friends-grid { grid-template-columns: 1fr; gap: 10px; }
  .friend-tile { padding: 14px 16px; min-height: 64px; border-radius: 16px; }
  .friend-tile-icon { width: 48px; height: 48px; font-size: 20px; }
  .friend-tile-label { font-size: 13px; }
  .friend-tile-count { font-size: 20px; }
}
.friend-tile-chevron { margin-left: auto; color: var(--gray-600); }
/* subtle chevron to indicate navigation on mobile */
.friend-tile::after { content: '›'; margin-left: auto; color: var(--gray-600); font-weight: 600; font-size: 18px; }

/* Mobile-friendly layout for Friends tiles */
@media (max-width: 480px) {
  .friends-grid { grid-template-columns: 1fr; gap: 10px; }
  .friend-tile { padding: 14px 16px; min-height: 64px; border-radius: 16px; }
  .friend-tile-icon { width: 48px; height: 48px; font-size: 20px; }
  .friend-tile-label { font-size: 13px; }
  .friend-tile-count { font-size: 20px; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f9fafb;
    --dark: #1f2937;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-900: #111827;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark mode variables */
.dark-mode {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --secondary: #a78bfa;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --light: #1f2937;
    --dark: #f9fafb;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-600: #9ca3af;
    --gray-900: #f9fafb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.dark-mode .login-container {
    background: var(--gray-200);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray-900);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 16px;
    background: white;
    color: var(--gray-900);
}

.dark-mode .login-form input {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--primary-dark);
}

.login-options {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 14px;
}

.login-options a {
    color: var(--primary);
    text-decoration: none;
}

.login-options a:hover {
    text-decoration: underline;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 16px;
}

.dark-mode .header {
    background: var(--gray-200);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* row: [location pill] [icons...] */
    gap: 4px; /* tighter gap between city button and icons */
    min-width: 0; /* prevent flex children from forcing horizontal overflow */
}

/* ensure the header actions group stays visually toward the right edge */
.header-actions {
    margin-left: auto;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* keep action icons/avatars inside the bar on small screens */
}



.app-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.app-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* keep action icons/avatars inside the bar on small screens */
}
.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    position: relative;
}

.dark-mode .header-btn {
    background: var(--gray-300);
    color: var(--gray-600);
}

.notification-badge {
    position: relative;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #34d399, #60a5fa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* Location Banner */
.location-banner {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 13px 20px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 16px;
    border-radius: 12px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Compact banner inside the top header so it never pushes icons off-screen */
.header .location-banner {
    /* Keep city button visually pinned toward the left edge */
    position: relative;
    margin: 0 0 0 -16px;
    left: -20px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    flex: 1 1 auto; /* allow the pill to shrink before pushing icons off-screen */
    max-width: 45%; /* cap width so long city names don't hide the avatar */
}

.header .location-banner i {
    font-size: 12px;
}

.header .location-banner span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main Content */
 .main-content {
    padding: 0 0 96px;
}

/* Search & Filter */
.search-container {
    margin-bottom: 0;
    padding: 0px 16px 0;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: none;
    border-radius: 24px;
    background: var(--gray-200);
    font-size: 14px;
    margin-bottom: 0;
    color: var(--gray-900);
    outline: none;
}

.dark-mode .search-input {
    background: var(--gray-300);
    color: var(--gray-900);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.category-btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--gray-100);
    color: var(--gray-600);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-mode .category-btn {
    background: var(--gray-300);
    color: var(--gray-600);
}

.category-btn.active {
    background: var(--primary);
    color: white;
}

/* Post Card - TikTok Style */
.post-card {
    position: relative;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 16px;
    height: 500px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

.post-type {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.post-type.event { background: var(--primary); }
.post-type.discovery { background: var(--secondary); }
.post-type.challenge { background: var(--success); }

/* TikTok-style overlay info at bottom left */
.post-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 60px;
    padding: 20px;
    background: none; /* remove dark fade overlay */
    color: white;
}

.post-title-overlay {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.post-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-meta i {
    font-size: 12px;
}

/* Vertical action buttons on the right */
.post-actions-vertical {
    position: absolute;
    right: 12px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.action-btn-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.action-btn-vertical:hover {
    transform: scale(1.15);
}

.action-btn-vertical i {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.action-btn-vertical span {
    font-size: 12px;
    font-weight: 600;
}

.action-btn-vertical.heart:hover {
    color: #ef4444;
}

.post-location {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
}

.dark-mode .post-location {
    background: rgba(31, 41, 55, 0.9);
    color: var(--gray-600);
}

.post-content {
    padding: 16px;
}

.post-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--gray-900);
}

.dark-mode .post-title {
    color: var(--gray-900);
}

.post-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-group {
    display: flex;
    gap: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-600);
    font-size: 12px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--primary);
}

.action-btn.heart:hover { color: var(--danger); }
.action-btn.comment:hover { color: var(--primary); }
.action-btn.rsvp:hover { color: var(--success); }

/* User Profile Card */
.user-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.dark-mode .user-card {
    background: var(--gray-200);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-900);
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--gray-900);
}

.dark-mode .user-name {
    color: var(--gray-900);
}

.user-stats {
    font-size: 12px;
    color: var(--gray-600);
}

.user-actions {
    display: flex;
    gap: 8px;
}

.follow-btn, .contact-btn {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.follow-btn {
    background: var(--primary);
    color: white;
}

.contact-btn {
    background: var(--gray-100);
    color: var(--gray-900);
}

.dark-mode .contact-btn {
    background: var(--gray-300);
    color: var(--gray-900);
}

.following-btn {
    background: var(--gray-200);
    color: var(--gray-600);
}

.dark-mode .following-btn {
    background: var(--gray-300);
    color: var(--gray-600);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 0;
    max-width: 500px;
    margin: 0 auto;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.bottom-nav.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.dark-mode .bottom-nav {
    background: var(--gray-200);
    border-top-color: var(--gray-300);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    font-size: 10px;
    color: var(--gray-600);
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 20px;
}

.add-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: var(--shadow-lg);
    margin-top: -24px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.dark-mode .modal {
    background: var(--gray-200);
}

.modal-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
}

.dark-mode .modal-header {
    border-bottom-color: var(--gray-300);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.dark-mode .modal-title {
    color: var(--gray-900);
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
}

.modal-content {
    padding: 24px;
}

.post-type-option {
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.dark-mode .post-type-option {
    border-color: var(--gray-300);
}

.post-type-option:hover {
    border-color: var(--primary);
    background: var(--gray-100);
}

.dark-mode .post-type-option:hover {
    background: var(--gray-300);
}

.post-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.post-type-icon.event { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.post-type-icon.discovery { background: rgba(139, 92, 246, 0.1); color: var(--secondary); }
.post-type-icon.challenge { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.post-type-info h3 {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.dark-mode .post-type-info h3 {
    color: var(--gray-900);
}

.post-type-info p {
    font-size: 12px;
    color: var(--gray-600);
}

.form-group {
    margin-bottom: 16px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 14px;
    background: white;
    color: var(--gray-900);
}

.dark-mode .form-input, .dark-mode .form-textarea {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.hashtag-group {
    display: flex;
    gap: 8px;
}

.hashtag-input {
    flex: 1;
}

.hashtag-btn {
    width: 40px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    cursor: pointer;
}

.dark-mode .hashtag-btn {
    background: var(--gray-300);
    border-color: var(--gray-300);
    color: var(--gray-600);
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: var(--primary-dark);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    background: none;
    border: none;
    margin-bottom: 16px;
    cursor: pointer;
    font-weight: 600;
}

.image-upload {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.dark-mode .image-upload {
    border-color: var(--gray-300);
}

.image-upload:hover {
    border-color: var(--primary);
}

.image-upload i {
    font-size: 32px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.dark-mode .image-upload i {
    color: var(--gray-600);
}

.image-preview {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 16px;
    display: none;
}

/* City picker full-page sheet */
.location-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
}

.location-prompt.active {
    display: flex;
}

.location-modal.city-picker-modal {
    background: transparent;
    border-radius: 0;
    padding: 0;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

.city-picker-inner {
    background: var(--light);
    border-radius: 24px 24px 0 0;
    padding-top: 8px;
    padding-bottom: 12px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dark-mode .city-picker-inner {
    background: var(--gray-200);
}

.city-picker-header {
    padding: 12px 20px 8px;
    text-align: left;
}

.city-picker-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--gray-200);
    margin: 0 auto 10px;
}

.city-picker-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.city-picker-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.city-picker-header p {
    font-size: 13px;
    color: var(--gray-600);
}

.city-picker-close {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    cursor: pointer;
}

.city-picker-close i {
    font-size: 16px;
}

.location-buttons {
    margin-top: 4px;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* Add-city bar fixed at top of list */
.city-add-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-bottom: 10px;
    padding-top: 4px;
    background: linear-gradient(to bottom, var(--light), rgba(249, 250, 251, 0.7));
}

.dark-mode .city-add-bar {
    background: linear-gradient(to bottom, var(--gray-200), rgba(31, 41, 55, 0.9));
}

.city-add-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: var(--gray-100);
    border: none; /* remove hard border for a softer iOS-style pill */
}

.dark-mode .city-add-inner {
    background: var(--gray-300);
    border-color: var(--gray-300);
}

.city-add-inner i {
    color: var(--gray-600);
}

.city-add-inner input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--gray-900);
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Hard-disable any default focus border/outline on the add-city text field */
.city-add-inner input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.city-add-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* City list */
.city-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.location-btn.city-option {
    width: 100%;
    padding: 12px 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    cursor: pointer;
}

.dark-mode .location-btn.city-option {
    background: var(--gray-100);
}

.city-row-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.city-row-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
}

.city-row-meta {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.city-row-creator {
    font-size: 11px;
    color: var(--gray-600);
}

.city-row-chevron {
    color: var(--gray-400);
    margin-left: 10px;
}

/* Legacy manual-input overrides (kept for safety) */
.manual-input {
    display: block;
}

.manual-input input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    margin-bottom: 12px;
    background: white;
    color: var(--gray-900);
}

.dark-mode .manual-input input {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

@media (max-width: 480px) {
    .location-modal.city-picker-modal {
        max-width: 100%;
    }
    .city-picker-inner {
        border-radius: 24px 24px 0 0;
    }
}

/* Hidden Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Ensure content stays above fixed bottom nav */
#feedView,
#salesView,
#mapView,
#notificationsView,
#usersView,
#profileView,
#leaderboardView {
    padding-bottom: 96px;
}

/* Enhanced Profile View */
#profileView {
    /* Top/right/left padding 20/16, extra bottom padding so content stays above fixed bottom nav */
    padding: 20px 16px 96px;
    background: linear-gradient(to bottom, rgba(59, 130, 246, 0.05) 0%, transparent 300px);
    min-height: calc(100vh - 140px);
}

.profile-card {
    background: white;
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 0;
}

.dark-mode .profile-card {
    background: var(--gray-200);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dark-mode .profile-card::before {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Profile settings button inside profile card */
.profile-settings-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--gray-600);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 2;
}
.profile-settings-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.profile-settings-btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}
.dark-mode .profile-settings-btn {
    background: rgba(31,41,55,0.85);
    border-color: var(--gray-300);
}

.profile-avatar-large {
    position: relative;
    z-index: 1;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #34d399, #60a5fa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 36px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 4px solid white;
}

.dark-mode .profile-avatar-large {
    border-color: var(--gray-200);
}

.profile-name {
    position: relative;
    z-index: 1;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--gray-900);
}

.profile-level {
    position: relative;
    z-index: 1;
    color: var(--gray-600);
    margin-bottom: 24px;
    font-size: 14px;
}

/* Bio under name */
.profile-bio {
    position: relative;
    z-index: 1;
    color: var(--gray-900);
    margin: -6px 0 16px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.dark-mode .profile-bio { color: var(--gray-900); }
@media (max-width: 480px) { .profile-bio { font-size: 13px; } }

.profile-stats {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.stat-value.points { 
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-value.streak { 
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.15));
    color: #d97706;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.dark-mode .badge {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(239, 68, 68, 0.25));
    border-color: rgba(251, 191, 36, 0.4);
}

.profile-section {
    background: white;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

/* Friends block shown inside the profile card, closer to avatar/name */
.profile-friends-section {
    margin-top: 24px;
}

.profile-section:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.dark-mode .profile-section {
    background: var(--gray-200);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dark-mode .profile-section:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.section-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--gray-900);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.section-text {
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
}

/* Make followers/following look clearly clickable */
.section-text span {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
    color: var(--gray-900);
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    outline: none;
}
.dark-mode .section-text span {
    background: var(--gray-300);
    border-color: var(--gray-300);
}

.section-text span:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.section-text span:active {
    transform: translateY(0);
}

.section-text span:focus {
    outline: none;
}

/* Extra affordances on profile 'Friends' counts */
#friendsCounts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#friendsCounts #followersCount::after,
#friendsCounts #followingCount::after {
    content: ' ›';
    color: inherit;
}

.dark-mode .section-text span:hover {
    background: var(--gray-300);
}

/* Followers Modal Styling */
#followersModal .modal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

#followersModal .modal-content {
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    padding: 20px;
}

.follower-user-card {
    transition: all 0.2s ease;
    border: 1px solid transparent;
    outline: none;
}

.follower-user-card:focus {
    outline: none;
}

.follower-user-card:hover {
    background: var(--gray-100) !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dark-mode .follower-user-card:hover {
    background: var(--gray-300) !important;
}

.follower-avatar {
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.follower-user-card button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.follower-user-card .follow-btn:hover {
    background: var(--primary-dark) !important;
}

.follower-user-card .following-btn:hover {
    background: var(--gray-300) !important;
}

/* Profile View Responsive */
@media (max-width: 480px) {
    .profile-stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .profile-avatar-large {
        width: 85px;
        height: 85px;
        font-size: 32px;
    }
    
    .profile-name {
        font-size: 22px;
    }
}

/* Sale Cards - Special Layout */
.sale-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.dark-mode .sale-card {
    background: var(--gray-200);
}

.sale-image-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: var(--gray-100);
}

.sale-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sale-info-board {
    padding: 20px;
    background: white;
}

.dark-mode .sale-info-board {
    background: var(--gray-200);
}

.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.sale-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    flex: 1;
}

.sale-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

.sale-description {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 16px;
    line-height: 1.5;
}

.sale-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.sale-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
}

.sale-meta-item i {
    color: var(--gray-600);
    font-size: 12px;
}

.sale-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.sale-hashtags .hashtag {
    padding: 4px 12px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.dark-mode .sale-hashtags .hashtag {
    background: rgba(96, 165, 250, 0.2);
}

.sale-actions {
    display: flex;
    gap: 12px;
    padding-top: 12px;
}

.sale-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sale-action-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
}

.sale-action-btn.heart:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.dark-mode .sale-action-btn {
    border-color: var(--gray-300);
    color: var(--gray-600);
}

.dark-mode .sale-action-btn:hover {
    background: var(--gray-300);
}

/* Users View */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.users-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.dark-mode .users-title {
    color: var(--gray-900);
}

.search-users {
    position: relative;
    margin-bottom: 16px;
}

.search-users input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    background: white;
    font-size: 14px;
    color: var(--gray-900);
}

.dark-mode .search-users input {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

.search-users i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-600);
}

/* Notifications View */
.no-notifications {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-600);
}

.no-notifications i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--gray-300);
}

/* Account Modal */
.account-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.avatar-row { display:flex; align-items:center; gap:12px; }
.account-avatar { width:64px; height:64px; border-radius:50%; background: linear-gradient(135deg, #34d399, #60a5fa); background-size:cover; background-position:center; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:18px; }

.dark-mode .account-section {
    border-bottom-color: var(--gray-300);
}

.account-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.account-section h3 {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-900);
}

.dark-mode .account-section h3 {
    color: var(--gray-900);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.logout-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
}

.logout-btn:hover {
    background: #dc2626;
}

/* OpenStreetMap Container */
#openStreetMap {
    height: 400px;
    width: 100%;
    border-radius: 16px;
    margin-bottom: 16px;
    z-index: 1;
}

/* Ensure map container has proper positioning */
.leaflet-container {
    border-radius: 16px;
    z-index: 1;
}
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    display: none; /* hidden by default */
}

/* Glimpse (TikTok-style vertical feed) */
.glimpse-feed {
    height: 100svh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    -ms-overflow-style: none;
    scrollbar-width: none;
    margin: 0 -16px; /* stretch to full width outside container padding */
    background: #000;
}
.glimpse-feed::-webkit-scrollbar { display: none; }

.glimpse-item {
    position: relative;
    height: 100svh;
    width: 100%;
    scroll-snap-align: start;
    display: grid;
    place-items: center;
    background: #000;
}

.glimpse-video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* show full video */
    background: #000;
    transform: scale(0.985);
    opacity: 0.8;
    transition: transform 260ms ease, opacity 260ms ease, filter 260ms ease;
}

.glimpse-item.active .glimpse-video {
    transform: scale(1);
    opacity: 1;
}

.glimpse-overlay {
    pointer-events: none;
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr auto;
}

/* Reuse overlay styles for text and action rail */
.glimpse-overlay .post-overlay-info { pointer-events: none; }
.glimpse-overlay .post-actions-vertical { pointer-events: auto; }

/* Users tabs */
.users-tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab-btn { flex: 1; padding: 10px 12px; border-radius: 10px; border: none; cursor: pointer; font-weight: 600; background: var(--gray-200); color: var(--gray-900); }
.tab-btn.active { background: var(--primary); color: #fff; }
.users-subview { margin-top: 8px; }

/* Chat (full-page, Instagram-style direct message) */
#chatModal.modal-overlay {
  align-items: stretch;
  justify-content: stretch;
  background: transparent;
}
.dark-mode #chatModal.modal-overlay {
  background: transparent;
}

/* Chat container */
.chat-modal {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* LIGHT MODE: clean white chat */
  background: #ffffff;
  color: #0f172a;
}

/* DARK MODE: keep dark gradient look */
.dark-mode .chat-modal {
  background: radial-gradient(circle at top, rgba(59,130,246,0.28), transparent 55%), #000;
  color: #ffffff;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;

  /* Light header with subtle border */
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid rgba(148,163,184,0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dark-mode .chat-header {
  background: rgba(15,23,42,0.96);
  border-bottom: 0.5px solid rgba(148,163,184,0.35);
}

.chat-back-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 18px;
  cursor: pointer;
  color: #0f172a;
}

.dark-mode .chat-back-btn {
  color: #ffffff;
}

.chat-header-main {
  flex: 1;
  display: flex;
  align-items: center;
}

.chat-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg,#f97316,#ec4899,#6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  position: relative;
}

/* Online-dot indicator removed for cleaner avatar */

.chat-name-status {
  display: flex;
  flex-direction: column;
}

.chat-name {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.dark-mode .chat-name {
  color: #f9fafb;
}

.chat-status {
  font-size: 11px;
  color: #9ca3af;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Header icon buttons */
.chat-icon-btn {
  background: rgba(243,244,246,0.95);
  border-radius: 999px;
  border: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  cursor: pointer;
  font-size: 14px;
}

.dark-mode .chat-icon-btn {
  background: rgba(15,23,42,0.7);
  color: #e5e7eb;
}

/* Background halo */
.chat-background {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top, rgba(148,163,184,0.18), transparent 60%);
}

.dark-mode .chat-background {
  background: radial-gradient(circle at top, rgba(59,130,246,0.2), transparent 60%);
}

/**** Body and messages ****/
.chat-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
  min-height: 0; /* allow messages area to shrink and scroll */
  background: #f9fafb;
}

.dark-mode .chat-body {
  background: transparent;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/**** Input bar ****/
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 12px;

  /* Light mode: white bar */
  border-top: 1px solid rgba(148,163,184,0.35);
  background: #ffffff;
}

.dark-mode .chat-input-bar {
  border-top: 0.5px solid rgba(148,163,184,0.4);
  background: rgba(15,23,42,0.96);
}

.chat-input-bar input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
}

.chat-input-bar input::placeholder {
  color: #6b7280;
}

.dark-mode .chat-input-bar input {
  border: 0.5px solid rgba(148,163,184,0.8);
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
}

/* Send button */
.chat-send-btn {
  background: #3b82f6;
  border-radius: 999px;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
}

/**** Message bubbles ****/
.message-bubble {
  max-width: 78%;
  padding: 7px 12px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.35;
  margin-top: 2px;
}

/* Me (right) – keep gradient in both themes */
.message-me {
  align-self: flex-end;
  background: linear-gradient(135deg,#0ea5e9,#6366f1);
  color: #f9fafb;
  border-bottom-right-radius: 4px;
}

/* Them (left) – light in light mode, dark in dark mode */
.message-them {
  align-self: flex-start;
  background: #e5e7eb;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.dark-mode .message-them {
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
}

/* Comments bottom sheet – enhanced iOS-style */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1500;
}
.sheet-overlay.active { display: flex; }
.sheet {
  width: 100%;
  max-width: 500px;
  background: var(--light);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  transform: translateY(100%);
  transition: transform .25s ease;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  padding-bottom: calc(4px + constant(safe-area-inset-bottom));
  padding-bottom: calc(4px + env(safe-area-inset-bottom));
}
.dark-mode .sheet {
  background: var(--gray-200);
}
.sheet-overlay.active .sheet { transform: translateY(0); }
.sheet-handle {
  width: 44px;
  height: 5px;
  background: var(--gray-300);
  border-radius: 999px;
  margin: 10px auto 6px;
}
.sheet-header {
  padding: 4px 18px 8px;
  border-bottom: 1px solid var(--gray-200);
}
.dark-mode .sheet-header { border-bottom-color: var(--gray-300); }
.sheet-title {
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 15px;
}
.sheet-count {
  color: var(--gray-600);
  font-size: 12px;
}
.sheet-content {
  max-height: 65vh;
  overflow-y: auto;
  padding: 6px 14px 10px;
  -webkit-overflow-scrolling: touch;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comment-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(15,23,42,0.28);
}
.comment-body {
  flex: 1;
  background: rgba(148,163,184,0.12);
  border-radius: 14px 14px 14px 4px;
  padding: 8px 11px 7px;
}
.dark-mode .comment-body {
  background: rgba(15,23,42,0.9);
}
.comment-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
}
.dark-mode .comment-name {
  color: var(--gray-900);
}
.comment-text {
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.4;
  margin-top: 2px;
}
.dark-mode .comment-text {
  color: var(--gray-900);
}
.comment-time {
  color: var(--gray-600);
  font-size: 11px;
  margin-top: 4px;
}

.comment-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--gray-200);
  background: rgba(255,255,255,0.98);
}
.dark-mode .comment-input-bar {
  border-top-color: var(--gray-300);
  background: rgba(15,23,42,0.96);
}
.comment-input-bar input {
  flex: 1;
  padding: 10px 13px;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 16px;
}
.dark-mode .comment-input-bar input {
  background: var(--gray-200);
  color: var(--gray-900);
  border-color: var(--gray-300);
}
.comment-input-bar button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.comment-input-bar button i {
  font-size: 16px;
}

#leaderboardBtn .fas {
  color: var(--gray-600);
}
.dark-mode #leaderboardBtn .fas {
  color: var(--gray-600);
}

/* Leaderboard view */
/* Segmented tabs styling scoped to Leaderboard */
#leaderboardView .users-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; padding: 6px; background: var(--gray-100); border-radius: 12px; box-shadow: var(--shadow); }
.dark-mode #leaderboardView .users-tabs { background: var(--gray-300); }
#leaderboardView .tab-btn { padding: 10px 12px; border-radius: 10px; border: none; background: transparent; color: var(--gray-600); font-weight: 700; letter-spacing: .2px; }
#leaderboardView .tab-btn.active { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; box-shadow: var(--shadow); }
#leaderboardView .tab-btn:active { transform: translateY(0); filter: brightness(0.98); }

/* Leaderboard list cards */
.leaderboard-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 16px; }
.leader-row { display: flex; align-items: center; gap: 12px; background: white; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.dark-mode .leader-row { background: var(--gray-200); }
.leader-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.leader-row:active { transform: translateY(0); filter: brightness(0.98); }
.leader-rank { width: 30px; height: 30px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; color:#111; }
.rank-1 { background: linear-gradient(135deg,#f59e0b,#fde68a); }
.rank-2 { background: linear-gradient(135deg,#9ca3af,#e5e7eb); }
.rank-3 { background: linear-gradient(135deg,#a16207,#fcd34d); }
.rank-n { background: var(--gray-300); }
.leader-name { font-weight: 700; color: var(--gray-900); }
.leader-meta { color: var(--gray-600); font-size: 12px; }
.leader-metric { margin-left: auto; min-width: 72px; text-align: right; font-weight: 800; color: var(--gray-900); }
.leader-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #60a5fa, #8b5cf6); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; box-shadow: var(--shadow); }

@media (max-width: 480px) {
  #leaderboardView .users-tabs { padding: 6px; gap: 6px; border-radius: 14px; }
  #leaderboardView .tab-btn { padding: 12px 14px; font-size: 14px; }
  .leader-row { padding: 12px; gap: 10px; }
  .leader-avatar { width: 42px; height: 42px; }
  .leader-name { font-size: 14px; }
  .leader-meta { font-size: 11px; }
  .leader-metric { min-width: 64px; font-size: 14px; }
}

/* Global upload progress overlay */
.upload-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 1800;
}
.upload-overlay.active { display: flex; }
.upload-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0deg, var(--secondary) 120deg, rgba(255,255,255,0.18) 120deg);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.upload-circle-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(15,23,42,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
}
.upload-percent {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .5px;
}
.upload-text {
  margin-top: 4px;
  font-size: 12px;
  opacity: .85;
}

/* REMOVE ALL FOCUS OUTLINES */
* {
    outline: none !important;
}

*:focus,
*:focus-visible,
*:active {
    outline: none !important;
    box-shadow: none !important;
}

.follower-user-card,
.follower-user-card *,
button,
div[onclick],
[data-user-id] {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.follower-user-card:focus,
.follower-user-card:active,
button:focus,
button:active {
    outline: none !important;
    border: 1px solid transparent !important;
}

/* Remove ALL focus outlines from clickable elements */
.follower-user-card,
.follower-user-card *,
.section-text span,
button,
.follow-btn,
.following-btn,
.contact-btn,
.user-card,
div[onclick],
[data-user-id] {
    outline: none !important;
}

.follower-user-card:focus,
.follower-user-card:focus-visible,
button:focus,
button:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

*:focus {
    outline: none !important;
}

*:focus-visible {
    outline: none !important;
}

/* Edit Profile section – mobile/iOS friendly styling */
#editProfileSection {
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  padding: 14px 14px 16px;
  /* iOS safe-area padding (older Safari uses constant(), newer uses env()) */
  padding-bottom: calc(16px + constant(safe-area-inset-bottom));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  -webkit-backdrop-filter: saturate(140%) blur(2px);
  backdrop-filter: saturate(140%) blur(2px);
  -webkit-tap-highlight-color: transparent;
}
.dark-mode #editProfileSection {
  border-color: var(--gray-300);
}
#editProfileSection .form-group {
  margin-bottom: 14px;
  padding: 6px; /* space for focus-within ring */
  border-radius: 16px;
  background: rgba(0,0,0,0.02);
  transition: box-shadow .15s ease, background .15s ease;
}
.dark-mode #editProfileSection .form-group {
  background: rgba(255,255,255,0.04);
}
#editProfileSection .form-group:focus-within {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
  background: rgba(59,130,246,0.04);
}
#editProfileSection label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  letter-spacing: .2px;
  margin-bottom: 6px;
  display: inline-block;
}
#editProfileSection .form-input,
#editProfileSection .form-textarea {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 14px;
  padding: 14px 14px;
  font-size: 16px; /* prevent iOS zoom on focus */
  line-height: 1.3;
  background: #fff;
  border: 1px solid var(--gray-300);
}
.dark-mode #editProfileSection .form-input,
.dark-mode #editProfileSection .form-textarea {
  background: var(--gray-200);
  border-color: var(--gray-300);
}
#editProfileSection .form-input::placeholder,
#editProfileSection .form-textarea::placeholder {
  color: var(--gray-600);
  opacity: .7;
}
#editProfileSection .form-input:focus,
#editProfileSection .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
#editProfileSection #profileSaveBtn {
  position: sticky;
  bottom: calc(8px + constant(safe-area-inset-bottom));
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: 100% !important;
  padding: 14px 16px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
  box-shadow: var(--shadow-lg);
  font-weight: 800;
  letter-spacing: .2px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#editProfileSection #profileSaveBtn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}
#profileSaveMsg {
  font-size: 12px;
  margin-top: 8px;
  letter-spacing: .2px;
}

/* Profile view – Edit Profile header and helpers */
#editProfileSection .profile-edit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
#editProfileSection .profile-edit-header i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(59,130,246,0.12);
  color: var(--primary);
}
#editProfileSection .profile-edit-subtitle {
  margin-top: 2px;
  color: var(--gray-600);
  font-size: 12px;
}
#editProfileSection .field-hint {
  margin-top: 6px;
  color: var(--gray-600);
  font-size: 12px;
}

/* Account Modal – unify Profile section with Edit Profile styling */
#accountModal .modal-content {
  /* subtle background separation for scrolling content */
  background: transparent;
}
#accountModal .form-group {
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(0,0,0,0.02);
  transition: box-shadow .15s ease, background .15s ease;
}
.dark-mode #accountModal .form-group {
  background: rgba(255,255,255,0.04);
}
#accountModal .form-group:focus-within {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
  background: rgba(59,130,246,0.04);
}
#accountModal label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  letter-spacing: .2px;
  margin-bottom: 6px;
  display: inline-block;
}
#accountModal .form-input,
#accountModal .form-textarea {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 14px;
  padding: 14px 14px;
  font-size: 16px; /* prevent iOS zoom on focus */
  line-height: 1.3;
  background: #fff;
  border: 1px solid var(--gray-300);
}
.dark-mode #accountModal .form-input,
.dark-mode #accountModal .form-textarea {
  background: var(--gray-200);
  border-color: var(--gray-300);
}
#accountModal .form-input::placeholder,
#accountModal .form-textarea::placeholder {
  color: var(--gray-600);
  opacity: .7;
}
#accountModal .form-input:focus,
#accountModal .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
#accountModal #saveProfileBtn {
  position: static; /* do not stick to the bottom of the modal */
  width: auto !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  background: var(--primary) !important;
  box-shadow: none;
  font-weight: 600;
  letter-spacing: .2px;
}
#accountModal #saveProfileBtn:active {
  transform: none;
  filter: none;
}
#accountModal #saveProfileMsg{
  font-size: 12px;
  margin-top: 8px;
  letter-spacing: .2px;
}

/* Kill dark-mode border on \"Discover your city\" add-city text field */
.dark-mode .city-add-inner input,
.dark-mode .city-add-inner input:focus,
.dark-mode .city-add-inner input:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background-color: transparent;
}

/* Make sure the pill itself never gets a border in dark mode */
.dark-mode .city-add-inner {
  border: none !important;
}