body {
    margin: 0;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1a1a2e;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 50%, #5B21B6 100%);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: 0 4px 20px rgba(91, 33, 182, 0.25);
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

h1 .version {
    font-size: 0.5em;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    margin-left: 6px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.search-container {
    position: relative;
    display: flex;
    flex: 1;
    max-width: 480px;
    min-width: 200px;
    gap: 0;
}

#search {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 28px 0 0 28px;
    font-size: 0.95rem;
    font-weight: 400;
    outline: none;
    background: rgba(255,255,255,0.98);
    color: #1a1a2e;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

#search::placeholder {
    color: #a1a1aa;
    font-weight: 400;
}

#search:focus {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.25), inset 0 1px 2px rgba(0,0,0,0.05);
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.autocomplete-item:first-child {
    border-radius: 12px 12px 0 0;
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #f0f4ff;
}

.autocomplete-label {
    font-weight: 500;
    color: #1a1a1a;
}

.autocomplete-type {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 3px;
}

#search-btn {
    padding: 14px 24px;
    background: #fff;
    color: #7C3AED;
    border: none;
    border-radius: 0 28px 28px 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
}

#search-btn:hover {
    background: #faf5ff;
    color: #5B21B6;
    transform: translateX(2px);
}

#search-btn:active {
    background: #ede9fe;
    transform: scale(0.97);
}

.filter-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.filter-btn:active {
    background: rgba(255,255,255,0.35);
    transform: scale(0.97);
}

.filter-btn.active {
    background: #fff;
    color: #7C3AED;
    border-color: #fff;
    font-weight: 600;
}

main {
    flex: 1;
    position: relative;
}

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

#loading {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 10px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

#loading.compact {
    padding: 10px 14px;
    font-size: 0.8rem;
    gap: 8px;
}

#loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #7C3AED;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading.compact::before {
    width: 14px;
    height: 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    font-weight: 500;
    z-index: 1000;
}

.hidden {
    display: none !important;
}

.popup-content {
    max-width: 220px;
    font-family: inherit;
}

.popup-content p {
    margin: 6px 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.popup-content strong {
    color: #1f2937;
}

.directions-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.directions-btn:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
    transform: translateY(-1px);
}

.directions-btn:active {
    background: linear-gradient(135deg, #6D28D9 0%, #4C1D95 100%);
    transform: scale(0.97);
}

.locate-btn {
    width: 34px;
    height: 34px;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.locate-btn:hover {
    background: #f4f4f4;
}

.locate-btn:active {
    background: #e5e7eb;
    transform: scale(0.95);
}

.locate-btn svg {
    width: 18px;
    height: 18px;
    fill: #333;
}

.locate-btn.locating svg {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Responsive */
@media (max-width: 640px) {
    header {
        padding: 10px 12px;
        gap: 10px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .search-container {
        flex: 1 1 100%;
        max-width: none;
        order: 2;
    }

    #search {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    #search-btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .filter-container {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .filter-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    header {
        padding: 8px 10px;
    }

    h1 {
        font-size: 1.1rem;
    }

    h1 small {
        display: none;
    }

    #search {
        padding: 10px 12px;
    }

    #search-btn {
        padding: 10px 12px;
    }
}

.ad-container {
    background: #f3f4f6;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e5e7eb;
}

.ad-container.hidden {
    display: none;
}

.ad-banner {
    height: 90px;
    width: 100%;
}

.ad-mobile-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 900;
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    display: none;
}

.ad-placeholder {
    color: #9ca3af;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.site-footer {
    background: #f9fafb;
    padding: 10px 20px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.site-footer a {
    color: #7C3AED;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.site-footer a:hover {
    text-decoration: underline;
}

.footer-sep {
    color: #d1d5db;
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    .ad-banner {
        height: 60px;
    }
    
    .ad-mobile-bottom {
        display: flex;
    }
    
    .ad-mobile-bottom.hidden {
        display: none;
    }
    
    .site-footer {
        position: fixed;
        bottom: 50px;
        left: 0;
        right: 0;
        z-index: 899;
        padding: 8px 20px;
    }
}