/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
}

.btn-secondary {
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
}

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

.btn-edit {
    background-color: #2196F3;
    color: white;
}

.btn-edit:hover {
    background-color: #0b7dda;
}

.btn-delete {
    background-color: #f44336;
    color: white;
}

.btn-delete:hover {
    background-color: #da190b;
}

.btn-logout {
    background-color: #9e9e9e;
    color: white;
}

.btn-logout:hover {
    background-color: #757575;
}

/* 错误消息 */
.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* 消息 */
.message {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* 前端样式 */
.site-header {
    background-color: #333;
    color: white;
    padding: 20px 0;
}

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

.site-header h1 a {
    color: white;
    text-decoration: none;
}

.site-nav ul {
    display: flex;
    list-style: none;
}

.site-nav li {
    margin-left: 20px;
}

.site-nav a {
    color: white;
    text-decoration: none;
}

.site-content {
    padding: 40px 0;
}

.site-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* 商品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-image {
    height: 200px;
    overflow: hidden;
}

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

.product-info {
    padding: 20px;
}

.product-info h3 {
    margin-bottom: 10px;
}

.product-info h3 a {
    color: #333;
    text-decoration: none;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 15px;
}

/* 商品详情 */
.product-detail {
    display: flex;
    gap: 40px;
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.product-images {
    flex: 1;
}

.product-images img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 4px;
}

.no-image {
    width: 100%;
    height: 400px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.product-details {
    flex: 1;
}

.product-details h2 {
    margin-bottom: 20px;
}

.product-details .product-price {
    font-size: 24px;
    margin-bottom: 30px;
}

.product-description {
    margin-bottom: 30px;
    line-height: 1.8;
}

/* 购物车 */
.cart-empty {
    background-color: white;
    padding: 40px;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cart-table {
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.cart-table table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th,
.cart-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.cart-table th {
    background-color: #f5f5f5;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-item-info img {
    border-radius: 4px;
}

.cart-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.cart-total {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: right;
}

/* 支付 */
.order-summary {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.order-summary table {
    width: 100%;
    border-collapse: collapse;
}

.order-summary th,
.order-summary td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.order-summary tfoot th,
.order-summary tfoot td {
    font-weight: bold;
    border-bottom: none;
}

.payment-method {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.payment-options {
    margin-top: 10px;
}

.payment-options label {
    display: block;
    margin-bottom: 10px;
}

.payment-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 支付成功 */
.payment-success {
    background-color: white;
    padding: 40px;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.payment-success h2 {
    color: #4CAF50;
    margin-bottom: 20px;
}

.success-actions {
    margin-top: 30px;
}

/* 后台样式 */
.admin-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background-color: #333;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-nav {
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.admin-nav ul {
    display: flex;
    list-style: none;
}

.admin-nav li {
    border-right: 1px solid #ddd;
}

.admin-nav a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
    background-color: #e0e0e0;
}

.admin-content {
    flex: 1;
    padding: 40px;
    background-color: #f5f5f5;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* 仪表盘 */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: white;
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    margin-bottom: 10px;
    color: #666;
}

.stat-card p {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
}

.welcome-message {
    background-color: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 表格样式 */
.products-table,
.orders-table {
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.products-table table,
.orders-table table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th,
.products-table td,
.orders-table th,
.orders-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.products-table th,
.orders-table th {
    background-color: #f5f5f5;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.current-image {
    margin-top: 10px;
}

.current-image img {
    border-radius: 4px;
}

.current-image p {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* 订单详情 */
.order-info {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.order-info h3 {
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

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

.order-items {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.order-items h3 {
    margin-bottom: 20px;
}

.order-items table {
    width: 100%;
    border-collapse: collapse;
}

.order-items th,
.order-items td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* 登录页面 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background-color: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.login-container h2 {
    margin-bottom: 30px;
    text-align: center;
}

.login-container .form-group {
    margin-bottom: 20px;
}

.login-container button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-detail {
        flex-direction: column;
    }
    
    .admin-content {
        padding: 20px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-actions {
        flex-direction: column;
    }
    
    .payment-actions {
        flex-direction: column;
    }
}