<?php
/**
 * 前端公共样式 - 基于 UI/UX Pro Max 设计系统
 */
header('Content-Type: text/css');
?>
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;500;600;700&family=Rubik:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #059669;
    --primary-hover: #047857;
    --secondary: #10B981;
    --cta: #F97316;
    --cta-hover: #EA580C;
    --bg-light: #ECFDF5;
    --text-dark: #064E3B;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #f9fafb;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* Header */
.header {
    background: #fff;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo {
    font-family: 'Rubik', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo a {
    transition: var(--transition);
}

.logo a:hover {
    opacity: 0.8;
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 8px 0;
    position: relative;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.2s ease;
}

.nav a:hover,
.nav a.active {
    color: var(--primary);
}

.nav a:hover::after,
.nav a.active::after {
    width: 100%;
}

/* Main */
.main {
    min-height: calc(100vh - 160px);
    padding: 48px 0;
}

/* Page Title */
.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    font-family: 'Rubik', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 15px;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-card {
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

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

.product-link {
    display: block;
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-light);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.no-image svg {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.product-info {
    padding: 20px;
}

.product-title {
    font-family: 'Rubik', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-sku-title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.product-price {
    font-family: 'Rubik', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.product-price .unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.product-date {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-date svg {
    width: 14px;
    height: 14px;
}

.product-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: var(--bg-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
}

.product-more:hover {
    background: var(--primary);
    color: #fff;
}

/* Product Detail */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 32px;
}

/* Gallery */
.detail-gallery {
    position: sticky;
    top: 96px;
    align-self: start;
}

.detail-gallery .main-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-gallery .main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.detail-gallery .thumbnails {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.detail-gallery .thumbnail {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    background: var(--bg-light);
    padding: 4px;
}

.detail-gallery .thumbnail:hover,
.detail-gallery .thumbnail.active {
    border-color: var(--primary);
}

/* Detail Info */
.detail-info {
    display: flex;
    flex-direction: column;
}

.detail-title {
    font-family: 'Rubik', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.meta-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.meta-label {
    font-size: 14px;
    color: var(--text-muted);
}

.meta-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.detail-price {
    font-family: 'Rubik', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.detail-price .unit {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
}

.detail-stock {
    font-size: 14px;
    color: var(--secondary);
    font-weight: 500;
}

/* SKU Selector */
.sku-selector {
    margin-bottom: 24px;
}

.sku-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.sku-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sku-option {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
}

.sku-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sku-option.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Detail Description */
.detail-description {
    margin-bottom: 24px;
}

.detail-description h3 {
    font-family: 'Rubik', sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.detail-description p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Detail Content */
.detail-content {
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* ========== Product Detail Page - New Layout ========== */
.product-main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 40px;
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 0;
}

/* Product Gallery */
.product-gallery .main-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-gallery .main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 24px;
}

.product-gallery .thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.product-gallery .thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    background: #fff;
    padding: 4px;
}

.product-gallery .thumbnail:hover,
.product-gallery .thumbnail.active {
    border-color: var(--primary);
}

/* Product Info */
.product-info {
    display: flex;
    flex-direction: column;
}

.product-info .detail-title {
    font-size: 24px;
    margin-bottom: 20px;
}

/* Price Section */
.price-section {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.price-label {
    font-size: 14px;
    color: var(--text-muted);
}

.price-value {
    font-family: 'Rubik', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--cta);
}

/* Option Section */
.option-section {
    margin-bottom: 20px;
}

.option-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

/* Quantity Selector */
.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    border: none;
    background: #fff;
    font-size: 18px;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
}

.quantity-selector button:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.quantity-selector input {
    width: 60px;
    height: 40px;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}

.quantity-selector input:focus {
    outline: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cart:hover {
    background: var(--bg-light);
}

.btn-buy {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--cta);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-buy:hover {
    background: var(--cta-hover);
}

/* Publish Time */
.publish-time {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Product Tabs */
.product-tabs {
    display: flex;
    gap: 0;
    margin-top: 24px;
    background: #fff;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.tab-item {
    flex: 1;
    display: block;
    padding: 16px 24px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    background: #fff;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.tab-item:hover {
    color: var(--primary);
    background: var(--bg-light);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-light);
}

/* Tab Content */
.tab-content {
    background: #fff;
    padding: 32px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 32px;
}

.detail-section {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
}

.detail-section img {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: var(--radius-sm);
}

/* Spec Section */
.spec-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.spec-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    width: 100px;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.spec-value {
    flex: 1;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
    .product-main {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .product-gallery {
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .product-main {
        padding: 20px;
    }

    .product-info .detail-title {
        font-size: 20px;
    }

    .price-value {
        font-size: 28px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .product-tabs {
        overflow-x: auto;
    }

    .tab-item {
        padding: 14px 20px;
        font-size: 14px;
        white-space: nowrap;
    }
}

.detail-content h3 {
    font-family: 'Rubik', sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dark);
}

.content-body {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.8;
}

.content-body img {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: var(--radius-sm);
}

/* Empty & Error */
.empty,
.error {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
    font-size: 16px;
}

.empty svg,
.error svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.error {
    color: #EF4444;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: #fff;
    padding: 32px 0;
    text-align: center;
}

.footer p {
    font-size: 14px;
    opacity: 0.8;
}

.footer a {
    color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeIn 0.3s ease forwards;
}

/* Responsive */
@media (max-width: 1024px) {
    .product-detail {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .detail-gallery {
        position: static;
    }
}

@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        height: auto;
        padding: 16px 24px;
        gap: 12px;
    }

    .nav {
        gap: 24px;
    }

    .main {
        padding: 32px 0;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .product-detail {
        padding: 24px;
    }

    .detail-title {
        font-size: 22px;
    }

    .detail-price {
        font-size: 28px;
    }

    .detail-content {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 16px;
    }
}

/* Focus States for Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
