:root {
    --primary-color: #e1251b;
    --text-color: #333;
    --gray-bg: #f4f4f4;
    --border-color: #ddd;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--gray-bg);
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
}

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

ul {
    list-style: none;
}

.container {
    width: 1200px;
    margin: 0 auto;
    position: relative;
}

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

.flex-start {
    display: flex;
    align-items: flex-start;
}

.flex-end {
    display: flex;
    justify-content: flex-end;
}

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

.highlight-text {
    color: var(--primary-color);
}

.badge {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    font-size: 12px;
    padding: 0 6px;
    border-radius: 10px;
    line-height: 16px;
    margin-left: 5px;
    vertical-align: middle;
}

.top-nav {
    background-color: #e3e4e5;
    border-bottom: 1px solid #ddd;
    color: #999;
    height: 30px;
    line-height: 30px;
}

.top-nav a {
    color: #999;
    margin: 0 5px;
}

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

.top-nav .separator {
    margin: 0 5px;
    color: #ccc;
}

.header {
    background: var(--white);
    padding: 20px 0;
    height: 140px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 36px;
    cursor: pointer;
}

.search-bar {
    display: flex;
    width: 500px;
    border: 2px solid var(--primary-color);
    align-items: center;
    background: #fff;
}

.search-icon-wrapper {
    padding: 0 10px;
    display: flex;
    align-items: center;
}

.search-bar input {
    flex: 1;
    padding: 10px 0;
    border: none;
    outline: none;
}

.search-bar button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 20px;
    font-size: 16px;
    cursor: pointer;
}

.cart-box {
    border: 1px solid #eee;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    background: var(--white);
    cursor: pointer;
    position: relative;
}

.cart-box:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.cart-box .count {
    background: var(--primary-color);
    color: var(--white);
    border-radius: 10px;
    padding: 0 5px;
    font-size: 12px;
    position: absolute;
    top: -5px;
    right: 5px;
}

.main-nav {
    border-bottom: 2px solid var(--primary-color);
    background: var(--white);
}

.main-nav .container {
    display: flex;
}

.category-trigger {
    width: 210px;
    background: var(--primary-color);
    color: var(--white);
    padding: 10px 0;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
}

.nav-links {
    display: flex;
}

.nav-links a {
    padding: 0 20px;
    line-height: 44px;
    font-size: 16px;
    display: block;
    font-weight: bold;
}

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

.home-layout {
    display: flex;
    margin-top: 10px;
    height: 480px;
}

.sidebar {
    width: 210px;
    background: #fefefe;
    color: #fff;
    height: 100%;
    border: 1px solid #eee;
    border-top: none;
}

.sidebar ul li {
    padding: 0 15px;
    height: 32px;
    line-height: 32px;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}

.sidebar ul li:hover {
    background: #d9d9d9;
    color: var(--primary-color);
}

.banner {
    flex: 1;
    margin-left: 10px;
    position: relative;
    overflow: hidden;
}

.carousel {
    width: 100%;
    height: 100%;
    position: relative;
}

.slides {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.carousel button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 20px;
}

.carousel button:hover {
    background: rgba(0,0,0,0.6);
}

.carousel .prev { left: 0; }
.carousel .next { right: 0; }

.dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    margin: 0 5px;
    cursor: pointer;
}

.dot.active {
    background: var(--white);
}

.section {
    margin-top: 30px;
    background: var(--white);
    padding: 20px;
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    position: relative;
    padding-left: 10px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: var(--primary-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.product-card {
    background: var(--white);
    border: 1px solid #eee;
    transition: var(--transition);
    cursor: pointer;
    padding: 10px;
}

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

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

.product-card .info {
    padding: 10px 0;
}

.product-card .price {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: bold;
}

.product-card .name {
    margin: 5px 0;
    height: 40px;
    overflow: hidden;
    font-size: 12px;
    line-height: 20px;
    color: #666;
}

.product-card button {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    color: #666;
}

.product-card button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    width: 400px;
    position: relative;
    border-radius: 4px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

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

.modal-tabs button {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
}

.modal-tabs button.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.breadcrumb {
    padding: 15px 0;
    color: #666;
}

.product-detail-box {
    background: var(--white);
    padding: 20px;
    margin-top: 10px;
}

.pd-image {
    width: 400px;
    height: 400px;
    border: 1px solid #eee;
    margin-right: 30px;
}

.pd-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pd-info {
    flex: 1;
}

.pd-info h1 {
    font-size: 20px;
    margin-bottom: 15px;
}

.pd-price-box {
    background: #f3f3f3;
    padding: 10px;
    margin-bottom: 15px;
}

.pd-price-box .price {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 10px;
}

.pd-price-box .original-price {
    text-decoration: line-through;
    color: #999;
}

.pd-meta {
    margin-bottom: 20px;
    color: #666;
    border-bottom: 1px dotted #ddd;
    padding-bottom: 10px;
}

.pd-meta span {
    margin-right: 20px;
}

.pd-desc-images {
    background: var(--white);
    padding: 20px;
    margin-top: 20px;
}

.qty-selector {
    display: flex;
    border: 1px solid #ddd;
    width: 120px;
    height: 36px;
    margin-bottom: 20px;
}

.qty-selector button {
    width: 30px;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
}

.qty-selector input {
    width: 60px;
    border: none;
    text-align: center;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.btn-buy, .btn-add-cart {
    padding: 10px 30px;
    font-size: 18px;
    cursor: pointer;
    margin-right: 10px;
    border: none;
}

.btn-buy {
    background: #ffeded;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

.cart-header {
    background: #f3f3f3;
    padding: 10px;
    border: 1px solid #e9e9e9;
    margin-bottom: 10px;
    font-weight: bold;
}

.grid-cart {
    display: grid;
    grid-template-columns: 80px 4fr 1fr 1fr 1fr 1fr;
    align-items: center;
    text-align: center;
}

.cart-item {
    background: var(--white);
    border: 1px solid #eee;
    padding: 15px 10px;
    margin-bottom: 10px;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #eee;
}

.cart-footer {
    background: var(--white);
    border: 1px solid #eee;
    padding: 15px 20px;
    position: sticky;
    bottom: 0;
}

.total-price {
    font-size: 20px;
    color: var(--primary-color);
    font-weight: bold;
    margin: 0 10px;
}

.btn-checkout {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 30px;
    font-size: 18px;
    cursor: pointer;
}

.checkout-section {
    background: var(--white);
    padding: 20px;
    margin-bottom: 20px;
}

.checkout-section h3 {
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
}

.form-row {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.form-row label {
    width: 100px;
    text-align: right;
    margin-right: 10px;
}

.form-row input {
    padding: 8px;
    border: 1px solid #ddd;
    width: 200px;
}

.form-row input.wide-input {
    width: 500px;
}

.btn-submit-order {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 40px;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
}

.order-tabs {
    margin-bottom: 20px;
    background: var(--white);
}

.order-tabs button {
    padding: 15px 20px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
}

.order-tabs button.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.order-card {
    background: var(--white);
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.order-header {
    background: #f5f5f5;
    padding: 10px 20px;
    color: #999;
    font-size: 12px;
}

.order-body {
    padding: 20px;
    display: flex;
    justify-content: space-between;
}

.order-items {
    flex: 2;
}

.order-status {
    flex: 1;
    text-align: center;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.btn-pay {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 5px 15px;
    margin-top: 5px;
    cursor: pointer;
}

.btn-cancel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 5px 15px;
    margin-top: 5px;
    cursor: pointer;
}

.footer {
    background: #eaeaea;
    padding: 40px 0;
    text-align: center;
    margin-top: 40px;
    color: #666;
}

.footer a {
    color: #666;
    margin: 0 10px;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
}

.toast {
    background: rgba(0,0,0,0.7);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    animation: fadein 0.3s;
}

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

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 50px 0;
    font-size: 18px;
    color: #999;
}

.empty-icon {
    margin-bottom: 20px;
}
.btn-primary-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: #fff;
    padding: 8px 25px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
}
.btn-primary-outline:hover {
    background: #fff5f5;
}

.section-icon {
    vertical-align: text-bottom;
    margin-right: 5px;
    color: #666;
}

.grid-checkout-header {
    display: grid;
    grid-template-columns: 4fr 1fr 1fr 1fr;
    background: #f3f3f3;
    padding: 10px 20px;
    border-bottom: 1px solid #e9e9e9;
    font-weight: bold;
    text-align: center;
}

.grid-checkout-item {
    display: grid;
    grid-template-columns: 4fr 1fr 1fr 1fr;
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    align-items: center;
    text-align: center;
    background: #fdfdfd;
}

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

.form-row input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(225, 37, 27, 0.1);
    outline: none;
}

.checkout-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 20px;
    background: #f4f4f4;
    padding: 20px;
}

.order-summary-box {
    background: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    width: 350px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #666;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
    align-items: flex-end;
}

.total-price-large {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.address-preview-box {
    text-align: right;
    color: #999;
    font-size: 13px;
    margin-bottom: 15px;
    padding-right: 10px;
}

.payment-content {
    width: 500px;
    padding: 0;
    overflow: hidden;
}

.payment-header {
    background: #f5f5f5;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.payment-header h3 {
    margin-bottom: 5px;
    color: #333;
}

.payment-header p {
    color: #666;
    font-size: 13px;
}

.payment-info {
    padding: 20px 40px;
    background: #fff;
    border-bottom: 1px dashed #eee;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.pay-amount {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: bold;
}

.payment-method {
    padding: 20px 40px;
}

.payment-method h4 {
    margin-bottom: 15px;
    font-size: 14px;
}

.method-option {
    border: 2px solid var(--primary-color);
    padding: 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.method-option input {
    margin-right: 10px;
}

.method-option .tag {
    background: #ffebeb;
    color: var(--primary-color);
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 2px;
    margin-left: auto;
}

.payment-actions {
    padding: 20px 40px 30px;
    text-align: center;
}

.btn-pay-confirm {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 15px;
}

.btn-pay-confirm:hover {
    background: #c91b1b;
}

.pay-links a {
    color: #666;
    font-size: 13px;
}

.pay-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.pay-overlay .spinner {
    margin-bottom: 20px;
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.icon-circle.success {
    background: #52c41a;
}

.icon-circle.error {
    background: #ff4d4f;
}

.pay-overlay h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

.pay-overlay button {
    padding: 8px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 5px;
}

.pay-overlay button.btn-outline {
    background: white;
    border: 1px solid #ddd;
    color: #666;
}

.order-card {
    border-top: 2px solid #eee;
    transition: all 0.2s;
}

.order-card:hover {
    border-top-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.status-badge.status-0 { color: #f5222d; background: #fff1f0; border: 1px solid #ffa39e; }
.status-badge.status-1 { color: #52c41a; background: #f6ffed; border: 1px solid #b7eb8f; }
.status-badge.status-2 { color: #1890ff; background: #e6f7ff; border: 1px solid #91d5ff; }
.status-badge.status-3 { color: #8c8c8c; background: #f5f5f5; border: 1px solid #d9d9d9; }
.status-badge.status-4 { color: #bfbfbf; background: #f5f5f5; border: 1px solid #d9d9d9; }

.order-item-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

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

.order-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0 20px;
}

.btn-pay, .btn-cancel {
    border-radius: 4px;
    width: 100%;
}
