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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    min-height: 100vh;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* 头部 */
.header {
    background-color: #fff;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-name {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    text-align: center;
    flex: 1;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-align: center;
}

.back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    padding: 5px 10px;
}

.back-btn:hover {
    color: #333;
}

/* 内容区域 */
.content {
    padding: 15px;
}

/* 首页样式 */
.intro-section, .contact-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.intro-section h2, .contact-section h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.intro-text {
    font-size: 15px;
    color: #666;
    line-height: 1.8;
    white-space: pre-wrap;
}

.contact-info p {
    font-size: 15px;
    margin-bottom: 10px;
}

.contact-info .label {
    font-weight: 600;
    color: #333;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    display: flex;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item.active {
    color: #007aff;
    font-weight: 600;
}

.nav-item:hover {
    background-color: #f9f9f9;
}

/* 产品列表 */
.product-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
}

.product-card:active {
    transform: scale(0.98);
}

.product-card-img {
    width: 100%;
    padding-top: 75%;
    position: relative;
    background-color: #f0f0f0;
}

.product-card-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-name {
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: #333;
}

/* 产品详情 */
.product-detail {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-detail-img {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
}

.product-detail-img img {
    width: 100%;
    display: block;
}

.product-detail-info {
    padding: 20px;
}

.product-detail-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.product-detail-desc {
    font-size: 15px;
    color: #666;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state p {
    font-size: 15px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 表单样式 */
.login-section, .admin-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background-color: #fff;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: #007aff;
}

.form-textarea {
    resize: vertical;
}

/* 按钮 */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #007aff;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0066cc;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: #ff3b30;
    color: #fff;
}

.btn-danger:hover {
    background-color: #e03025;
}

.btn-block {
    display: block;
    width: 100%;
}

.mb-20 {
    margin-bottom: 20px;
}

/* 消息提示 */
.error-message {
    background-color: #fff2f2;
    color: #ff3b30;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
}

.success-message {
    background-color: #f2fff2;
    color: #34c759;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #007aff;
    border-bottom-color: #007aff;
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 管理产品列表 */
.admin-product-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-product-item {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-product-thumb {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.admin-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-product-info {
    flex: 1;
    min-width: 0;
}

.admin-product-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.admin-product-desc {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-product-actions {
    display: flex;
    gap: 5px;
    flex-direction: column;
}

.sort-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.sort-btn {
    background-color: #f0f0f0;
    color: #333;
}

.edit-btn {
    background-color: #007aff;
    color: #fff;
}

.delete-btn {
    background-color: #ff3b30;
    color: #fff;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close-btn:hover {
    color: #333;
}

#productForm {
    padding: 20px;
}

/* 图片预览 */
.file-input {
    display: block;
    width: 100%;
    font-size: 14px;
}

.image-preview {
    margin-top: 10px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
}

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

/* 表单提示文字 */
.form-tip {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-bottom: 15px;
}

/* 访客信息列表 */
.leads-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.leads-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead-item {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lead-info {
    flex: 1;
    min-width: 0;
}

.lead-company {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.lead-contact {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.lead-product {
    font-size: 13px;
    color: #007aff;
}

.lead-time {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.lead-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* 按钮:active反馈 */
.btn:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.action-btn:active {
    opacity: 0.8;
}

.nav-item:active {
    opacity: 0.8;
}

/* 响应式 */
@media (max-width: 375px) {
    .product-list {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 10px;
    }

    .intro-section, .contact-section {
        padding: 15px;
    }
}
