/**
 * 购物车组件样式
 * 独立的CSS类名，避免与结账组件冲突
 */

/* 全屏遮罩样式 */
body.wd-cart-fullscreen-active {
    overflow: hidden;
}

body.wd-cart-fullscreen-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999998;
    pointer-events: none;
}

/* 购物车组件基础样式 */
.wd-cart-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
    background: var(--bg-color, #000000);
    color: var(--text-color, #ffffff);
    max-width: 100%;
    margin: 0 auto;
}

/* 全局字体颜色设置 */
.wd-cart-widget,
.wd-cart-widget h1,
.wd-cart-widget h2,
.wd-cart-widget h3,
.wd-cart-widget h4,
.wd-cart-widget h5,
.wd-cart-widget h6,
.wd-cart-widget p,
.wd-cart-widget span,
.wd-cart-widget div,
.wd-cart-widget label,
.wd-cart-widget td,
.wd-cart-widget th,
.wd-cart-widget input,
.wd-cart-widget textarea,
.wd-cart-widget .wd-cart-item-name,
.wd-cart-widget .wd-cart-item-description,
.wd-cart-widget .wd-cart-item-price,
.wd-cart-widget .wd-cart-total-items,
.wd-cart-widget .wd-cart-total-price,
.wd-cart-widget .wd-cart-total-amount {
    color: var(--text-color, #ffffff) !important;
}

/* 全屏模式样式 */
.wd-cart-widget.wd-cart-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background: var(--bg-color, #000000);
    display: flex;
    flex-direction: column;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* 页眉样式 */
.wd-cart-header {
    background: var(--header-bg-color, #2c2c2c);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.wd-cart-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wd-cart-back-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: none;
    color: var(--text-color, #ffffff);
}

.wd-cart-back-btn:hover {
    background: none;
}

.wd-cart-back-btn:focus {
    outline: none;
    box-shadow: none;
}

.wd-cart-back-btn:active {
    background: none;
    transform: none;
}

.wd-cart-title-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wd-cart-cart-icon {
    font-size: 24px;
    color: var(--text-color, #ffffff);
}

.wd-cart-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color, #ffffff);
}

/* 主内容区域 */
.wd-cart-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--content-bg-color, #000000) !important;
}

.wd-cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.wd-cart-content::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* 加载状态 */
.wd-cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
}

.wd-cart-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid var(--primary-color, #007cba);
    border-radius: 50%;
    animation: wd-cart-spin 1s linear infinite;
}

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

/* 购物车部分 */
.wd-cart-cart-section {
    padding: 20px;
    min-height: 100%;
}

/* 购物车表格 */
.wd-cart-cart-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent;
}

.wd-cart-cart-header {
    background: var(--cart-header-bg-color, #666666);
}

.wd-cart-cart-header th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #333;
    color: var(--text-color, #ffffff);
    vertical-align: middle;
}

.wd-cart-cart-header th:nth-child(2) {
    text-align: left;
    width: 50%;
    padding-left: 75px;
}

.wd-cart-cart-header th:first-child {
    width: 100%;
    text-align: center;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: left;
    gap: 4px;
    height: 100%;
}

.wd-cart-cart-header th:nth-child(3) {
    width: 15%;
}

.wd-cart-cart-header th:nth-child(4) {
    width: 20%;
}

.wd-cart-cart-header th:nth-child(5) {
    width: 15%;
}

/* 购物车商品行 */
.wd-cart-cart-item {
    background: var(--cart-item-bg-color, #2c2c2c);
    transition: background-color 0.3s ease;
    border-radius: 8px;
    margin-top: 10px;
}

.wd-cart-cart-item:first-child {
    margin-top: 5px;
}

.wd-cart-cart-item:hover {
    background: var(--cart-item-bg-color, #333);
}

.wd-cart-cart-item:hover.is-selected {
    background: var(--cart-item-selected-bg-color, #666666) !important;
}

.wd-cart-cart-item.is-selected {
    background: var(--cart-item-selected-bg-color, #666666) !important;
}

/* 强制选中状态样式，确保高优先级 */
tr.wd-cart-cart-item.is-selected {
    background: var(--cart-item-selected-bg-color, #666666) !important;
}

/* 确保选中状态在所有情况下都生效 */
.wd-cart-cart-table .wd-cart-cart-item.is-selected {
    background: var(--cart-item-selected-bg-color, #666666) !important;
}

.wd-cart-cart-item td {
    padding: 15px 12px;
    vertical-align: middle;
    color: var(--text-color, #ffffff);
}

.wd-cart-item-checkbox {
    text-align: left;
}

.wd-cart-item-select {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wd-cart-item-select:focus {
    outline: none;
    box-shadow: none;
}

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

.wd-cart-item-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.wd-cart-no-image {
    width: 150px;
    height: 150px;
    background: #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

.wd-cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: flex-start;
    height: 150px;
}

.wd-cart-item-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color, #ffffff);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    border-bottom: 2px solid #e2e4e7;
    padding-bottom: 5px;
}

.wd-cart-item-description {
    color: #cccccc;
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 8px;
}

.wd-cart-item-price {
    font-weight: 600;
    color: var(--text-color, #ffffff);
    font-size: 16px;
    text-align: center;
}

.wd-cart-item-quantity {
    text-align: center;
}

/* 数量控制 */
.wd-cart-quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wd-cart-quantity-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: none;
}

.wd-cart-quantity-btn:hover {
    background: #ffffff !important;
    color: #000000 !important;
}

.wd-cart-quantity-btn:focus {
    outline: none;
    box-shadow: none;
}

.wd-cart-quantity-btn:active {
    background: #ffffff !important;
    color: #000000 !important;
    transform: none;
}

.wd-cart-quantity-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-color, #ffffff);
}

.wd-cart-updating {
    color: var(--primary-color, #007cba);
    font-size: 12px;
}

/* 操作按钮 */
.wd-cart-item-actions {
    text-align: center;
}

.wd-cart-remove-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: var(--text-color, #ffffff);
    transition: none;
}

.wd-cart-remove-btn:hover {
    background: none;
    transform: none;
}

.wd-cart-remove-btn:focus {
    outline: none;
    box-shadow: none;
}

.wd-cart-remove-btn:active {
    background: none;
    transform: none;
}

/* 空购物车状态 */
.wd-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color, #ffffff);
}

.wd-cart-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.wd-cart-empty-message {
    font-size: 18px;
    color: var(--text-color, #ffffff);
    opacity: 0.7;
}

/* 底部工具栏 */
.wd-cart-footer {
    background: var(--footer-bg-color, #666666);
    padding: 20px;
    flex-shrink: 0;
}

.wd-cart-footer-active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.wd-cart-footer-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.wd-cart-footer-select-all-container {
    display: flex;
    align-items: center;
}

.wd-cart-footer-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.wd-cart-total-items {
    font-size: 16px;
    color: var(--text-color, #ffffff);
}

.wd-cart-total-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #ffffff);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wd-cart-total-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #ffffff);
}

.wd-cart-next-btn {
    background: #000000;
    color: #ffffff !important;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.wd-cart-next-btn:hover {
    opacity: 0.9;
}

.wd-cart-next-btn:focus {
    outline: none;
    box-shadow: none;
}

.wd-cart-next-btn:active {
    transform: none;
}

.wd-cart-next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wd-cart-header {
        padding: 15px;
    }
    
    .wd-cart-title {
        font-size: 20px;
    }
    
    .wd-cart-cart-section {
        padding: 15px;
    }
    
    .wd-cart-item-image,
    .wd-cart-no-image {
        width: 80px;
        height: 80px;
    }
    
    .wd-cart-item-name {
        font-size: 14px;
    }
    
    .wd-cart-item-description {
        font-size: 12px;
    }
    
    .wd-cart-footer {
        padding: 15px;
    }
    
    .wd-cart-footer-active {
        flex-direction: column;
        gap: 15px;
    }
    
    .wd-cart-next-btn {
        width: 100%;
    }
}

.wd-cart-select-all {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wd-cart-select-all:focus {
    outline: none;
    box-shadow: none;
}

.wd-cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 10000;
    max-width: 300px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    background: #4CAF50;
    color: white;
}

.wd-cart-message.error {
    background: #f44336;
}

.wd-cart-message.warning {
    background: #ff9800;
}

.wd-cart-message.info {
    background: #2196F3;
}

/* 自定义确认对话框 */
.wd-cart-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wd-cart-confirm-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.wd-cart-confirm-dialog {
    background: #333;
    color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wd-cart-confirm-overlay.is-visible .wd-cart-confirm-dialog {
    transform: scale(1);
}

.wd-cart-confirm-dialog p {
    margin: 0 0 25px 0;
    font-size: 16px;
    line-height: 1.6;
}

.wd-cart-confirm-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.wd-cart-confirm-dialog button {
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.wd-cart-confirm-cancel {
    background: #555;
    color: #fff;
}

.wd-cart-confirm-cancel:hover {
    background: #666;
}

.wd-cart-confirm-ok {
    background: #007cba;
    color: #fff;
}

.wd-cart-confirm-ok:hover {
    background: #0095e0;
}

.wd-cart-select-all-label {
    margin-left: 6px;
    font-size: 15px;
    vertical-align: middle;
    color: var(--text-color, #ffffff);
    user-select: none;
    display: inline-block;
    line-height: 1;
} 