/* ============================================
   排排网 — 主样式表 (Mobile-First)
   同城本地口碑榜单平台
   版本: 1.0
   ============================================ */

/* ============================================
   CSS Reset & 基础变量
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --max-width: 1200px;
    --header-height: 60px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

ul, ol { list-style: none; }

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   Container
   ============================================ */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* ============================================
   Header / 顶部导航
   ============================================ */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-city {
    font-size: 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* 城市选择器 */
.city-selector {
    position: relative;
}

.city-current {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color 0.2s;
}
.city-current:hover { border-color: var(--primary); }

.city-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px;
    min-width: 360px;
    z-index: 200;
}
.city-dropdown.show { display: block; }

.city-list-title {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.city-item {
    display: block;
    padding: 6px 4px;
    text-align: center;
    font-size: 0.85rem;
    border-radius: 4px;
    color: var(--text);
    transition: all 0.2s;
}
.city-item:hover { background: var(--primary-light); color: var(--primary); }
.city-item.active { background: var(--primary); color: #fff; }

/* 导航 */
.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 6px 0;
}
.nav-link:hover { color: var(--primary); }

.btn-merchant {
    background: var(--primary);
    color: #fff !important;
    padding: 6px 16px;
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-merchant:hover { background: var(--primary-dark); }

/* ============================================
   Hero / 搜索横幅
   ============================================ */
.hero-section {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    padding: 48px 16px;
    text-align: center;
    color: #fff;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--secondary); }

.search-btn {
    padding: 12px 24px;
    background: var(--secondary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.search-btn:hover { background: #d97706; }

.search-results {
    max-width: 500px;
    margin: 8px auto 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: left;
    color: var(--text);
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    transition: background 0.15s;
}
.search-result-item:hover { background: var(--primary-light); }
.search-result-item:last-child { border-bottom: none; }

/* ============================================
   Sections
   ============================================ */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.categories-section {
    padding: 32px 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    text-align: center;
    color: var(--text);
}
.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.category-arrow {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   Hot Ranking
   ============================================ */
.hot-ranking-section {
    padding: 32px 0;
    background: var(--bg-white);
}

.hot-industry-block {
    margin-bottom: 24px;
}

.hot-industry-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.hot-industry-title a {
    color: var(--text);
}
.hot-industry-title a:hover { color: var(--primary); }

.hot-store-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hot-store-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text);
    transition: background 0.2s;
}
.hot-store-card:hover { background: var(--primary-light); }

.hot-rank {
    font-size: 1.5rem;
    width: 36px;
    text-align: center;
}

.hot-store-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hot-store-name {
    font-weight: 500;
}

.hot-store-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.star-rating { color: var(--secondary); font-weight: 600; }

/* ============================================
   Info Cards
   ============================================ */
.info-section {
    padding: 40px 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-card {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.info-icon { font-size: 2rem; margin-bottom: 8px; }

.info-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.info-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--text);
    color: var(--text-lighter);
    padding: 24px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-lighter);
    font-size: 0.85rem;
}
.footer-links a:hover { color: #fff; }

.footer-copy {
    font-size: 0.8rem;
    line-height: 1.6;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-select { cursor: pointer; }

.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 4px;
}

/* ============================================
   Alerts / Flash Messages
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ============================================
   Star Rating
   ============================================ */
.star-rating-input {
    display: flex;
    gap: 4px;
    font-size: 1.5rem;
    cursor: pointer;
}

.star-rating-input .star {
    color: #d1d5db;
    transition: color 0.15s;
    user-select: none;
}
.star-rating-input .star.active,
.star-rating-input .star:hover { color: var(--secondary); }

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    margin: 24px 0;
}

.pagination ul {
    display: flex;
    gap: 4px;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
}
.pagination li a:hover { border-color: var(--primary); color: var(--primary); }
.pagination li.active a {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================
   Cards (通用)
   ============================================ */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.card-body { padding: 20px; }

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

/* ============================================
   Badges / Tags
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.badge-verified { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-member { background: #dbeafe; color: #1e40af; }
.badge-certified { background: #ede9fe; color: #5b21b6; }

/* ============================================
   Review Item
   ============================================ */
.review-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}
.review-item:last-child { border-bottom: none; }

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-user {
    font-weight: 500;
    font-size: 0.9rem;
}

.review-rating {
    color: var(--secondary);
    font-weight: 600;
}

.review-meta {
    font-size: 0.8rem;
    color: var(--text-lighter);
    display: flex;
    gap: 8px;
}

.review-content {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 8px;
}

.review-tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.75rem;
    border-radius: 3px;
}
.review-tag.verified {
    background: #d1fae5;
    color: #065f46;
}
.review-tag.tourist {
    background: #f1f5f9;
    color: #64748b;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
}

.modal-body { padding: 20px; }

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* ============================================
   404 Page
   ============================================ */
.error-page {
    text-align: center;
    padding: 80px 16px;
}
.error-page h1 { font-size: 4rem; color: var(--primary); margin-bottom: 16px; }
.error-page p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 24px; }

/* ============================================
   Responsive — 平板
   ============================================ */
@media (min-width: 768px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .info-grid { grid-template-columns: repeat(4, 1fr); }
    .hero-title { font-size: 2.2rem; }
    .hot-store-list { flex-direction: row; flex-wrap: wrap; }
    .hot-store-card { flex: 0 0 calc(33.33% - 8px); }
}

/* ============================================
   Responsive — 手机
   ============================================ */
@media (max-width: 767px) {
    .header-nav { gap: 8px; }
    .header-nav .nav-link { font-size: 0.8rem; }
    .btn-merchant { padding: 4px 10px; font-size: 0.8rem; }

    .city-grid { grid-template-columns: repeat(3, 1fr); }
    .city-dropdown { min-width: 280px; left: 0; transform: none; }

    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .info-grid { grid-template-columns: repeat(2, 1fr); }

    .hero-title { font-size: 1.4rem; }
    .hero-subtitle { font-size: 0.9rem; }

    .hot-store-card { flex-direction: column; text-align: center; }
    .hot-store-info { flex-direction: column; gap: 4px; }

    .logo-text { font-size: 1.1rem; }
    .logo-city { display: none; }

    .footer-links { flex-direction: column; gap: 8px; }
}

/* ============================================
   Responsive — 小手机
   ============================================ */
@media (max-width: 480px) {
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-card { padding: 16px 8px; }
    .category-icon { font-size: 1.5rem; }
    .category-name { font-size: 0.95rem; }

    .search-input { font-size: 0.9rem; }
    .search-btn { padding: 12px 16px; font-size: 0.9rem; }
}
