/* 常州正河源数控工具有限公司 - 公共样式 */

/* ==================== 全局变量 ==================== */
:root {
    --primary-color: #0066cc;          /* 主蓝色 */
    --primary-dark: #0052a3;           /* 深蓝色 */
    --primary-light: #4d94ff;          /* 浅蓝色 */
    --secondary-color: #2c3e50;        /* 深灰蓝 */
    --text-color: #333333;             /* 正文文字 */
    --text-light: #666666;             /* 浅色文字 */
    --bg-light: #f8f9fa;               /* 浅灰背景 */
    --border-color: #e0e0e0;           /* 边框颜色 */
    --success-color: #28a745;          /* 成功色 */
    --warning-color: #ffc107;          /* 警告色 */
    --danger-color: #dc3545;           /* 危险色 */
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* ==================== 重置样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    overflow-x: hidden;
}

/* ==================== 通用样式 ==================== */
a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-color);
}

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

ul, ol {
    list-style: none;
}

/* ==================== 容器 ==================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-wide {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== 页面标题 ==================== */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 16px;
    opacity: 0.9;
}

/* ==================== 面包屑导航 ==================== */
.breadcrumb {
    background-color: var(--bg-light);
    padding: 15px 0;
    margin-bottom: 30px;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 14px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: ">";
    margin: 0 10px;
    color: var(--text-light);
}

.breadcrumb-item a {
    color: var(--text-light);
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--primary-color);
}

/* ==================== 章节样式 ==================== */
.section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 32px;
    color: var(--secondary-color);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

.section-title p {
    color: var(--text-light);
    font-size: 16px;
}

.section-gray {
    background-color: var(--bg-light);
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #1a252f;
    color: var(--white);
}

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

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-lg {
    padding: 15px 40px;
    font-size: 18px;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 14px;
}

/* ==================== 卡片样式 ==================== */
.card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.card-text {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 15px;
}

.card-footer {
    padding: 15px 20px;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-control::placeholder {
    color: #999;
}

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

.form-text {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ==================== 网格布局 ==================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.pt-1 { padding-top: 10px; }
.pt-2 { padding-top: 20px; }
.pt-3 { padding-top: 30px; }
.pt-4 { padding-top: 40px; }

.pb-1 { padding-bottom: 10px; }
.pb-2 { padding-bottom: 20px; }
.pb-3 { padding-bottom: 30px; }
.pb-4 { padding-bottom: 40px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 淡入动画 ==================== */
.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .no-print,
    header,
    footer,
    .btn {
        display: none !important;
    }
}

/* ==================== 询价购物车样式 ==================== */
.inquiry-cart-link {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.inquiry-cart-link i {
    font-size: 16px;
}

.inquiry-cart-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* 加入询价清单按钮样式 */
.btn-add-inquiry {
    background: linear-gradient(135deg, #28a745, #218838);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-add-inquiry:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-add-inquiry i {
    font-size: 14px;
}

/* 产品详情页样式 */
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 50px;
}

.product-detail-gallery {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.product-detail-main-image {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    background: #f8f9fa;
}

.product-detail-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.product-detail-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.product-detail-thumb {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.product-detail-thumb:hover,
.product-detail-thumb.active {
    border-color: #0066cc;
}

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

.product-detail-info h1 {
    font-size: 32px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.product-detail-category {
    display: inline-block;
    background: #e3f2fd;
    color: #0066cc;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    margin-bottom: 20px;
}

.product-detail-summary {
    font-size: 16px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.product-detail-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.product-detail-actions .btn {
    padding: 14px 35px;
    font-size: 16px;
}

.product-detail-model-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.product-detail-model-box h4 {
    font-size: 16px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.model-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.model-option {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
}

.model-option:hover {
    border-color: #0066cc;
}

.model-option.selected {
    border-color: #0066cc;
    background: #e3f2fd;
    color: #0066cc;
    font-weight: 600;
}

.product-detail-section {
    margin-top: 50px;
}

.product-detail-section h2 {
    font-size: 28px;
    color: var(--secondary-color);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

.product-detail-description {
    color: var(--text-light);
    line-height: 1.8;
    font-size: 16px;
}

.product-detail-description p {
    margin-bottom: 15px;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.specs-table th,
.specs-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.specs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--secondary-color);
    width: 30%;
}

.specs-table tr:hover {
    background: #f8f9fa;
}

.specs-table tr:last-child th,
.specs-table tr:last-child td {
    border-bottom: none;
}

.applications-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.application-item {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.application-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.application-item i {
    font-size: 32px;
    color: #0066cc;
    margin-bottom: 15px;
}

.application-item h4 {
    font-size: 16px;
    color: var(--secondary-color);
    margin: 0;
}

.related-products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-top: 20px;
}

.related-product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.related-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

.related-product-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.related-product-card .card-body {
    padding: 15px;
}

.related-product-card h4 {
    font-size: 15px;
    color: var(--secondary-color);
    margin: 0 0 10px 0;
}

.related-product-card p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 15px 0;
}

@media (max-width: 991px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .product-detail-gallery {
        position: static;
    }

    .product-detail-info h1 {
        font-size: 26px;
    }

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

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

@media (max-width: 575px) {
    .product-detail-actions {
        flex-direction: column;
    }

    .product-detail-actions .btn {
        width: 100%;
    }

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

    .related-products {
        grid-template-columns: 1fr;
    }

    .specs-table th,
    .specs-table td {
        padding: 12px 15px;
        font-size: 14px;
    }

    .specs-table th {
        width: 40%;
    }
}

/* ==================== Shopping Cart Styles ==================== */

/* Cart link in navigation */
.cart-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s;
    position: relative;
}

.cart-link:hover {
    background: rgba(44, 62, 80, 0.05);
    color: var(--primary-color);
}

.cart-link i {
    font-size: 18px;
}

.cart-link .cart-text {
    font-size: 14px;
    font-weight: 500;
}

/* Cart count badge */
.cart-count {
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
    display: none;
}

.cart-count.show {
    display: inline-block;
}

/* Cart icon button on product cards */
.cart-icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s;
}

.product-card:hover .cart-icon-btn {
    opacity: 1;
    transform: scale(1);
}

.cart-icon-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.cart-icon-btn:active {
    transform: scale(0.95);
}

.cart-icon-btn i {
    font-size: 14px;
}

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 350px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid #27ae60;
}

.toast.error {
    border-left: 4px solid #e74c3c;
}

.toast.info {
    border-left: 4px solid #3498db;
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon {
    color: #27ae60;
}

.toast.error .toast-icon {
    color: #e74c3c;
}

.toast.info .toast-icon {
    color: #3498db;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 14px;
    color: var(--secondary-color);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--secondary-color);
}

@media (max-width: 575px) {
    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ==================== Variant Blocks (规格选择器 & 动态字段) ==================== */

/* 规格选择器容器 */
.block-variant-selector {
    width: 100%;
}

.block-variant-selector.block-variant-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    background: #f8f9fa;
    border-radius: 8px;
}

.variant-label {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

/* 规格选项容器 */
.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* 规格选项按钮 */
.variant-option {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    min-width: 80px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.variant-option:hover {
    border-color: #0066cc;
    background: #f0f7ff;
}

.variant-option.active {
    border-color: #0066cc;
    background: #0066cc;
    color: #fff;
}

.variant-option.active .variant-name,
.variant-option.active .variant-model,
.variant-option.active .variant-price {
    color: #fff;
}

.variant-name {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.variant-model {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.variant-price {
    font-size: 13px;
    color: #e74c3c;
    font-weight: 600;
    margin-top: 4px;
}

/* 动态字段 */
.block-variant-field {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.variant-field-label {
    font-size: 14px;
    color: #666;
}

.variant-field-value {
    font-size: 16px;
    color: #2c3e50;
}

.variant-price-value {
    font-size: 24px;
    font-weight: 700;
    color: #e74c3c;
}

.variant-price-inquiry {
    font-size: 18px;
    font-weight: 600;
    color: #999;
}

.variant-specs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spec-item {
    display: flex;
    gap: 8px;
    font-size: 14px;
}

.spec-key {
    color: #666;
    min-width: 80px;
}

.spec-value {
    color: #2c3e50;
    font-weight: 500;
}

@media (max-width: 768px) {
    .variant-options {
        gap: 8px;
    }

    .variant-option {
        padding: 10px 16px;
        min-width: 70px;
    }

    .variant-name {
        font-size: 13px;
    }

    .variant-model {
        font-size: 11px;
    }

    .variant-price-value {
        font-size: 20px;
    }

    .variant-specs {
        gap: 6px;
    }
}
