/* style.css - AutoParts Pro 项目统一样式表 */
/* 整合自：admin.html, index.html, part_detail.html 及原有 style.css */

/* ============================================
   第一部分：全局、基础与通用组件样式
   ============================================ */
:root {
    /* 主色调定义 - 主要来自 admin.html */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    /* 详情页补充色调 - 来自 part_detail.html */
    --primary-blue: #0d47a1;
    --secondary-blue: #1565c0;
    /* 前台首页色调 */
    --frontend-primary: #1e3a8a;
    --frontend-secondary: #3b82f6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 页脚通用样式 */
footer.bg-dark {
    background-color: #1a1a1a !important;
    color: white;
}

/* 通用卡片样式 */
.generic-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

/* 通用标题样式 */
.section-title {
    color: var(--primary-blue);
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* 通用信息框样式 */
.info-box {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* 通用返回链接样式 */
.back-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.back-link:hover {
    text-decoration: underline;
}

/* ============================================
   第二部分：后台管理页面 (admin.html) 样式
   ============================================ */

/* 导航与头部 */
.navbar-dark.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.header-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    padding: 2rem 0;
    border-bottom: 4px solid var(--secondary-color);
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 管理卡片 */
/* 1. 设置父容器为 Flex 布局 */
.list-header-wrapper {
    display: flex;             /* 开启弹性布局 */
    justify-content: space-between; /* 两端对齐：标题在左，搜索框在右 */
    align-items: center;       /* 垂直居中对齐 */
    margin-bottom: 20px;       /* 底部留白，替代原来 h3 的 mb-4 */
}
/* 2. 调整标题的样式 */
.list-header-wrapper h3 {
    margin-bottom: 0;          /* 移除 h3 默认的底部间距，防止不对齐 */
    font-size: 1.2rem;         /* 根据需要调整大小 */
}
/* 3. 调整搜索框的样式 */
.search-input {
    padding: 6px 12px;         /* 内边距 */
    border: 1px solid #ced4da; /* 边框颜色 */
    border-radius: 4px;        /* 圆角 */
    font-size: 0.9rem;         /* 字体大小 */
    outline: none;             /* 移除点击时的轮廓 */
}

/* 搜索框获得焦点时的样式（可选） */
.search-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.admin-card {
    max-height: 1040px;
    overflow-y: auto;
    &::-webkit-scrollbar {
        width: 8px;
    }
    &::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 25px;
    margin-bottom: 25px;
}
.form-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* 按钮 */
.btn-custom-primary {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.btn-custom-primary:hover {
    background-color: #2980b9;
    color: white;
}

.action-buttons .btn {
    margin-right: 5px;
}

/* 图片上传与预览 */
.part-img-preview {
    height: 250px;
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background-color: #f8f9fa;
}

.thumbnail-item {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}
.thumbnail-item:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}
.thumbnail-item.active {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}
.image-upload-area:hover {
    border-color: var(--secondary-color);
}
.image-upload-area i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.image-data-info {
    font-size: 0.85rem;
    color: #666;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

/* 车型适配与表格 */
.fitment-row {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--secondary-color);
}

.parts-table th {
    background-color: var(--primary-color);
    color: white;
}

.model-fitment-header {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    border-radius: 5px 5px 0 0;
}

/* ============================================
   第三部分：前台首页 (index.html) 样式
   ============================================ */

/* 导航栏 */
.navbar-custom {
    background-color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0;
}
.navbar-brand-custom {
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.navbar-brand-custom i {
    color: #fbbf24;
    font-size: 1.5rem;
}

/* 搜索英雄区域 */
.search-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--frontend-primary) 0%, #1e40af 100%);
    color: white;
    text-align: center;
}
.search-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}
.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* 搜索切换与表单 (整合自原style.css) */
.search-toggle-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.search-toggle-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.search-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
.search-toggle-btn.active {
    background-color: var(--frontend-secondary);
    border-color: var(--frontend-secondary);
}

.search-form {
    display: none;
}
.search-form.active {
    display: block;
    animation: fadeIn 0.5s ease-out;
}
.search-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    padding: 1.8rem;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}
.form-label-custom {
    font-weight: 600;
    color: var(--frontend-primary);
    font-size: 0.9rem;
}
.search-btn-custom {
    background-color: var(--frontend-secondary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    transition: all 0.2s;
    width: 100%;
}
.search-btn-custom:hover {
    background-color: #2563eb;
}

/* 结果列表 */
.results-container {
    padding: 2rem 1rem;
    display: none;
}
.results-container.active {
    display: block;
}
.results-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}
.results-header h2 {
    color: var(--frontend-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.summary-list {
    max-width: 1200px;
    margin: 0 auto;
}
.summary-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}
.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--frontend-secondary);
}
.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.part-number-link {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--frontend-primary);
    text-decoration: none;
    transition: color 0.2s;
}
.part-number-link:hover {
    color: var(--frontend-secondary);
    text-decoration: underline;
}
.category-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.summary-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.info-block {
    flex: 1;
    min-width: 200px;
}
.info-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.info-value {
    font-size: 0.95rem;
    color: #333;
}
.no-results {
    text-align: center;
    padding: 4rem 1rem;
}
.no-results-icon {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

/* ============================================
   第四部分：零件详情页 (part_detail.html) 样式
   ============================================ */

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    padding: 20px 0;
}
.detail-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 20px;
}
.part-header {
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}
.part-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 10px;
}
.part-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}
.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}
/* 详情页专用分类徽章，避免与前台首页的 .category-badge 冲突 */
.detail-category-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
}
.full-width-section {
    width: 100%;
    margin-top: 30px;
}

/* 图片库 */
.thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* 关键：水平居中 */
    gap: 6px; /* 可调整缩略图之间的间距 */
    margin-top: 10px;
}
.thumbnail-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s;
    border: 2px solid transparent;
}
.thumbnail-img:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
}
.thumbnail-img.active {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.2);
}
.main-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 0;
    margin-bottom: 20px;
    border: 1px solid #eee;
    background-color: #f8f9fa;
}
.image-counter {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 3px;
}
.thumbnail-item {
    position: relative;
}

/* 车型适配表格 */
.fitment-table {
    width: 100%;
    border-collapse: collapse;
}
.fitment-table th {
    background-color: var(--primary-blue);
    color: white;
    padding: 12px 15px;
    text-align: left;
}
.fitment-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}
.fitment-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* 参考号（互换零件号） */
.interchange-badge {
    font-size: 1.4em;
    padding: 0.5em 1em;
    margin: 0.3em;
    font-weight: 600;
    background-color: #6c757d;
    color: white;
    border-radius: 4px;
    display: inline-block;
    line-height: 1.4;
    transition: all 0.2s ease;
}
.interchange-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.interchange-container {
    margin-top: 10px;
}

/* ============================================
   第五部分：原 style.css 中的搜索相关样式 (已部分整合，保留独特部分)
   ============================================ */
/* 搜索切换按钮 (来自原style.css，已用 .search-toggle-btn 等类名整合，此处可删除重复定义) */
/* 搜索表单容器 (来自原style.css，已用 .search-card 等整合) */

/* 英雄区域背景 (来自原style.css，已用 .search-hero 整合) */

/* 最新零件网格 (来自原style.css，当前HTML未使用，保留备用) */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.part-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}
.part-card:hover {
    transform: translateY(-5px);
}

/* ============================================
   第六部分：动画、工具类与响应式设计
   ============================================ */

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--frontend-secondary);
    animation: spin 1s ease-in-out infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 前台首页响应式 */
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .search-toggle-container {
        flex-wrap: wrap;
    }
    .summary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .summary-content {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    /* 详情页响应式 */
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    .thumbnail-img {
        height: 100px;
    }
    
    /* 通用管理页面响应式 */
    .content-wrapper {
        padding: 10px;
    }
    .admin-card, .generic-card {
        padding: 15px;
    }
}
/* ============================================
   Logo 图片样式
   ============================================ */

/* 导航栏中的Logo */
.navbar-logo {
    height: 40px;           /* 根据您的Logo设计调整高度 */
    width: auto;            /* 宽度自动，保持原始比例 */
    max-width: 180px;       /* 可选：设置最大宽度防止过大 */
    object-fit: contain;    /* 保持图片比例，完整显示 */
    vertical-align: middle; /* 垂直对齐 */
}

/* 详情页头部中的Logo */
.header-logo {
    height: 36px;           /* 可调整以适应标题区域 */
    width: auto;
    max-width: 160px;
    object-fit: contain;
    vertical-align: middle;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .navbar-logo {
        height: 32px;      /* 在小屏幕上减小Logo尺寸 */
        max-width: 140px;
    }
    .header-logo {
        height: 30px;
        max-width: 120px;
    }
}
/* ============================================
   后台登录界面样式
   ============================================ */

.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.5s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h3 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 导航栏联系方式专用样式 */
.navbar .contact-info {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #fff; /* 默认文字颜色 */
    font-weight: 600; /* 添加字体加粗，500为中等，600/700为更粗 */
}

/* 电话和邮箱条目的通用样式 */
.navbar .contact-info .phone,
.navbar .contact-info .email {
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* 最后一项去掉底部边距，避免多余空间 */
.navbar .contact-info .email {
    margin-bottom: 0;
}

/* 图标样式 */
.navbar .contact-info i {
    color: #e74c3c; /* Bootstrap 红色，可根据主题调整 */
    width: 1rem;
    text-align: center;
    font-size: 0.85rem;
}

/* 链接样式 */
.navbar .contact-info a {
    color: inherit; /* 继承父级颜色 */
    text-decoration: none;
    transition: color 0.2s ease;
    margin-left: 0.3rem;
    font-weight: 600; /* 确保链接文字也加粗 */
}

/* 链接悬停效果 */
.navbar .contact-info a:hover {
    color: #0d6efd; /* 悬停时变为主题色 */
    text-decoration: underline;
}

/* 响应式调整：在屏幕较小时调整字体大小和对齐方式 */
@media (max-width: 991.98px) {
    .navbar .contact-info {
        font-size: 0.85rem;
        text-align: center;
        padding-top: 0.5rem;
    }
    .navbar .contact-info .phone,
    .navbar .contact-info .email {
        justify-content: center;
    }
}
/* Header 区域联系方式样式 */
.header .contact-info {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* 控制电话和邮箱之间的间距 */
}
.header .contact-item {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}
.header .contact-item a {
    color: #fff; /* 文字设置为白色 */
    font-weight: 600; /* 文字加粗 */
    text-decoration: none;
    margin-left: 0.3rem;
    transition: opacity 0.2s ease;
}
.header .contact-item a:hover {
    opacity: 0.8; /* 悬停时轻微透明 */
    text-decoration: underline;
}
.header .contact-item i {
    color: #fff; /* 图标颜色设置为白色 */
}
/* 响应式调整：在小屏幕上堆叠显示 */
@media (max-width: 768px) {
    .header .contact-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }
}
/* 添加上移下移按钮样式 */
.move-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    margin: 2px;
}
.move-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-group-sm .btn {
    padding: 0.15rem 0.5rem;
}