﻿/* ============================================
   信永成咨询 - 主样式表
   ============================================ */

/* ---------- 基础重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding-top: 70px;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

    a:hover {
        color: #667eea;
    }

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 头部 ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 2px solid #667eea;
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

    .logo h1 span {
        color: #667eea;
    }

.logo a {
    color: inherit;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

    .header-right .nav-link {
        color: #555;
        font-size: 14px;
        transition: 0.3s;
        padding: 4px 8px;
        border-radius: 4px;
    }

        .header-right .nav-link:hover {
            color: #667eea;
            background: #f0f0f0;
        }

    .header-right .welcome-text {
        color: #666;
        font-size: 14px;
    }

        .header-right .welcome-text .username-label {
            color: #667eea;
            font-weight: 600;
        }

.cart-badge {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 2px;
    min-width: 18px;
    text-align: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #333;
    padding: 4px 8px;
}

/* ---------- 导航 ---------- */
.nav {
    background: #1a1a2e;
    padding: 0;
    position: sticky;
    top: 70px;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

    .nav .container {
        padding: 0;
    }

    .nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
    }

        .nav ul li a {
            display: block;
            padding: 14px 22px;
            color: rgba(255, 255, 255, 0.8);
            font-size: 14px;
            transition: 0.3s;
            border-bottom: 3px solid transparent;
        }

            .nav ul li a:hover {
                color: #fff;
                background: rgba(255, 255, 255, 0.05);
                border-bottom-color: #667eea;
            }

            .nav ul li a.active {
                color: #fff;
                border-bottom-color: #667eea;
            }

    /* 导航分类链接 */
    .nav .nav-category {
        display: block;
        padding: 14px 18px;
        color: rgba(255, 255, 255, 0.8);
        font-size: 14px;
        transition: 0.3s;
        border-bottom: 3px solid transparent;
        text-decoration: none;
    }

        .nav .nav-category:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.05);
            border-bottom-color: #667eea;
        }

/* ---------- 主要内容 ---------- */
.main {
    min-height: 60vh;
    padding-top: 30px;
    padding-bottom: 30px;
}

.page-title {
    margin-bottom: 25px;
}

    .page-title h2 {
        font-size: 28px;
        color: #333;
        font-weight: 700;
    }

    .page-title p {
        color: #999;
        font-size: 15px;
        margin-top: 4px;
    }

/* ---------- 页脚 ---------- */
.footer {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.7);
    padding: 40px 0 20px;
    margin-top: 30px;
}

    .footer .footer-content {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 30px;
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .footer .footer-section h3 {
        color: #fff;
        font-size: 18px;
        margin-bottom: 10px;
    }

    .footer .footer-section h4 {
        color: #fff;
        font-size: 15px;
        margin-bottom: 8px;
    }

    .footer .footer-section p {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.6);
        line-height: 1.8;
    }

    .footer .footer-section a {
        display: block;
        color: rgba(255, 255, 255, 0.6);
        font-size: 14px;
        padding: 4px 0;
        transition: 0.3s;
    }

        .footer .footer-section a:hover {
            color: #667eea;
            padding-left: 6px;
        }

    .footer .footer-bottom {
        text-align: center;
        padding-top: 20px;
        font-size: 13px;
        color: rgba(255, 255, 255, 0.4);
    }

/* ---------- 移动端底部导航 ---------- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 8px 0 4px;
    z-index: 999;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #999;
        text-decoration: none;
        font-size: 20px;
        position: relative;
        padding: 4px 12px;
        min-width: 50px;
        transition: 0.3s;
    }

        .mobile-bottom-nav a.active {
            color: #667eea;
        }

        .mobile-bottom-nav a .nav-label {
            font-size: 10px;
            margin-top: 2px;
            font-weight: 500;
        }

        .mobile-bottom-nav a .badge {
            background: #e74c3c;
            color: #fff;
            border-radius: 50%;
            padding: 1px 6px;
            font-size: 10px;
            position: absolute;
            top: -4px;
            right: 4px;
            min-width: 16px;
            text-align: center;
        }

/* ---------- 工具类 ---------- */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block;
    padding: 10px 30px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    }

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

    .btn-secondary:hover {
        opacity: 0.8;
    }

.btn-outline {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
}

    .btn-outline:hover {
        background: #667eea;
        color: #fff;
    }

/* ---------- 表单 ---------- */
.form-group {
    margin-bottom: 18px;
}

    .form-group label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
        color: #333;
        font-size: 14px;
    }

    .form-group .required {
        color: #e74c3c;
    }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    font-size: 14px;
    transition: 0.3s;
    font-family: inherit;
}

    .form-control:focus {
        border-color: #667eea;
        outline: none;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    }

.form-row {
    display: flex;
    gap: 20px;
}

    .form-row .half {
        flex: 1;
    }

/* ---------- 错误信息 ---------- */
.error {
    color: #e74c3c;
    font-size: 13px;
    display: block;
    margin-top: 5px;
}

/* ---------- 消息框 ---------- */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== 响应式 - 平板 ===== */
@media screen and (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 0 15px;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }

    .product-list {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }

    .product-detail {
        flex-direction: column;
        gap: 30px;
        padding: 20px;
    }

        .product-detail .gallery .main-image {
            height: 350px;
        }
}

/* ===== 响应式 - 手机 ===== */
@media screen and (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 65px;
    }

    .container {
        max-width: 100%;
        padding: 0 12px;
    }

    .header {
        padding: 10px 0;
    }

    .logo h1 {
        font-size: 18px;
    }

    .menu-toggle {
        display: block;
        font-size: 24px;
    }

    .header-right {
        display: none;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 10px 0;
        gap: 8px;
        border-top: 1px solid #eee;
        margin-top: 8px;
    }

        .header-right.open {
            display: flex;
        }

        .header-right .nav-link {
            font-size: 15px;
            padding: 6px 12px;
            width: 100%;
            text-align: center;
        }

    .nav {
        top: 60px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        .nav .container {
            padding: 0;
        }

        .nav ul {
            flex-wrap: nowrap;
            padding: 0 10px;
        }

            .nav ul li a,
            .nav .nav-category {
                padding: 12px 14px;
                font-size: 12px;
                white-space: nowrap;
            }

    .mobile-bottom-nav {
        display: flex;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .product-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .product-item .product-image {
        height: 140px !important;
    }

    .product-item .product-info h4 {
        font-size: 13px !important;
    }

    .product-item .product-info .price {
        font-size: 16px !important;
    }

    .product-card .product-image {
        height: 140px !important;
    }

    .product-card .product-info h3 {
        font-size: 13px !important;
    }

    .product-card .product-info .price {
        font-size: 16px !important;
    }

    .product-detail {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }

        .product-detail .gallery .main-image {
            height: 220px;
        }

        .product-detail .gallery .thumbnails img {
            width: 60px;
            height: 60px;
        }

        .product-detail .info h1 {
            font-size: 20px;
        }

        .product-detail .info .price {
            font-size: 24px;
        }

        .product-detail .info .original-price {
            font-size: 15px;
        }

        .product-detail .info .btn-cart {
            width: 100%;
            padding: 14px;
            font-size: 16px;
        }

    .category-filter {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 4px;
        padding: 8px 0;
    }

        .category-filter a.tree-item {
            font-size: 12px !important;
            padding: 4px 10px !important;
            white-space: nowrap;
        }

    .footer {
        padding: 30px 0 15px;
    }

        .footer .footer-content {
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

        .form-row .half {
            flex: none;
        }

    .pager a {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }

    .page-title h2 {
        font-size: 22px;
    }

    .page-title p {
        font-size: 13px;
    }

    .filter-bar {
        flex-direction: column !important;
        gap: 10px !important;
    }

        .filter-bar .search-box {
            width: 100% !important;
            display: flex;
            gap: 8px;
        }

            .filter-bar .search-box .search-input {
                flex: 1;
                min-width: 0;
            }

        .filter-bar .filter-options {
            width: 100%;
        }

            .filter-bar .filter-options select {
                width: 100%;
            }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

        .table-wrapper table {
            min-width: 600px;
        }

        .table-wrapper .table td,
        .table-wrapper .table th {
            padding: 8px 10px !important;
            font-size: 13px !important;
            white-space: nowrap;
        }

        .table-wrapper .table .btn-sm {
            padding: 3px 8px !important;
            font-size: 11px !important;
        }
}

/* ===== 响应式 - 小手机 ===== */
@media screen and (max-width: 480px) {
    .logo h1 {
        font-size: 16px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-item .product-image {
        height: 110px !important;
    }

    .product-item .product-info {
        padding: 8px 10px !important;
    }

        .product-item .product-info h4 {
            font-size: 12px !important;
        }

        .product-item .product-info .price {
            font-size: 14px !important;
        }

        .product-item .product-info .stock {
            font-size: 11px !important;
        }

    .product-card .product-image {
        height: 110px !important;
    }

    .product-card .product-info {
        padding: 8px 10px !important;
    }

        .product-card .product-info h3 {
            font-size: 12px !important;
        }

        .product-card .product-info .price {
            font-size: 14px !important;
        }

    .product-detail .gallery .main-image {
        height: 180px;
    }

    .product-detail .gallery .thumbnails img {
        width: 50px;
        height: 50px;
    }

    .product-detail .info h1 {
        font-size: 18px;
    }

    .product-detail .info .price {
        font-size: 20px;
    }

    .page-title h2 {
        font-size: 18px;
    }

    .footer .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer .footer-section a {
        text-align: center;
    }

    .mobile-bottom-nav a {
        font-size: 18px;
        padding: 2px 8px;
        min-width: 40px;
    }

        .mobile-bottom-nav a .nav-label {
            font-size: 9px;
        }

    .admin-page {
        padding: 12px !important;
    }

    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

        .page-header .btn-primary {
            width: 100%;
            text-align: center;
        }

    .filter-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

        .filter-row .filter-group {
            width: 100% !important;
        }

            .filter-row .filter-group .form-control {
                min-width: auto !important;
                width: 100% !important;
            }

    .filter-actions {
        flex-direction: column !important;
    }

        .filter-actions .btn-secondary {
            width: 100% !important;
            text-align: center;
        }

    .form-actions {
        flex-direction: column !important;
    }

        .form-actions .btn-primary,
        .form-actions .btn-secondary {
            width: 100% !important;
            text-align: center;
        }

    .edit-form .image-item {
        width: 80px !important;
        height: 80px !important;
    }

        .edit-form .image-item .image-item-actions .badge {
            font-size: 8px !important;
            padding: 1px 4px !important;
        }

        .edit-form .image-item .btn-remove-image {
            font-size: 12px !important;
        }
}

/* ===== 响应式 - 大屏 ===== */
@media screen and (min-width: 1367px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    .product-list {
        grid-template-columns: repeat(5, 1fr) !important;
    }

    .container {
        max-width: 1400px;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .header,
    .nav,
    .footer,
    .mobile-bottom-nav {
        display: none !important;
    }

    body {
        padding: 20px !important;
        background: #fff !important;
    }

    .main {
        padding: 0 !important;
    }
}
