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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #faf8f0;
    color: #2c1810;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: #2c1810;
    color: #f5c518;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 70px;
    width: auto;
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 1.8rem;
    letter-spacing: 0.02em;
}

.header-text .tagline {
    color: #d4a843;
    font-style: italic;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.product-info {
    background: #3d2517;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #e8d5a3;
}

.product-info.hidden {
    display: none;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #2c1810;
    border-top: 1px solid #3d2517;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid #d4a843;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #faf8f0;
    color: #2c1810;
    outline: none;
}

.search-bar input:focus {
    border-color: #f5c518;
    box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.3);
}

.search-bar button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

#search-btn {
    background: #f5c518;
    color: #2c1810;
}

#search-btn:hover {
    background: #e0b415;
}

#locate-btn {
    background: #3d2517;
    color: #f5c518;
    border: 1px solid #d4a843;
}

#locate-btn:hover {
    background: #4e3222;
}

.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
}

#map {
    flex: 1;
    min-height: 400px;
}

#sidebar {
    width: 340px;
    background: #fff;
    border-left: 2px solid #e8d5a3;
    overflow-y: auto;
    flex-shrink: 0;
}

#sidebar h2 {
    padding: 1rem 1rem 0.5rem;
    font-size: 1.1rem;
    color: #2c1810;
    border-bottom: 2px solid #f5c518;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.store-card {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.15s;
}

.store-card:hover {
    background: #fdf6e3;
}

.store-card.out-of-stock {
    opacity: 0.55;
}

.store-address {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.store-stock {
    font-size: 0.85rem;
}

.store-stock.in-stock {
    color: #2a7d2e;
    font-weight: 600;
}

.store-stock.no-stock {
    color: #888;
}

.store-distance {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.2rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #8b6914;
}

.loading p {
    margin-top: 1rem;
    font-style: italic;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e8d5a3;
    border-top-color: #f5c518;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.popup-content h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: #2c1810;
}

.popup-content .stock {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.popup-content .stock.in-stock {
    color: #2a7d2e;
}

.popup-content .stock.no-stock {
    color: #888;
}

.popup-content .nav-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.popup-content .nav-links a {
    font-size: 0.8rem;
    color: #8b6914;
    text-decoration: none;
}

.popup-content .nav-links a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        border-left: none;
        border-top: 2px solid #e8d5a3;
        max-height: 40vh;
    }

    #map {
        min-height: 50vh;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .search-bar {
        flex-wrap: wrap;
    }

    #locate-btn {
        width: 100%;
    }
}
