/* ============================================
   Visit Morocco Map — Design System
   Black & White with premium feel
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-hover: #222222;
    --bg-overlay: rgba(0, 0, 0, 0.85);

    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;

    --accent: #ffffff;
    --accent-dim: rgba(255, 255, 255, 0.15);
    --accent-glow: rgba(255, 255, 255, 0.08);

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.05);

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-height: 60px;
    --filter-height: 48px;
}

:root.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-hover: #e0e0e0;
    --bg-overlay: rgba(255, 255, 255, 0.85);

    --text-primary: #111111;
    --text-secondary: #444444;
    --text-muted: #888888;

    --accent: #000000;
    --accent-dim: rgba(0, 0, 0, 0.05);
    --accent-glow: rgba(0, 0, 0, 0.08);

    --border: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* --- Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.logo svg {
    color: var(--text-primary);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.logo h1 span {
    font-weight: 300;
    opacity: 0.6;
}

.tagline {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 400;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Counter */
.counter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
}

.counter-number {
    font-weight: 700;
    font-size: 0.9rem;
}

.counter-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
}

/* Language Switcher */
.lang-switch {
    display: flex;
    gap: 2px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 3px;
    border: 1px solid var(--border);
}

.lang-btn {
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    border-radius: var(--radius-xl);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

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

.lang-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

/* Theme Switcher */
.theme-switch {
    display: flex;
    align-items: center;
}

.theme-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-xl);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.theme-btn .hidden {
    display: none;
}

/* Authentication Box */
.auth-box {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.btn-login {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid var(--text-primary);
}

.btn-login:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.user-avatar-btn {
    width: 30px;
    height: 30px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.user-avatar-btn:hover {
    border-color: var(--text-primary);
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

/* Profile Overlay */
.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 2000;
    transition: opacity var(--transition-fast);
}

.profile-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Profile Panel */
.profile-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 90vw;
    height: 100vh;
    z-index: 2001;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform var(--transition-slow);
}

.profile-panel.hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.profile-header h3 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

.profile-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-body {
    flex: 1;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

.profile-avatar-big {
    width: 64px;
    height: 64px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.profile-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 28px;
    word-break: break-all;
}

.profile-form {
    width: 100%;
}

.profile-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.profile-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: var(--font-family);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.profile-save {
    width: 100%;
    padding: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-family);
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 12px;
}

.profile-save:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.profile-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.profile-msg {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 500;
    margin: 0 0 8px;
    padding: 8px;
    border-radius: var(--radius-md);
}

.profile-msg.success {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}

.profile-msg.error {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.profile-logout {
    margin-top: auto;
    padding: 10px 24px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    margin-top: 24px;
}

.profile-logout:hover {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, 0.05);
}

/* --- Volunteer section --- */
.volunteer-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.volunteer-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.volunteer-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
}
.volunteer-status.success { color: #22c55e; }
.volunteer-status.warn { color: #f59e0b; }
.volunteer-status.error { color: #ef4444; }
.volunteer-actions { display: flex; flex-direction: column; gap: 8px; }
.volunteer-apply-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.volunteer-apply-form.hidden { display: none; }
.volunteer-link {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.78rem;
}
.volunteer-link:hover { background: var(--bg-hover); }
.volunteer-link.hidden { display: none; }

/* Suggest-edit button on detail panel */
.detail-suggest {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.detail-suggest:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.detail-suggest.hidden { display: none; }

/* Submission panel */
.submission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 2500;
}
.submission-overlay.hidden { display: none; }

.submission-panel {
    position: fixed;
    top: 5vh;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(640px, 92vw);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2600;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.submission-panel.hidden { display: none; }

.submission-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.submission-header h3 { font-size: 1rem; font-weight: 600; }
.submission-body { padding: 16px 18px; overflow-y: auto; flex: 1; }

.submission-field { display: flex; flex-direction: column; margin-bottom: 14px; }
.submission-field label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.submission-field input,
.submission-field textarea,
.submission-field select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: var(--font-family);
    font-size: 0.85rem;
}
.submission-field textarea { min-height: 80px; resize: vertical; }
.submission-field .field-error {
    color: #ef4444;
    font-size: 0.7rem;
    margin-top: 4px;
}
.submission-field.sensitive {
    padding-left: 8px;
    border-left: 2px solid #f59e0b;
}
.submission-sensitive-note {
    font-size: 0.72rem;
    color: #f59e0b;
    margin-bottom: 12px;
}

.submission-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
}
.submission-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    cursor: pointer;
}
.submission-btn.primary {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 600;
}
.submission-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.submission-msg {
    padding: 0 18px 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.submission-msg.error { color: #ef4444; }
.submission-msg.success { color: #22c55e; }

.submission-list { display: flex; flex-direction: column; gap: 10px; }
.submission-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}
.submission-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
}
.submission-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.submission-badge.pending { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.submission-badge.approved { background: rgba(34, 197, 94, 0.18); color: #22c55e; }
.submission-badge.rejected { background: rgba(239, 68, 68, 0.18); color: #ef4444; }
.submission-badge.withdrawn { background: rgba(148, 163, 184, 0.18); color: var(--text-muted); }
.submission-item-fields { font-size: 0.72rem; color: var(--text-muted); }
.submission-item-notes { font-size: 0.72rem; margin-top: 6px; color: var(--text-secondary); }
.submission-withdraw {
    background: transparent;
    border: 0;
    color: #ef4444;
    font-size: 0.7rem;
    cursor: pointer;
    margin-top: 4px;
    padding: 0;
}
.submission-withdraw:hover { text-decoration: underline; }

.submission-photos {
    margin: 6px 0 16px;
}
.submission-photos-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.submission-photos-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.submission-photos-input {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-hover);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.submission-photos-input input { display: none; }
.submission-photos-input:hover { background: var(--bg-hover); }
.submission-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.submission-photo {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
    aspect-ratio: 1;
}
.submission-photo img { width: 100%; height: 100%; object-fit: cover; }
.submission-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.submission-photo-pending {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* --- Search Box --- */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.search-input {
    width: 220px;
    height: 32px;
    padding: 0 28px 0 30px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.78rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-clear.hidden,
.search-results.hidden {
    display: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1100;
    padding: 6px 0;
}

.search-section-title {
    padding: 8px 14px 4px;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.search-item:hover,
.search-item.active {
    background: var(--bg-hover);
}

.search-item-icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.search-item-text {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-item-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-empty {
    padding: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    .search-input {
        width: 150px;
        font-size: 0.72rem;
    }
    .search-results {
        width: 260px;
    }
}

@media (max-width: 480px) {
    .search-box {
        order: -1;
        flex: 1 1 auto;
    }
    .search-input {
        width: 100%;
    }
    .search-results {
        right: auto;
        left: 0;
        width: calc(100vw - 24px);
    }
}

/* --- Filter Bar --- */
#filter-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 999;
    height: var(--filter-height);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.filter-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 600;
}

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

/* --- Map --- */
main {
    position: fixed;
    top: calc(var(--header-height) + var(--filter-height));
    left: 0;
    right: 0;
    bottom: 0;
}

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

/* Leaflet overrides for dark theme */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
    transition: all var(--transition-fast);
}

.leaflet-control-zoom a:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-hover) !important;
}

.leaflet-control-zoom-in {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    border-top: none !important;
}

.leaflet-control-attribution {
    background: var(--bg-overlay) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

/* Custom marker wrapper */
.custom-marker {
    position: relative;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: var(--text-primary);
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-fast);
    border: 2px solid var(--bg-primary);
}

.marker-pin::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    filter: blur(2px);
}

.marker-pin .marker-emoji {
    transform: rotate(45deg);
    font-size: 14px;
    line-height: 1;
}

.marker-featured .marker-pin {
    width: 38px;
    height: 38px;
    background: var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 2px 10px rgba(0, 0, 0, 0.4);
    animation: pulse-marker 2s infinite;
}

.marker-pin.marker-locked {
    width: 26px;
    height: 26px;
    background: rgba(120, 120, 120, 0.55);
    border-color: rgba(200, 200, 200, 0.35);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    opacity: 0.75;
    animation: none;
    cursor: pointer;
}

.marker-pin.marker-locked .marker-emoji {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    filter: grayscale(1);
}

.marker-pin.marker-locked:hover {
    opacity: 1;
    background: rgba(140, 140, 140, 0.75);
}

@keyframes pulse-marker {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 2px 10px rgba(0, 0, 0, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 255, 255, 0.5), 0 2px 10px rgba(0, 0, 0, 0.4); }
}

/* Marker Avatar Image Pin */
.marker-avatar {
    box-sizing: border-box;
    width: 48px;
    height: 48px;
    background: var(--bg-primary);
    border-radius: 50%;
    border: 3px solid var(--text-primary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    position: relative;
    transition: all var(--transition-fast);
}

.marker-avatar::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 8px 0 8px;
    border-style: solid;
    border-color: var(--text-primary) transparent transparent transparent;
}

.marker-img-clip {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.leaflet-container .marker-img-clip img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    display: block;
}

.marker-avatar.marker-featured {
    width: 56px;
    height: 56px;
    border: 4px solid var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 4px 10px rgba(0, 0, 0, 0.5);
    animation: pulse-marker 2s infinite;
}
.marker-avatar.marker-featured::after {
    bottom: -13px;
    border-width: 12px 10px 0 10px;
}

/* Map Scaling at Country Level */
.zoom-low .marker-avatar {
    transform: scale(0.6);
    transform-origin: 50% calc(100% + 11px);
}
.zoom-low .marker-featured .marker-avatar {
    transform: scale(0.6);
    transform-origin: 50% calc(100% + 13px);
}
.zoom-low .marker-pin {
    transform: scale(0.6) rotate(-45deg);
    transform-origin: 100% 100%; 
}

/* Leaflet popup override */
.leaflet-popup {
    display: none !important;
}

/* Custom City Labels Overlay */
.city-label-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.city-label {
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 0 10px var(--bg-primary), 0 0 10px var(--bg-primary), 0 0 10px var(--bg-primary);
    white-space: nowrap;
    opacity: 0.8;
    pointer-events: none;
    transition: all var(--transition-base);
    transform: translate(-50%, -50%);
}

.city-label.major {
    font-size: 1.25rem;
    font-weight: 700;
    opacity: 0.9;
}

/* --- Detail Panel --- */
.detail-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    max-height: 55vh;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(0);
    transition: transform var(--transition-slow), opacity var(--transition-slow);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.detail-panel.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 100;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.detail-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

.detail-content {
    padding: 0 0 24px 0;
}

/* Handle bar */
.detail-panel::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* --- Image Carousel --- */
.detail-carousel {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform var(--transition-slow);
}

.carousel-track img {
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
}

.carousel-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}

.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.carousel-dot.active {
    background: var(--text-primary);
    width: 16px;
    border-radius: 3px;
}

/* No images placeholder */
.carousel-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Detail Info --- */
.detail-info {
    padding: 20px 24px 0;
}

.detail-category {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg-primary);
    background: var(--text-primary);
    border-radius: var(--radius-xl);
    margin-bottom: 10px;
}

.detail-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
}

.detail-rating {
    margin: 0 0 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.rating-copy {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 8px;
}

.rating-average {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.rating-stars {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
}

.rating-star {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #facc15;
    font-family: var(--font-family);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.08);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.rating-star:hover,
.rating-star:focus-visible {
    color: #fde047;
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.62);
    box-shadow: 0 6px 18px rgba(250, 204, 21, 0.18);
    transform: translateY(-2px) scale(1.08);
    outline: none;
}

.rating-star.active {
    color: #facc15;
    background: rgba(250, 204, 21, 0.14);
    border-color: rgba(250, 204, 21, 0.7);
    box-shadow: 0 4px 14px rgba(250, 204, 21, 0.15);
}

.rating-star:disabled {
    cursor: wait;
    opacity: 0.75;
    transform: none;
}

.rating-status {
    min-height: 1rem;
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rating-status.success {
    color: #4ade80;
}

.rating-status.error {
    color: #f87171;
}

.rating-status a {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--border-hover);
}

.detail-description {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.detail-coords {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.02em;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.detail-directions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 1px solid var(--text-primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    cursor: pointer;
}

.detail-directions:hover,
.detail-directions:focus-visible {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-hover);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
    outline: none;
}

.detail-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.detail-more:hover,
.detail-more:focus-visible {
    background: var(--bg-card);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    outline: none;
}

.detail-more.hidden {
    display: none;
}

.detail-comments {
    margin-top: 18px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.comments-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.comments-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.72rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    color: var(--text-muted);
}

.comment-body {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.comments-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.comments-empty.hidden {
    display: none;
}

.comment-form {
    margin-top: 14px;
}

.comment-input {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    padding: 12px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.84rem;
    line-height: 1.5;
}

.comment-input:focus {
    outline: none;
    border-color: var(--border-hover);
}

.comment-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comment-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.comment-status {
    min-height: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-status.success {
    color: #4ade80;
}

.comment-status.error {
    color: #f87171;
}

.comment-submit {
    min-width: 120px;
    min-height: 38px;
    padding: 0 14px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: 1px solid var(--text-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.comment-submit:hover,
.comment-submit:focus-visible {
    opacity: 0.92;
    transform: translateY(-1px);
    outline: none;
}

.comment-submit:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    transition: opacity 0.6s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader-pin {
    animation: bounce-pin 1.2s infinite;
    color: var(--text-primary);
    margin-bottom: 16px;
}

@keyframes bounce-pin {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-16px); }
    60% { transform: translateY(-8px); }
}

.loader p {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 400;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .tagline {
        display: none;
    }

    #site-header {
        padding: 0 10px;
        gap: 8px;
    }

    .header-left {
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .header-right {
        gap: 8px;
        flex: 0 0 auto;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .counter {
        display: none;
    }

    .auth-box {
        margin-left: 0;
    }

    #filter-bar {
        padding: 0 12px;
        gap: 4px;
    }

    .filter-btn {
        padding: 5px 10px;
        font-size: 0.68rem;
    }
}

@media (max-width: 420px) {
    .logo h1 {
        font-size: 0.9rem;
    }

    .logo svg {
        width: 22px;
        height: 22px;
    }

    .btn-login {
        padding: 5px 10px;
        font-size: 0.65rem;
    }

    .lang-btn {
        padding: 3px 8px;
    }

    #site-header {
        padding: 0 8px;
        gap: 6px;
    }

    .header-right {
        gap: 6px;
    }

    .detail-panel {
        max-height: 65vh;
    }

    .detail-carousel {
        height: 180px;
    }

    .detail-title {
        font-size: 1.2rem;
    }

    .detail-info {
        padding: 16px 16px 0;
    }
}

@media (min-width: 769px) {
    .detail-panel {
        left: auto;
        right: 20px;
        bottom: 20px;
        width: 400px;
        max-height: calc(100vh - var(--header-height) - var(--filter-height) - 40px);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border);
    }

    .detail-panel.hidden {
        transform: translateX(120%);
    }
}

@media (min-width: 1200px) {
    .detail-panel {
        width: 440px;
    }

    .detail-carousel {
        height: 260px;
    }
}

/* --- Scrollbar --- */
.detail-panel::-webkit-scrollbar {
    width: 4px;
}

.detail-panel::-webkit-scrollbar-track {
    background: transparent;
}

.detail-panel::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

/* Map header blog link */
.map-blog-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}
.map-blog-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
@media (max-width: 720px) {
    .map-blog-link { display: none; }
}
