/* 商品列表样式 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 102, 255, 0.25);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.5s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

body.light-mode .product-card {
    background: var(--light-card);
    border: 1px solid var(--light-card-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--glow), 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

body.light-mode .product-card:hover {
    box-shadow: 0 10px 25px rgba(0, 102, 255, 0.2), 0 15px 30px rgba(0, 0, 0, 0.05);
}

.product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 15px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.product-info {
    padding: 30px 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--light);
    font-family: 'Orbitron', sans-serif;
}

body.light-mode .product-name {
    color: #1a1a1a;
}

.product-description {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
    flex: 1;
}

body.light-mode .product-description {
    color: var(--light-gray);
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 102, 255, 0.2);
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.price-symbol {
    font-size: 1.2rem;
    color: var(--secondary);
    font-weight: 600;
}

.price-value {
    font-size: 1.8rem;
    color: var(--secondary);
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
}

body.light-mode .price-symbol,
body.light-mode .price-value {
    color: #0066ff;
}

.btn-buy {
    padding: 12px 24px;
    font-size: 0.95rem;
    white-space: nowrap;
}

.product-stock {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--gray);
}

body.light-mode .product-stock {
    color: var(--light-gray);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray);
}

body.light-mode .empty-state {
    color: var(--light-gray);
}

/* 购买页面样式 */
.buy-section {
    padding: 130px 0 80px;
}

.buy-container {
    max-width: 1000px;
    margin: 0 auto;
}

.buy-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

/* buy.php：地址选择与商品信息在手机端防止挤压错位 */
.address-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.order-form-group select.order-select {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--light);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

/* 下拉箭头图标 - 为每个select添加箭头 */
.order-form-group {
    position: relative;
}

/* 为地址选择器中的每个select添加箭头 */
.address-grid {
    position: relative;
}

.address-grid .order-form-group {
    position: relative;
}

.order-form-group select.order-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

body.light-mode .order-form-group select.order-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

body.light-mode .order-form-group select.order-select {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border-color: rgba(0, 0, 0, 0.2);
}

.order-form-group select.order-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
    background: rgba(0, 0, 0, 0.4);
}

body.light-mode .order-form-group select.order-select:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
}

.order-form-group select.order-select:hover {
    border-color: rgba(0, 102, 255, 0.5);
    background: rgba(0, 0, 0, 0.35);
}

body.light-mode .order-form-group select.order-select:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 102, 255, 0.4);
}

/* 下拉选项样式 */
.order-form-group select.order-select option {
    background: rgba(10, 14, 23, 0.98);
    color: var(--light);
    padding: 12px 15px;
    font-size: 1rem;
}

body.light-mode .order-form-group select.order-select option {
    background: rgba(255, 255, 255, 0.98);
    color: #333;
}

/* 确保下拉菜单不被遮挡 */
.order-form-group select.order-select:focus {
    z-index: 100;
}

/* 地址网格中的select样式优化 */
.address-grid .order-select {
    position: relative;
    z-index: 10;
}

.address-grid .order-select:focus {
    z-index: 100;
}

.address-detail-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--light);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

body.light-mode .address-detail-input {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

.address-detail-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.product-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 102, 255, 0.2);
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .buy-content {
        grid-template-columns: 1fr;
    }
    .address-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 支付二维码页面（payment-qrcode.php） */
.qrcode-page {
    text-align: center;
    padding: 60px 20px;
}

.qrcode-card {
    max-width: 400px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid rgba(0, 102, 255, 0.25);
    border-radius: 15px;
    padding: 40px;
}

/* 二维码容器居中 */
.qrcode-container-center {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    min-height: 180px;
}

/* 移动端显著提示信息 */
.mobile-pay-notice {
    display: none;
    background: linear-gradient(135deg, rgba(250, 166, 75, 0.15), rgba(255, 193, 7, 0.1));
    border: 2px solid rgba(250, 166, 75, 0.4);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 25px;
    text-align: center;
}

.mobile-pay-notice i {
    color: #faa64b;
    font-size: 1.3rem;
    margin-bottom: 8px;
    display: block;
    animation: pulse 2s ease-in-out infinite;
}

.mobile-pay-notice p {
    color: var(--light);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.5;
}

body.light-mode .mobile-pay-notice {
    background: linear-gradient(135deg, rgba(250, 166, 75, 0.1), rgba(255, 193, 7, 0.05));
    border-color: rgba(250, 166, 75, 0.3);
}

body.light-mode .mobile-pay-notice p {
    color: #333;
}

.mobile-pay-actions {
    margin-top: 20px;
    margin-bottom: 0;
}

.mobile-pay-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 1.05rem;
    font-weight: 600;
}

.auto-jump-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 0.9rem;
}

.auto-jump-hint i {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@media (max-width: 768px) {
    .qrcode-page {
        padding: 30px 12px;
    }
    .qrcode-card {
        max-width: 340px;
        padding: 22px;
    }
}

@media (max-width: 480px) {
    .qrcode-card {
        max-width: 320px;
        padding: 18px;
    }
    
    .mobile-pay-notice {
        padding: 14px 16px;
        margin-bottom: 20px;
    }
    
    .mobile-pay-notice i {
        font-size: 1.2rem;
    }
    
    .mobile-pay-notice p {
        font-size: 1rem;
    }
    
    .mobile-pay-actions .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .qrcode-container-center {
        min-height: 160px;
    }
}

.product-detail-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 102, 255, 0.25);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

body.light-mode .product-detail-card {
    background: var(--light-card);
    border: 1px solid var(--light-card-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.product-detail-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

.order-form-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 102, 255, 0.25);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

body.light-mode .order-form-card {
    background: var(--light-card);
    border: 1px solid var(--light-card-border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.order-form-group {
    margin-bottom: 25px;
}

.order-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--light);
    font-size: 0.95rem;
}

body.light-mode .order-form-group label {
    color: #1a1a1a;
}

.order-form-group input,
.order-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--light);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

body.light-mode .order-form-group input,
body.light-mode .order-form-group textarea {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(0, 0, 0, 0.15);
}

.order-form-group input:focus,
.order-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.order-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.order-summary {
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
}

body.light-mode .order-summary {
    background: rgba(0, 102, 255, 0.05);
    border-color: rgba(0, 102, 255, 0.2);
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1rem;
}

.order-summary-item:last-child {
    margin-bottom: 0;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 102, 255, 0.2);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
}

body.light-mode .order-summary-item:last-child {
    color: #0066ff;
}

.payment-methods {
    margin-top: 25px;
}

.payment-method-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid rgba(0, 102, 255, 0.3);
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-method-item:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.1);
}

.payment-method-item input[type="radio"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.payment-method-item input[type="radio"]:checked + label {
    color: var(--secondary);
    font-weight: 600;
}

.payment-method-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-size: 1rem;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 102, 255, 0.1);
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

body.light-mode .quantity-selector button {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.quantity-selector button:hover {
    background: rgba(0, 102, 255, 0.2);
    border-color: var(--primary);
}

.quantity-selector input {
    width: 80px;
    text-align: center;
    padding: 10px;
}

/* 超小屏幕（手机） - 响应式设计 */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }
    
    .product-card {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    }
    
    .product-image {
        height: 200px;
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-name {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .product-description {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .product-footer {
        padding-top: 10px;
        gap: 10px;
    }
    
    .price-value {
        font-size: 1.5rem;
    }
    
    .btn-buy {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .empty-state {
        padding: 50px 15px;
    }
    
    .buy-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .buy-content {
        gap: 15px;
    }
    
    .product-detail-card,
    .order-form-card {
        padding: 15px;
        border-radius: 10px;
    }
    
    .product-detail-image {
        height: 250px;
        margin-bottom: 15px;
    }
    
    .order-form-group {
        margin-bottom: 15px;
    }
    
    .order-form-group input,
    .order-form-group textarea {
        padding: 10px 12px;
        font-size: 1rem;
    }

    .order-form-group select.order-select {
        padding: 10px 12px;
        font-size: 1rem;
    }

    .address-detail-input {
        padding: 10px 12px;
        font-size: 1rem;
    }

    /* 地址选择：手机单列，彻底避免错位 */
    .address-grid {
        grid-template-columns: 1fr;
    }

    /* 单价/库存行：手机改为纵向 */
    .product-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .order-summary {
        padding: 15px;
        margin-top: 20px;
    }
    
    .order-summary-item {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }
    
    .order-summary-item:last-child {
        font-size: 1rem;
        padding-top: 10px;
    }
    
    .payment-methods {
        margin-top: 15px;
    }
    
    .payment-method-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .quantity-selector {
        gap: 10px;
        margin-top: 10px;
    }
    
    .quantity-selector button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .quantity-selector input {
        width: 70px;
        padding: 8px;
    }
}

/* 小屏幕（平板竖屏） - 响应式设计 */
@media (max-width: 768px) and (min-width: 481px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
    
    .product-image {
        height: 220px;
    }
    
    .product-info {
        padding: 20px;
    }
    
    .product-name {
        font-size: 1.3rem;
    }
    
    .buy-container {
        padding: 0 20px;
    }
    
    .product-detail-card,
    .order-form-card {
        padding: 20px;
    }
}

/* 确保响应式布局的一般适应 */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 25px;
    }
}

/* 移动端和平板通用优化 */
@media (max-width: 768px) {
    .btn {
        font-size: 0.95rem;
        padding: 12px 20px;
    }
    
    .btn-primary,
    .btn-secondary {
        display: inline-block;
        width: auto;
    }
    
    .buy-section {
        padding: 100px 0 60px;
    }
    
    .section-header {
        padding: 0 15px;
    }
    
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    .alert {
        font-size: 0.9rem;
    }
    
    /* 产品项目在移动端改进显示 */
    [style*="display: flex"] {
        flex-wrap: wrap;
    }
}
