* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
}

.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.search-container {
    padding: 10px 15px;
    background: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
    padding-top: max(10px, env(safe-area-inset-top));
}

.search-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-link img {
    width: 50px;
    height: auto;
    display: block;
}

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

.search-box {
    display: flex;
    gap: 10px;
    width: 100%;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    background: #f8f9fa;
    outline: none;
}

.search-btn {
    min-width: 60px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-result-count {
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.map-container {
    flex: 1;
    position: relative;
    background: #f0f0f0;
}

#map {
    position: absolute;
    inset: 0;
}

#map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: #fff;
    color: #666;
    font-size: 14px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    border: 3px solid #f3f3f3;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.detail-panel,
.search-results-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    box-shadow: 0 -5px 30px rgba(0,0,0,.15);
    transition: bottom .4s cubic-bezier(.25,.46,.45,.94);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-panel {
    z-index: 1001;
    max-height: 85vh;
}

.search-results-panel {
    z-index: 1002;
    max-height: 70vh;
}

.detail-panel.active,
.search-results-panel.active {
    bottom: 0;
}

.panel-header,
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.panel-header::after,
.results-header::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

.panel-header h3,
.results-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    flex: 1;
}

.close-panel,
.close-results {
    width: 40px;
    height: 40px;
    margin-right: -10px;
    padding: 0;
    border: 0;
    background: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-info {
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.store-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    color: #666;
    background: #f8f9fa;
    font-size: 14px;
    line-height: 1.6;
}

.store-address i {
    color: #667eea;
    margin-top: 2px;
    flex-shrink: 0;
}

.store-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 14px;
}

.detail-item .icon {
    width: 20px;
    color: #667eea;
    text-align: center;
    flex-shrink: 0;
}

.store-phone {
    color: #28a745;
    font-weight: bold;
}

.store-hours {
    color: #ff6b6b;
}

.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.nav-btn {
    padding: 15px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.nav-btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 4px 15px rgba(40,167,69,.3);
}

.nav-btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102,126,234,.3);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    padding: 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all .2s;
}

.result-item:hover,
.result-item:active {
    border-color: #667eea;
    background: #e9ecef;
    transform: translateY(-1px);
}

.result-name {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    gap: 8px;
}

.result-address {
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.result-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.result-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,.8);
    color: #555;
    font-size: 13px;
}

.result-detail i {
    color: #667eea;
    font-size: 12px;
}

.result-phone {
    color: #28a745;
    font-weight: bold;
}

.result-hours {
    color: #ff6b6b;
}

.result-distance {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(40,167,69,.1);
    color: #28a745;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.result-action-btn {
    flex: 1;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.result-action-btn.primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.result-action-btn.secondary {
    background: #667eea;
}

.user-marker {
    width: 28px;
    height: 28px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    box-shadow: 0 3px 8px rgba(102,126,234,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.back-to-user {
    position: absolute;
    right: 15px;
    bottom: 100px;
    width: 44px;
    height: 44px;
    z-index: 100;
    border-radius: 50%;
    background: #fff;
    color: #667eea;
    box-shadow: 0 3px 10px rgba(0,0,0,.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

@keyframes mkBounce {
    0% { transform: scale(0) translateY(8px); opacity: 0; }
    50% { transform: scale(1.15) translateY(-2px); opacity: 1; }
    70% { transform: scale(.95) translateY(1px); }
    100% { transform: scale(1) translateY(0); }
}

@media (min-width: 768px) {
    .search-container {
        padding: 15px 20px;
    }

    .search-input {
        padding: 14px 20px;
        font-size: 16px;
    }

    .search-btn {
        padding: 14px 25px;
        font-size: 16px;
    }

    .detail-panel,
    .search-results-panel {
        left: 50%;
        max-width: 500px;
        margin: 0 auto;
        border-radius: 12px;
        transform: translateX(-50%);
        box-shadow: 0 10px 40px rgba(0,0,0,.2);
    }

    .detail-panel.active,
    .search-results-panel.active {
        bottom: 50px;
    }
}

* {
    touch-action: manipulation;
}
