/* 購物車頁面專用樣式 */

/* 容器樣式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
}

.container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 購物車主容器 */
.cart-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 購物車項目區域 */
.cart-items {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e6ed;
}

/* 單個購物車項目 */
.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr 150px 120px 100px;
    gap: 20px;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 15px;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cart-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 商品圖片 */
.item-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.item-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

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

/* 商品詳情 */
.item-details h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
}

.item-code {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
    font-weight: 500;
}

.item-spec {
    font-size: 13px;
    color: #666;
    margin: 4px 0;
    padding: 2px 8px;
    background: #f1f3f4;
    border-radius: 12px;
    display: inline-block;
    margin-right: 5px;
}

/* 新的規格顯示樣式 - 單行顯示所有規格 */
.item-specs {
    font-size: 13px;
    color: #666;
    margin: 6px 0;
    padding: 4px 8px;
    background: #f1f3f4;
    border-radius: 12px;
    display: inline-block;
    font-weight: 500;
}

.item-price {
    font-size: 16px;
    color: #e74c3c;
    font-weight: 600;
    margin-top: 8px;
}

/* 數量控制 */
.item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 5px;
}

.qty-btn {
    width: 35px;
    height: 35px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

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

.qty-input {
    width: 60px;
    height: 35px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    background: #fff;
    transition: border-color 0.2s ease;
}

.qty-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* 項目總價 */
.item-total {
    font-weight: bold;
    color: #e74c3c;
    text-align: right;
    font-size: 18px;
}

/* 移除按鈕 */
.btn-remove {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-remove:hover {
    background: linear-gradient(45deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
}

/* 購物車摘要 */
.cart-summary {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e6ed;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 8px 0;
    font-size: 16px;
}

.summary-item span:first-child {
    color: #666;
    font-weight: 500;
}

.summary-item span:last-child {
    color: #333;
    font-weight: 600;
}

.summary-item.total {
    border-top: 2px solid #007bff;
    margin-top: 20px;
    padding-top: 20px;
    font-weight: bold;
    font-size: 20px;
    color: #007bff;
}

.summary-item.total span:last-child {
    color: #e74c3c;
    font-size: 24px;
}

/* 購物車操作按鈕 */
.cart-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-actions .btn {
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cart-actions .btn-secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    border: 2px solid transparent;
}

.cart-actions .btn-secondary:hover {
    background: linear-gradient(45deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

.cart-actions .btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: 2px solid transparent;
}

.cart-actions .btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

/* 空購物車樣式 */
.empty-cart {
    text-align: center;
    padding: 80px 20px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e6ed;
}

.empty-cart h2 {
    color: #666;
    margin-bottom: 15px;
    font-size: 2rem;
    font-weight: 300;
}

.empty-cart p {
    color: #999;
    margin-bottom: 30px;
    font-size: 18px;
}

.empty-cart .btn {
    padding: 15px 30px;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-cart .btn:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

/* 載入動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: fadeIn 0.5s ease;
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .cart-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cart-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .container h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .cart-item {
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 15px;
    }
    
    .item-image {
        grid-row: 1 / 4;
    }
    
    .item-details {
        grid-column: 2;
        grid-row: 1;
    }
    
    .item-quantity,
    .item-total,
    .item-actions {
        grid-column: 2;
        justify-self: start;
    }
    
    .item-quantity {
        margin: 10px 0;
    }
    
    .cart-summary {
        padding: 20px;
    }
    
    .cart-actions .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .item-image img {
        width: 70px;
        height: 70px;
    }
    
    .qty-btn {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .qty-input {
        width: 50px;
        height: 30px;
        font-size: 14px;
    }
}

/* 特殊效果 */
.cart-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(180deg, #007bff, #0056b3);
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-item:hover::before {
    opacity: 1;
}

/* 購物車項目進入動畫 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-items .cart-item {
    animation: slideInUp 0.6s ease;
}

.cart-items .cart-item:nth-child(2) {
    animation-delay: 0.1s;
}

.cart-items .cart-item:nth-child(3) {
    animation-delay: 0.2s;
}

.cart-items .cart-item:nth-child(4) {
    animation-delay: 0.3s;
}
