/* === 全局重置与基础 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #34a853;
    --accent: #ea4335;
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --text: #202124;
    --text-light: #5f6368;
    --border: #dadce0;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px;
    --transition: 0.3s ease;
    --font: 'Inter', sans-serif;
}

.dark-mode {
    --primary: #4a9eff;
    --primary-dark: #2b7de9;
    --secondary: #4caf50;
    --accent: #ff6b6b;
    --bg: #1a1a2e;
    --bg-alt: #16213e;
    --text: #e0e0e0;
    --text-light: #a0a0a0;
    --border: #333;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

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

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

/* === 导航栏 === */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.nav-brand a {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu li a {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-weight: 500;
    transition: background var(--transition);
}
.nav-menu li a:hover,
.nav-menu li a.active {
    background: var(--primary);
    color: #fff;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.control-btn {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text);
    transition: background var(--transition);
}
.control-btn:hover {
    background: var(--primary);
    color: #fff;
}

.template-selector select {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}

/* === 英雄区 === */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    text-align: center;
    padding: 5rem 1.5rem;
    border-radius: 0 0 var(--radius) var(--radius);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-search {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    min-width: 200px;
}

.search-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    background: var(--secondary);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.search-btn:hover {
    background: #2d8f47;
}

/* === 筛选区 === */
.filters {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.filter-group select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-secondary {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-alt);
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background var(--transition);
}
.btn-secondary:hover {
    background: var(--border);
}

/* === 车型卡片网格 === */
.car-grid {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
    padding: 3rem;
}

.car-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.car-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.car-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-alt);
}
.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}
.car-card:hover .car-image img {
    transform: scale(1.05);
}

.car-info {
    padding: 1.2rem;
}

.car-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.car-brand {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.car-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.car-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--bg-alt);
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-light);
    border: 1px solid var(--border);
}

.car-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.btn-primary {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-share {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: background var(--transition);
}
.btn-share:hover {
    background: var(--primary);
    color: #fff;
}

/* === 页脚 === */
.footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--text-light);
}
.footer-section ul li a:hover {
    color: var(--primary);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--text-light);
}
.social-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* === 管理后台样式 === */
.admin-page {
    background: var(--bg);
}

.admin-header {
    background: var(--primary);
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.admin-header h1 {
    font-size: 1.5rem;
}

.admin-nav {
    display: flex;
    gap: 1rem;
}

.admin-main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.admin-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.admin-section h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.car-form-item {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.car-form-item h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.remove-car-btn {
    margin-top: 1rem;
}

.btn-danger {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition);
}
.btn-danger:hover {
    background: #c62828;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

.success {
    background: var(--secondary);
    color: #fff;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    text-align: center;
}

.error {
    background: var(--accent);
    color: #fff;
    padding: 0.8rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    text-align: center;
}

.ai-result {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
}

/* === 登录页面 === */
.admin-login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-alt);
}

.login-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.back-link {
    text-align: center;
    margin-top: 1rem;
}

/* === 内页通用 === */
.inner-page {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.page-title {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-title p {
    color: var(--text-light);
}

/* === 响应式 === */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        gap: 0.5rem;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-controls {
        margin-top: 1rem;
        width: 100%;
        justify-content: center;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .car-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 1rem;
    }

    .hero {
        padding: 3rem 1rem;
    }

    .hero-search {
        flex-direction: column;
    }

    .search-input {
        min-width: auto;
    }
}