:root {
    --bg: #ffffff;
    --surface: rgba(255,255,255,0.96);
    --surface-solid: #ffffff;
    --border: rgba(0,0,0,0.08);
    --text: #111111;
    --text-muted: #666;
    --ice: #0284c7;
    --top-bar-height: 52px;
    --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body.dark-theme {
    --bg: #070709;
    --surface: rgba(20,20,25,0.94);
    --surface-solid: #141416;
    --border: rgba(255,255,255,0.07);
    --text: #f0f0f0;
    --text-muted: #888;
    --ice: #38bdf8;
    --shadow: 0 2px 16px rgba(0,0,0,0.5);
}

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

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    height: 100vh; width: 100vw;
    overflow: hidden; position: fixed;
    background: var(--bg);
}

#top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--top-bar-height);
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 500;
    box-shadow: var(--shadow);
}

#app-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--ice);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

#top-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

#add-btn {
    background: var(--ice);
    border: none;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Outfit', inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0 12px;
    height: 32px;
    transition: opacity 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

#add-btn:hover { opacity: 0.85; }

#gps-btn {
    background: #ef4444;
    border: none;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Outfit', inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0 12px;
    height: 32px;
    transition: opacity 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#gps-btn:hover { opacity: 0.85; }

#lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 0 9px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

#lang-btn:hover { border-color: var(--ice); color: var(--ice); }

#theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    width: 32px; height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#theme-btn:hover { border-color: var(--ice); color: var(--ice); }

#map {
    position: fixed;
    top: var(--top-bar-height);
    left: 0; right: 0;
    bottom: 250px;
    z-index: 1;
}

@media (min-width: 768px) {
    #map { bottom: 90px; }
}

body.dark-theme #map {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(85%);
}

body.dark-theme .leaflet-control,
body.dark-theme .leaflet-popup-content-wrapper,
body.dark-theme .leaflet-popup-tip {
    filter: invert(100%) hue-rotate(180deg);
}

.user-location-icon { background: none !important; border: none !important; }

#ad-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 600;
    background: var(--surface);
    border-top: 1px solid var(--border);
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

@media (min-width: 768px) {
    #ad-banner { height: 90px; }
}

.mobile-ad { display: block; }
.desktop-ad { display: none; }

@media (min-width: 768px) {
    .mobile-ad { display: none; }
    .desktop-ad { display: block; }
}

.leaflet-popup-content-wrapper {
    background: var(--surface-solid) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    font-family: 'Outfit', sans-serif !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12) !important;
}

.leaflet-popup-tip { background: var(--surface-solid) !important; }
.leaflet-popup-content { margin: 10px 14px !important; }

#add-modal {
    position: fixed; inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 1rem;
}

#add-modal.hidden { display: none; }

#add-card {
    background: var(--surface-solid);
    border-radius: 16px;
    width: 100%; max-width: 440px;
    padding: 0 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

#add-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0 14px;
    font-size: 0.92rem; font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

#add-header button {
    background: none; border: none;
    color: var(--text-muted); font-size: 1rem;
    cursor: pointer; font-family: inherit;
}

.add-field { margin-bottom: 14px; }

.add-field label {
    display: block; font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.8px; text-transform: uppercase;
    color: var(--ice); margin-bottom: 5px;
}

.add-field input {
    width: 100%; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-family: inherit;
    font-size: 0.9rem; font-weight: 300; padding: 10px 12px;
    outline: none; transition: border-color 0.2s;
}

.add-field input:focus { border-color: var(--ice); }

#add-submit {
    width: 100%; background: var(--ice); border: none; color: #fff;
    border-radius: 10px; cursor: pointer; font-family: inherit;
    font-size: 0.88rem; font-weight: 600; padding: 12px;
    transition: opacity 0.2s; margin-bottom: 10px;
}

#add-submit:hover { opacity: 0.88; }

#add-success {
    font-size: 0.85rem; color: var(--ice);
    font-weight: 500; text-align: center; padding: 6px 0;
}

#add-success.hidden { display: none; }

.leaflet-tile-pane { }
.leaflet-tooltip {
    background: rgba(0,0,0,0.65) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.75rem !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
}
.leaflet-tooltip-top:before { border-top-color: rgba(0,0,0,0.65) !important; }

#map {
    filter: brightness(0.95) contrast(1.05);
}

body.dark-theme #map {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(85%);
}

#footer-links {
    position: fixed;
    bottom: 320px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    font-size: 0.72rem;
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

#footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

#footer-links a:hover { color: var(--ice); }

@media (min-width: 768px) {
    #footer-links { bottom: 100px; }
}
