/* === Hanoi Food Map — Styles === */

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

:root {
    --nav-h: 48px;
    --accent: #00d4aa;
    --accent-dark: #00b894;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --text: #e8e8e8;
    --text-dim: #a0a0b0;
    --danger: #e74c3c;
    --radius: 10px;
    --radius-sm: 6px;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg-dark);
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* === NAV === */
#nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(26, 26, 46, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-right { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--accent);
    color: #000;
}

/* === SEARCH BAR === */
#search-bar {
    position: fixed;
    top: calc(var(--nav-h) + 10px);
    left: 12px;
    right: 12px;
    z-index: 600;
    max-width: 420px;
}

#search-input {
    width: 100%;
    background: rgba(26, 26, 46, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 24px;
    color: var(--text);
    padding: 10px 36px 10px 38px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0, 212, 170, 0.15);
}

#search-input::placeholder { color: var(--text-dim); }

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
    z-index: 1;
}

#search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    z-index: 1;
}

#search-clear:hover { color: var(--text); }

#search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: rgba(26, 26, 46, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.search-item {
    padding: 14px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(255,255,255,0.06); }

.search-name {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.35;
    display: block;
}

.search-empty {
    cursor: default;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
}

.search-empty:hover { background: transparent; }

/* === MAP === */
#map {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0; bottom: 0;
    z-index: 1;
}

/* === FAB === */
#fab {
    position: fixed;
    bottom: 24px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.4);
    cursor: pointer;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#fab:active { transform: scale(0.92); }
#fab:hover { box-shadow: 0 6px 24px rgba(0, 212, 170, 0.5); }

/* === CROSSHAIR === */
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 600;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* === ADD BANNER === */
#add-banner {
    position: fixed;
    bottom: 24px;
    left: 12px; right: 12px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(8px);
    padding: 12px 16px;
    text-align: center;
    z-index: 500;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

#add-banner p {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.add-banner-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    border: none;
    color: #000;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* === BOTTOM SHEET === */
#sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 800;
}

#sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 85vh;
    background: var(--bg-dark);
    border-radius: 16px 16px 0 0;
    padding: 12px 16px 24px;
    z-index: 900;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 12px;
}

#sheet h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    text-align: center;
}

/* === FORM === */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

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

.form-row {
    display: flex;
    gap: 12px;
}

.form-group.half { flex: 1; }

.price-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-row input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 8px;
    font-size: 0.9rem;
    outline: none;
    width: 0;
}

.price-row input:focus { border-color: var(--accent); }
.price-row span { color: var(--text-dim); font-size: 0.9rem; }

/* === PILLS === */
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pill:hover { border-color: var(--accent); color: var(--text); }

.pill.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

/* === PHOTO AREA === */
.photo-area {
    position: relative;
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
}

#photo-preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* === SUBMIT BUTTON === */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === FORM ERROR === */
.form-error {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* === MARKER DOT === */
.marker-icon { background: none !important; border: none !important; }

.marker-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    margin: 2px;
}

/* === POPUP === */
.popup { min-width: 180px; }

.popup-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.popup-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #1a1a2e;
}

.popup-badge {
    display: inline-block;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.popup-detail {
    font-size: 0.8rem;
    color: #444;
    margin: 3px 0;
    line-height: 1.4;
}

/* === LEAFLET OVERRIDES === */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25) !important;
}

.leaflet-popup-content { margin: 10px !important; }

/* === DESKTOP (wider than 600px) === */
@media (min-width: 600px) {
    #sheet {
        max-width: 420px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px;
        bottom: 16px;
        max-height: 80vh;
        animation: slideUpDesktop 0.3s ease-out;
    }

    @keyframes slideUpDesktop {
        from { transform: translateX(-50%) translateY(100%); }
        to { transform: translateX(-50%) translateY(0); }
    }

    #search-bar {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    #fab {
        bottom: 32px;
        right: 24px;
    }
}
