/* 購物車相關樣式 */

/* 購物車頁面樣式 */
.cart-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-top: 20px;
}

.cart-items {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 80px;
    gap: 15px;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

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

.item-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.item-details h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

.item-code,
.item-spec {
    font-size: 12px;
    color: #666;
    margin: 2px 0;
}

.item-price {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.item-quantity {
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #f5f5f5;
}

.qty-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.item-total {
    font-weight: bold;
    color: #333;
    text-align: right;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-remove:hover {
    background: #c82333;
}

.cart-summary {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 5px 0;
}

.summary-item.total {
    border-top: 1px solid #eee;
    margin-top: 15px;
    padding-top: 15px;
    font-weight: bold;
    font-size: 18px;
}

.cart-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-cart h2 {
    color: #666;
    margin-bottom: 10px;
}

.empty-cart p {
    color: #999;
    margin-bottom: 20px;
}

/* 載入訊息樣式 */
.cart-loading-message .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 購物車彈窗樣式 */
.cart-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.cart-modal-header h3 {
    margin: 0;
    color: #333;
}

.cart-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.cart-modal-close:hover {
    color: #333;
}

.cart-modal-body {
    padding: 20px;
}

.added-item {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
}

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

.item-info h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.item-info p {
    margin: 2px 0;
    color: #666;
    font-size: 14px;
}

.cart-modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
    justify-content: flex-end;
}

.cart-modal-footer .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.cart-modal-footer .btn-secondary {
    background: #6c757d;
    color: white;
}

.cart-modal-footer .btn-secondary:hover {
    background: #5a6268;
}

.cart-modal-footer .btn-primary {
    background: #007bff;
    color: white;
}

.cart-modal-footer .btn-primary:hover {
    background: #0056b3;
}

/* 訊息通知樣式 */
.cart-message {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 購物車數量徽章樣式 */
.cart-badge, .cart-count {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 規格選擇樣式優化 */
.spec-option {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 5px;
}

.spec-option:hover {
    background-color: #f8f9fa;
}

.spec-option.active {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.spec-option input[type="radio"] {
    margin-right: 8px;
}

/* 數量選擇器樣式 */
.prdQuantity {
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.prdQuantity label {
    font-weight: 500;
    color: #333;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-selector .qty-btn {
    width: 35px;
    height: 35px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333;
    transition: background-color 0.2s ease;
}

.quantity-selector .qty-btn:hover {
    background: #e9ecef;
}

.quantity-selector .qty-input {
    width: 60px;
    height: 35px;
    border: none;
    text-align: center;
    font-size: 14px;
    outline: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.quantity-selector .qty-input:focus {
    background: #f8f9fa;
}

/* 按鈕樣式優化 */
.prdActions .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.2s ease;
    margin-right: 10px;
}

.prdActions .btn:last-child {
    margin-right: 0;
}

.prdActions .btn-primary {
    background: #28a745;
    color: white;
}

.prdActions .btn-primary:hover {
    background: #218838;
    transform: translateY(-1px);
}

.prdActions .btn-secondary {
    background: #007bff;
    color: white;
}

.prdActions .btn-secondary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.prdActions .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .cart-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto auto;
        gap: 10px;
    }
    
    .item-image {
        grid-row: 1 / 3;
    }
    
    .item-details {
        grid-column: 2;
    }
    
    .item-quantity,
    .item-total,
    .item-actions {
        grid-column: 2;
        justify-self: start;
    }
    
    .cart-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .cart-modal-footer {
        flex-direction: column;
    }
    
    .cart-modal-footer .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .added-item {
        flex-direction: column;
        text-align: center;
    }
    
    .prdActions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .prdActions .btn {
        width: 100%;
        margin-right: 0;
    }
}
