/**
 * CPM Enhanced Basket Summary Frontend Styles
 * 重构版 - 移除不必要的模块，重构布局
 */

/* 基础容器 */
.cpm-enhanced-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    background: #fff;
    min-height: 80vh;
}

/* 页面标题区域 */
.cpm-enhanced-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.cpm-header-content {
    flex: 1;
}

.cpm-page-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.cpm-page-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.cpm-header-actions {
    flex-shrink: 0;
}

/* 按钮样式 */
.cpm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
}

.cpm-btn i {
    font-size: 16px;
}

.cpm-btn-primary {
    background: #4C51BF;
    color: white;
}

.cpm-btn-primary:hover {
    background: #434190;
    color: white;
}

.cpm-btn-secondary {
    background: #718096;
    color: white;
}

.cpm-btn-secondary:hover {
    background: #4A5568;
    color: white;
}

.cpm-btn-danger {
    background: #E53E3E;
    color: white;
}

.cpm-btn-danger:hover {
    background: #C53030;
    color: white;
}

.cpm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 加载状态 */
.cpm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cpm-loading-content {
    text-align: center;
}

.cpm-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4C51BF;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* 空状态 */
.cpm-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #F7FAFC;
    border-radius: 8px;
    border: 2px dashed #CBD5E0;
}

.cpm-empty-icon {
    font-size: 48px;
    color: #A0AEC0;
    margin-bottom: 20px;
}

.cpm-empty-state h3 {
    font-size: 24px;
    color: #2D3748;
    margin: 0 0 10px 0;
}

.cpm-empty-state p {
    font-size: 16px;
    color: #718096;
    margin: 0 0 20px 0;
}

/* 产品卡片 - 重构版 */
.cpm-products-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cpm-product-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
}

.cpm-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #CBD5E0;
}

.cpm-product-card.updating::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
    border-radius: 8px;
}

.cpm-product-card.removing {
    opacity: 0.5;
    pointer-events: none;
}

/* 产品图片区域 */
.cpm-product-image {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    position: relative;
}

.cpm-product-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.cpm-product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F7FAFC;
    border-radius: 6px;
    color: #CBD5E0;
    font-size: 48px;
}

.cpm-product-badges {
    position: absolute;
    top: 10px;
    right: 10px;
}

.cpm-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.cpm-badge-sample {
    background: #38A169;
    color: white;
}

/* 产品信息区域 - 重构版 */
.cpm-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 主要区域：标题和操作行 */
.cpm-product-main-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    min-height: 80px;
}

.cpm-header-section {
    flex: 1;
    min-width: 0;
}

.cpm-title-section {
    margin-bottom: 10px;
}

.cpm-product-title {
    font-size: 18px;
    font-weight: 700;
    color: #2D3748;
    margin: 0 0 5px 0;
    line-height: 1.4;
}

.cpm-product-title a {
    color: inherit;
    text-decoration: none;
}

.cpm-product-title a:hover {
    color: #4C51BF;
}

.cpm-product-sku {
    font-size: 14px;
    color: #718096;
    margin: 0;
}

/* 产品操作区域 - 重构版，位于顶部右侧 */
.cpm-product-actions-main {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
    min-width: 320px;
    margin-left: 20px;
}

/* 询盘数量控制 */
.cpm-quantity-control-main {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.cpm-quantity-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cpm-quantity-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #EDF2F7;
    border: 1px solid #CBD5E0;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    color: #4A5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpm-quantity-btn:hover {
    background: #E2E8F0;
}

.cpm-quantity-input-main {
    width: 80px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #CBD5E0;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.cpm-quantity-input-main:focus {
    outline: none;
    border-color: #4C51BF;
}

.cpm-update-quantity-main {
    padding: 8px 16px;
    background: #4C51BF;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.cpm-update-quantity-main:hover {
    background: #434190;
}

.cpm-min-order-main {
    font-size: 14px;
    color: #718096;
    white-space: nowrap;
}

.cpm-min-order-value {
    font-weight: 600;
    color: #4C51BF;
}

/* 样品数量显示 */
.cpm-sample-quantity-main {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

.cpm-quantity-label {
    font-size: 14px;
    color: #718096;
}

.cpm-quantity-value {
    font-size: 18px;
    font-weight: 700;
    color: #4C51BF;
}

/* 操作按钮组 */
.cpm-action-buttons-main {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

.cpm-btn-view-main,
.cpm-remove-product-main {
    padding: 8px 16px;
    font-size: 14px;
    white-space: nowrap;
}

.cpm-btn-view-main {
    background: #4299E1;
    color: white;
}

.cpm-btn-view-main:hover {
    background: #3182CE;
}

/* 产品描述 */
.cpm-product-description {
    font-size: 14px;
    color: #4A5568;
    line-height: 1.6;
    margin: 15px 0;
    padding-top: 15px;
    border-top: 1px solid #E2E8F0;
}

/* 选项列表 - 保留但移动到底部 */
.cpm-product-options {
    background: #F7FAFC;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    margin-top: 15px;
}

.cpm-section-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #2D3748;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cpm-section-subtitle i {
    color: #4C51BF;
}

.cpm-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cpm-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.cpm-option-name {
    font-weight: 600;
    color: #4A5568;
    min-width: 120px;
}

.cpm-option-value {
    color: #2D3748;
}

.cpm-option-moq {
    font-size: 12px;
    color: #718096;
    font-style: italic;
}

/* 全局备注区域 */
.cpm-global-notes-section {
    margin: 30px 0;
    padding: 20px;
    background: #F7FAFC;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
}

.cpm-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #2D3748;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cpm-notes-container {
    position: relative;
}

.cpm-notes-textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid #CBD5E0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.cpm-notes-textarea:focus {
    outline: none;
    border-color: #4C51BF;
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.1);
}

.cpm-notes-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: #718096;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 底部操作栏 - 调整布局以容纳Clear All按钮 */
.cpm-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.cpm-action-left,
.cpm-action-right {
    display: flex;
    gap: 10px;
}

/* 模态框 */
.cpm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.cpm-modal-container {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.cpm-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #2D3748;
    margin: 0;
}

.cpm-modal-close {
    font-size: 24px;
    color: #718096;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpm-modal-close:hover {
    color: #E53E3E;
}

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

/* 表单样式 */
.cpm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.cpm-form-group {
    margin-bottom: 15px;
}

.cpm-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
    margin-bottom: 5px;
}

.cpm-form-group input,
.cpm-form-group textarea,
.cpm-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #CBD5E0;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cpm-form-group input:focus,
.cpm-form-group textarea:focus,
.cpm-form-group select:focus {
    outline: none;
    border-color: #4C51BF;
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.1);
}

.cpm-form-group input.error,
.cpm-form-group textarea.error {
    border-color: #E53E3E;
}

.cpm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 产品详情模态框 */
.cpm-product-modal .cpm-modal-container {
    max-width: 800px;
}

.cpm-product-details-content {
    padding: 10px 0;
}

.cpm-product-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: #2D3748;
    margin: 0 0 10px 0;
}

.cpm-product-detail-sku {
    font-size: 14px;
    color: #718096;
    margin-bottom: 10px;
}

.cpm-product-detail-min-order {
    font-size: 14px;
    color: #4C51BF;
    font-weight: 600;
    margin-bottom: 20px;
}

.cpm-product-detail-specs h5,
.cpm-product-detail-variations h5 {
    font-size: 16px;
    font-weight: 600;
    color: #2D3748;
    margin: 20px 0 10px 0;
}

.cpm-specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cpm-specs-table tr {
    border-bottom: 1px solid #E2E8F0;
}

.cpm-specs-table td {
    padding: 10px;
}

.cpm-spec-name {
    font-weight: 600;
    color: #4A5568;
    width: 40%;
}

.cpm-variation-group {
    margin-bottom: 15px;
}

.cpm-variation-group h6 {
    font-size: 14px;
    font-weight: 600;
    color: #4A5568;
    margin: 0 0 8px 0;
}

.cpm-variation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cpm-variation-option {
    padding: 6px 12px;
    background: #EDF2F7;
    border: 1px solid #CBD5E0;
    border-radius: 4px;
    font-size: 14px;
    color: #4A5568;
}

/* 新增：已选选项高亮样式 */
.cpm-variation-option-selected {
    background: #4C51BF;
    color: white;
    border-color: #4C51BF;
}

/* 消息提示 */
.cpm-message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
}

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

.cpm-message-success {
    background: #C6F6D5;
    color: #22543D;
    border: 1px solid #9AE6B4;
}

.cpm-message-error {
    background: #FED7D7;
    color: #742A2A;
    border: 1px solid #FC8181;
}

/* 错误信息 */
.cpm-error-message {
    padding: 30px;
    text-align: center;
    background: #FFF5F5;
    border: 1px solid #FED7D7;
    border-radius: 6px;
    color: #C53030;
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .cpm-product-actions-main {
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .cpm-enhanced-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .cpm-header-actions {
        width: 100%;
    }
    
    .cpm-product-card {
        flex-direction: column;
        min-height: auto;
    }
    
    .cpm-product-image {
        width: 100%;
        height: 200px;
    }
    
    .cpm-product-main-area {
        flex-direction: column;
        gap: 15px;
    }
    
    .cpm-product-actions-main {
        width: 100%;
        min-width: auto;
        margin-left: 0;
        align-items: stretch;
    }
    
    .cpm-quantity-control-main {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .cpm-action-buttons-main {
        justify-content: space-between;
    }
    
    .cpm-form-grid {
        grid-template-columns: 1fr;
    }
    
    .cpm-action-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .cpm-action-left,
    .cpm-action-right {
        width: 100%;
    }
    
    .cpm-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cpm-quantity-control-main {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cpm-quantity-input-group {
        justify-content: center;
    }
    
    .cpm-action-buttons-main {
        flex-direction: column;
    }
    
    .cpm-btn-view-main,
    .cpm-remove-product-main {
        width: 100%;
    }
}