/* Stripe-inspired Design System */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --stripe-purple: #635bff;
    --stripe-purple-light: #7a73ff;
    --stripe-purple-dark: #4b45c6;
    --stripe-blue: #0a2540;
    --stripe-cyan: #00d4ff;
    --stripe-green: #00d924;
    --stripe-orange: #ff6f00;
    --stripe-red: #df1b41;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

    /* Light mode (default) */
    --bg-page: #f7f8fa;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f0f2f5;
    --bg-elevated: #ffffff;
    --bg-input: #ffffff;
    --border: #e3e8ee;
    --border-hover: #c1c9d2;
    --text-primary: #1a1f36;
    --text-secondary: #3c4257;
    --text-tertiary: #4f566b;
    --text-muted: #697386;
    --text-faint: #8792a2;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.16);
    --vote-up-bg: #ecfdf5;
    --vote-up-color: #047857;
    --vote-up-border: #a7f3d0;
    --vote-down-bg: #fef2f2;
    --vote-down-color: #dc2626;
    --vote-down-border: #fecaca;
    --coord-bg: #f0f2f5;
    --coord-active-bg: #ecfdf5;
    --coord-active-border: #6ee7b7;
    --coord-active-color: #047857;
}

[data-theme="dark"] {
    --bg-page: #0a0e1a;
    --bg-surface: #141926;
    --bg-surface-hover: #1c2233;
    --bg-elevated: #1c2233;
    --bg-input: #1c2233;
    --border: #2a3040;
    --border-hover: #3d4560;
    --text-primary: #f0f2f5;
    --text-secondary: #c1c9d2;
    --text-tertiary: #a0aab4;
    --text-muted: #8792a2;
    --text-faint: #697386;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.6);
    --vote-up-bg: rgba(4,120,87,0.15);
    --vote-up-color: #34d399;
    --vote-up-border: #065f46;
    --vote-down-bg: rgba(220,38,38,0.15);
    --vote-down-color: #f87171;
    --vote-down-border: #7f1d1d;
    --coord-bg: #1c2233;
    --coord-active-bg: rgba(4,120,87,0.15);
    --coord-active-border: #065f46;
    --coord-active-color: #34d399;
    --stripe-purple: #7c75ff;
    --stripe-purple-light: #9590ff;
    --stripe-purple-dark: #635bff;
    --stripe-red: #f87171;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    min-height: 100vh;
    color: var(--text-secondary);
    line-height: 1.5;
    transition: background 0.3s, color 0.3s;
    cursor: url('cursor-36.png'), auto;
}

* {
    cursor: url('cursor-36.png'), auto !important;
}

/* Theme toggle switch */
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
}

.theme-toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    transition: background 0.25s;
}

.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

[data-theme="dark"] .theme-toggle-track {
    background: var(--stripe-purple);
}

[data-theme="dark"] .theme-toggle-thumb {
    transform: translateX(18px);
}

.theme-toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Header */
header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.header-text h1 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-text p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.auth-section {
    display: flex;
    align-items: center;
}

.auth-btn { white-space: nowrap; }

.user-info {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

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

.user-details {
    display: flex;
    flex-direction: column;
}

.user-nickname {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.user-stats {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.referral-link {
    color: var(--stripe-purple);
    text-decoration: none;
    font-weight: 500;
}

.referral-link:hover {
    text-decoration: underline;
}

/* Main container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

/* Action bar */
.action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.country-selector-container {
    flex-shrink: 0;
}

.country-selector {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    min-width: 180px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.country-selector:focus {
    outline: none;
    border-color: var(--stripe-purple);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.add-location-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.add-location-hint {
    font-size: 0.75rem;
    color: var(--text-faint);
    white-space: nowrap;
}

.location-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: auto;
}

/* Content wrapper */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1rem;
    height: calc(100vh - 160px);
}

/* Map container */
.map-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

#map {
    height: 100%;
    width: 100%;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* List container */
.list-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.list-container.full-height { height: 100%; }

.list-header {
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}

.list-container h3 {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Search */
.search-container { margin-bottom: 0.75rem; }

.search-container input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bg-surface-hover);
}

.search-container input:focus {
    outline: none;
    border-color: var(--stripe-purple);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
    background: var(--bg-surface);
}

/* Locations list */
.locations-list {
    flex: 1;
    overflow-y: auto;
}

.locations-list.scrollable { height: 100%; }

.location-item {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.location-item:hover {
    border-color: var(--stripe-purple);
    box-shadow: var(--shadow-sm);
}

.location-item.active {
    background: var(--stripe-purple);
    border-color: var(--stripe-purple);
    color: white;
}

.location-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.location-item.active .location-name { color: white; }

.location-address {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.location-item.active .location-address { color: rgba(255,255,255,0.8); }

.location-description {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.location-item.active .location-description { color: rgba(255,255,255,0.9); }

/* Location header & ownership */
.location-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.location-main { flex: 1; min-width: 0; }

.location-creator {
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-top: 0.4rem;
}

.popup-creator {
    font-size: 0.75rem;
    color: var(--text-faint);
    margin: 0.4rem 0;
}

/* Voting */
.voting-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.location-item.active .voting-section { border-top-color: rgba(255,255,255,0.2); }

.vote-buttons {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.vote-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.location-item.active .vote-btn { color: rgba(255,255,255,0.7); }
.location-item.active .vote-btn:hover { background: rgba(255,255,255,0.1); }

.vote-btn.user-voted {
    font-weight: 600;
    border: 1px solid;
}

.vote-btn.upvote.user-voted {
    background: var(--vote-up-bg);
    color: var(--vote-up-color);
    border-color: var(--vote-up-border);
}

.vote-btn.downvote.user-voted {
    background: var(--vote-down-bg);
    color: var(--vote-down-color);
    border-color: var(--vote-down-border);
}

.location-item.active .vote-btn.upvote.user-voted {
    background: rgba(0,217,36,0.2);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

.location-item.active .vote-btn.downvote.user-voted {
    background: rgba(223,27,65,0.2);
    border-color: rgba(255,255,255,0.4);
    color: white;
}

.vote-btn.user-voted:hover { transform: translateY(-1px); }
.vote-btn.voted { font-weight: 600; }
.vote-btn.upvote:hover, .vote-btn.upvote.voted { color: var(--vote-up-color); }
.vote-btn.downvote:hover, .vote-btn.downvote.voted { color: var(--stripe-red); }

.vote-icon { font-size: 0.9rem; }
.vote-btn:hover .vote-icon { transform: scale(1.1); }
.vote-count { font-weight: 600; min-width: 16px; text-align: center; }

.accuracy-rating { font-size: 0.8rem; color: var(--text-faint); font-weight: 600; }
.location-item.active .accuracy-rating { color: rgba(255,255,255,0.7); }
.accuracy-high { color: var(--vote-up-color) !important; }
.accuracy-medium { color: #d97706 !important; }
.accuracy-low { color: var(--stripe-red) !important; }

/* Location actions */
.location-actions { display: flex; align-items: center; gap: 0.5rem; }

.maps-btn {
    background: var(--stripe-purple);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    text-decoration: none;
}

.maps-btn:hover {
    background: var(--stripe-purple-dark);
    box-shadow: 0 2px 8px rgba(99,91,255,0.3);
}

.location-item.active .maps-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.location-item.active .maps-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Delete / Edit buttons */
.delete-btn {
    background: var(--bg-surface);
    color: var(--stripe-red);
    border: 1px solid var(--stripe-red);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: var(--stripe-red);
    color: white;
}

.delete-icon { font-size: 1rem; line-height: 1; }

.edit-btn {
    background: var(--stripe-purple);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.edit-btn:hover {
    background: var(--stripe-purple-dark);
    box-shadow: 0 2px 8px rgba(99,91,255,0.3);
}

.popup-delete { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

.popup-delete-btn {
    background: var(--bg-surface);
    color: var(--stripe-red);
    border: 1px solid var(--stripe-red);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.popup-delete-btn:hover { background: var(--stripe-red); color: white; }

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--stripe-purple);
    color: white;
}

.btn-primary:hover {
    background: var(--stripe-purple-dark);
    box-shadow: 0 4px 12px rgba(99,91,255,0.3);
    transform: translateY(-1px);
}

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

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

.btn-outline {
    background: var(--bg-surface);
    color: var(--stripe-purple);
    border: 1px solid var(--stripe-purple);
}

.btn-outline:hover {
    background: var(--stripe-purple);
    color: white;
}

.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-full { width: 100%; }
.leaderboard-btn { white-space: nowrap; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(26, 31, 54, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-surface);
    margin: 4% auto;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: var(--stripe-purple);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: white;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.close:hover { opacity: 1; }

/* Forms */
#addLocationForm, #editLocationForm { padding: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    background: var(--bg-surface);
}

.form-group textarea { resize: vertical; min-height: 70px; }

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--stripe-purple);
    box-shadow: 0 0 0 3px rgba(99,91,255,0.1);
}

.form-group small { display: block; margin-top: 0.25rem; color: var(--text-faint); font-size: 0.75rem; }

.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Auth styles */
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-faint);
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.auth-tab.active { color: var(--stripe-purple); border-bottom-color: var(--stripe-purple); }

.auth-form { padding: 1.5rem; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s;
    cursor: pointer;
    margin-bottom: 1rem;
}

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

.google-icon { width: 18px; height: 18px; }

.divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span { padding: 0 0.75rem; color: var(--text-faint); font-size: 0.8rem; }

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-page);
    opacity: 0.97;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-surface);
    border-top-color: var(--stripe-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.75rem;
}

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

.loading-spinner p { color: var(--text-muted); font-size: 0.85rem; }

/* Leaderboard */
.leaderboard-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.leaderboard-container h3 { color: var(--text-primary); margin-bottom: 0.75rem; font-size: 0.95rem; }
.leaderboard-list { overflow-y: auto; flex: 1; }

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-md);
    transition: all 0.15s;
}

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

.leaderboard-item.current-user {
    background: var(--stripe-purple);
    color: white;
}

.leaderboard-item .rank { font-weight: 700; font-size: 0.9rem; color: var(--stripe-purple); min-width: 28px; }
.leaderboard-item.current-user .rank { color: white; }

.leaderboard-item .user-info { display: flex; align-items: center; gap: 0.6rem; flex: 1; }
.leaderboard-item .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.leaderboard-item .user-details { display: flex; flex-direction: column; }
.leaderboard-item .nickname { font-weight: 600; font-size: 0.8rem; color: var(--text-primary); }
.leaderboard-item.current-user .nickname { color: white; }
.leaderboard-item .locations-count { font-size: 0.7rem; color: var(--text-faint); }
.leaderboard-item.current-user .locations-count { color: rgba(255,255,255,0.8); }

.current-user-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

.no-data { text-align: center; color: var(--text-faint); padding: 2rem; font-size: 0.85rem; }

.leaderboard-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }

.leaderboard-tab {
    flex: 1;
    padding: 0.6rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-faint);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.leaderboard-tab:hover { color: var(--text-secondary); }
.leaderboard-tab.active { color: var(--stripe-purple); border-bottom-color: var(--stripe-purple); }
.leaderboard-content { display: none; }
.leaderboard-content.active { display: block; }
.referrals-count { font-size: 0.7rem; color: #7c3aed; font-weight: 500; }
.leaderboard-item.current-user .referrals-count { color: rgba(255,255,255,0.8); }

/* Coordinates display */
.coordinates-display {
    padding: 0.6rem;
    background: var(--bg-surface-hover);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.15s;
}

.coordinates-display.has-location {
    background: var(--coord-active-bg);
    border-color: var(--coord-active-border);
    border-style: solid;
    color: var(--coord-active-color);
    font-weight: 600;
}

/* Address suggestions */
.address-suggestions { position: relative; z-index: 1000; }

.suggestion-item {
    padding: 0.6rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.1s;
}

.suggestion-item:hover, .suggestion-item.highlighted { background: var(--bg-surface-hover); }
.suggestion-item:first-child { border-top: 1px solid var(--border); }
.suggestion-item:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.suggestion-item.no-results { cursor: default; color: var(--text-faint); }

.suggestion-content { display: flex; align-items: center; gap: 0.6rem; }
.suggestion-icon { font-size: 1rem; min-width: 20px; text-align: center; }
.suggestion-text { flex: 1; min-width: 0; }
.suggestion-title { font-weight: 600; color: var(--text-primary); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-subtitle { font-size: 0.75rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Map marker */
.map-click-marker {
    background: var(--stripe-purple);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(99,91,255,0.5); }
    70% { box-shadow: 0 0 0 10px rgba(99,91,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(99,91,255,0); }
}

/* Leaflet popup */
.leaflet-popup-content-wrapper { border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { font-family: var(--font); margin: 0.75rem; }

.popup-content { padding: 0.25rem; }
.popup-title { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; margin-bottom: 0.2rem; }
.popup-address { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.4rem; }
.popup-description { font-size: 0.8rem; color: var(--text-tertiary); line-height: 1.4; margin-bottom: 0.4rem; }

.popup-voting { padding-top: 0.5rem; border-top: 1px solid var(--border); margin-top: 0.5rem; }
.popup-voting .vote-buttons { justify-content: center; gap: 0.75rem; }
.popup-voting .vote-btn { padding: 0.4rem 0.6rem; }
.popup-voting .accuracy-rating { text-align: center; margin-top: 0.2rem; }

.popup-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }

.popup-maps-btn {
    background: var(--stripe-purple);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.popup-maps-btn:hover { background: var(--stripe-purple-dark); }

.popup-owner-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.popup-owner-actions .edit-btn, .popup-owner-actions .delete-btn { flex: 1; min-width: 0; padding: 0.4rem 0.6rem; font-size: 0.8rem; }
.location-owner-buttons { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.location-owner-buttons .edit-btn, .location-owner-buttons .delete-btn { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

/* Photo styles */
.photo-upload-container { position: relative; }
.photo-input { display: none; }

.photo-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem;
    border: 1px dashed var(--stripe-purple);
    border-radius: var(--radius-md);
    background: rgba(99,91,255,0.03);
    color: var(--stripe-purple);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.photo-upload-label:hover { background: rgba(99,91,255,0.06); border-color: var(--stripe-purple-dark); }

.photo-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }

.remove-photo-btn {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(223,27,65,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-photo-btn:hover { background: var(--stripe-red); transform: scale(1.1); }

.popup-photos { display: flex; gap: 0.4rem; margin: 0.5rem 0; overflow-x: auto; }

.popup-photo {
    width: 64px; height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--border);
}

.popup-photo:hover { transform: scale(1.05); border-color: var(--stripe-purple); }

.location-photos-thumb { position: relative; display: inline-block; margin: 0.4rem 0; }

.location-photo-thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.location-photo-thumb:hover { transform: scale(1.05); border-color: var(--stripe-purple); }

.photo-count {
    position: absolute;
    bottom: 2px; right: 2px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
}

/* Photo viewer */
.photo-viewer-modal { z-index: 2000; background-color: rgba(0,0,0,0.95); }

.photo-viewer-content {
    position: relative;
    margin: 2% auto;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-viewer-close {
    position: absolute;
    top: 16px; right: 32px;
    font-size: 32px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2001;
    opacity: 0.8;
}

.photo-viewer-close:hover { opacity: 1; transform: scale(1.1); }

#photoViewerImage {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.photo-viewer-nav { display: flex; align-items: center; gap: 1.5rem; margin-top: 1.5rem; }

.photo-nav-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 44px; height: 44px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-nav-btn:hover { background: rgba(255,255,255,0.3); }
.photo-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.photo-counter { color: white; font-size: 0.9rem; font-weight: 500; min-width: 60px; text-align: center; }

/* Edit photos */
.edit-current-photos { min-height: 50px; }
.no-photos { color: var(--text-faint); font-style: italic; padding: 0.75rem; text-align: center; background: var(--bg-surface-hover); border-radius: var(--radius-sm); font-size: 0.85rem; }
.current-photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }

.current-photo-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.current-photo-item img { width: 100%; height: 100%; object-fit: cover; }
.current-photo-item.photo-removed { border-color: var(--stripe-red); }

.remove-current-photo-btn {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(223,27,65,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-current-photo-btn:hover { background: var(--stripe-red); }
.current-photo-item.photo-removed .remove-current-photo-btn { background: rgba(99,91,255,0.9); }

/* Referral styles */
.referral-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.referral-container h3 { margin: 0 0 0.75rem 0; color: var(--text-primary); font-size: 1rem; font-weight: 600; }
.referral-description { margin: 0 0 0.75rem 0; color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.referral-code-section { text-align: center; }
.referral-code-display { display: none; }
.referral-code-display label { display: block; margin-bottom: 0.4rem; color: var(--text-secondary); font-weight: 500; font-size: 0.85rem; }

.referral-code-container { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }

.referral-code-container input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--stripe-purple);
    border-radius: var(--radius-md);
    background: var(--bg-surface-hover);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.referral-stats { margin-bottom: 0.75rem; color: var(--text-muted); font-size: 0.85rem; }
.referral-share .btn { min-width: 100px; }

/* Navigation */
.navigation-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.navigation-section h3 { margin: 0 0 0.75rem; color: var(--text-primary); font-size: 1rem; }
.navigation-links { display: flex; flex-direction: column; gap: 0.5rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.15s;
    border: 1px solid transparent;
}

.nav-link:hover { background: var(--bg-surface); border-color: var(--stripe-purple); }
.nav-icon { font-size: 1.25rem; min-width: 1.5rem; text-align: center; }
.nav-content { flex: 1; }
.nav-title { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }
.nav-description { font-size: 0.75rem; color: var(--text-faint); }

/* Stats */
.quick-stats-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.quick-stats-container h3 { margin: 0 0 0.75rem; color: var(--text-primary); font-size: 1rem; }
.quick-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--stripe-purple);
    border-radius: var(--radius-md);
    color: white;
}

.stat-value { display: block; font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; opacity: 0.85; }

.info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.15s;
}

.info-card:hover { border-color: var(--stripe-purple); box-shadow: var(--shadow-sm); }
.info-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.info-card h4 { margin: 0 0 0.3rem; color: var(--text-primary); font-size: 0.95rem; }
.info-card p { margin: 0; color: var(--text-muted); font-size: 0.8rem; line-height: 1.4; }

.quick-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 768px) {
    .header-container { padding: 0.6rem 1rem; }
    .header-content { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
    .header-text h1 { font-size: 1rem; }
    .header-text p { display: none; }
    .header-actions { gap: 0.5rem; }
    .leaderboard-btn { padding: 0.4rem 0.6rem; font-size: 0.75rem; }

    .container { padding: 0.75rem; }
    .content-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh auto;
        height: auto;
        gap: 0.75rem;
    }

    .action-bar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .country-selector { min-width: 140px; font-size: 0.8rem; padding: 0.4rem 0.5rem; }
    .add-location-group { flex-direction: column; gap: 0.2rem; align-items: flex-start; }
    .add-location-hint { display: none; }
    .location-count { margin-left: auto; font-size: 0.8rem; }

    .btn { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
    .list-container { padding: 1rem; }
    .list-container h3 { font-size: 0.9rem; }
    .location-item { padding: 0.75rem; }

    .form-row { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; }
    .auth-form { padding: 1rem; }
    .modal-content { margin: 2% auto; width: 95%; max-height: 95vh; }
    .modal-header { padding: 1rem 1.25rem; }
    .modal-header h2 { font-size: 1rem; }
    #addLocationForm, #editLocationForm { padding: 1.25rem; }
}

@media (max-width: 480px) {
    .header-text h1 { font-size: 0.95rem; }
    .header-actions { gap: 0.4rem; }
    .content-wrapper { grid-template-rows: 45vh auto; }
    .country-selector { min-width: 120px; }
    .popup-owner-actions { flex-direction: column; }
    .popup-owner-actions .edit-btn, .popup-owner-actions .delete-btn { width: 100%; justify-content: center; }
    .photo-preview { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
    .current-photos-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
    .user-profile { padding: 0.3rem 0.5rem; }
    .user-nickname { font-size: 0.75rem; }
    .user-stats { font-size: 0.65rem; }
    .user-avatar { width: 24px; height: 24px; }
}

/* Dark mode specific overrides */
[data-theme="dark"] .map-container {
    border-color: var(--border);
}

[data-theme="dark"] .leaflet-tile-pane {
    filter: brightness(0.8) contrast(1.1) saturate(0.8);
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

[data-theme="dark"] .leaflet-popup-tip {
    background: var(--bg-elevated);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-elevated);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .country-selector {
    background: var(--bg-input);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

[data-theme="dark"] .btn-outline {
    border-color: var(--stripe-purple);
    color: var(--stripe-purple);
}

[data-theme="dark"] .btn-google {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-secondary);
}

[data-theme="dark"] .popup-title {
    color: var(--text-primary);
}

[data-theme="dark"] .suggestion-title {
    color: var(--text-primary);
}

[data-theme="dark"] .location-item:not(.active) {
    background: var(--bg-surface);
}

[data-theme="dark"] .location-item:not(.active) .location-name {
    color: var(--text-primary);
}
