/**
 * AdWeb Pro Add To Cart Product Styles
 * 购物车产品组件样式文件
 */

/* 基础容器样式 */
.adweb-add-to-cart-product-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* 表单样式 */
.adweb-cart-product-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* 数量选择器样式 */
.adweb-quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.adweb-quantity-input {
    width: 80px;
    height: 40px;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    background: #fff;
    transition: border-color 0.2s ease;
    outline: none;
}

.adweb-quantity-input:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.adweb-quantity-input::-webkit-outer-spin-button,
.adweb-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.adweb-quantity-input[type=number] {
    -moz-appearance: textfield;
}

/* 按钮样式 */
.adweb-add-to-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    background: #007cba;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 48px;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.adweb-add-to-cart-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.adweb-add-to-cart-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.adweb-add-to-cart-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3);
}

.adweb-add-to-cart-button:disabled {
    background: #a0a5aa;
    color: #ffffff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 删除按钮样式 */
.adweb-remove-from-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #dc3545;
    border-radius: 4px;
    background: transparent;
    color: #dc3545;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 36px;
}

.adweb-remove-from-cart-btn:hover {
    background: #dc3545;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.adweb-remove-from-cart-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(220, 53, 69, 0.2);
}

.adweb-remove-from-cart-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

.adweb-remove-from-cart-btn:disabled,
.adweb-remove-from-cart-btn.loading {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.adweb-remove-from-cart-btn.loading {
    opacity: 0.7;
}

/* 删除按钮图标 */
.adweb-remove-icon {
    font-size: 12px;
    font-weight: bold;
}

/* 购物车项目样式 */
.adweb-cart-item {
    position: relative;
    padding: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #ffffff;
    transition: all 0.3s ease;
}

.adweb-cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.adweb-cart-item .adweb-remove-from-cart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 10px;
    font-size: 12px;
    min-height: 28px;
}

/* 空购物车消息 */
.adweb-empty-cart-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 16px;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* 按钮图标样式 */
.adweb-button-icon {
    display: inline-flex;
    align-items: center;
    font-size: 16px;
}

.adweb-icon-before {
    margin-right: 4px;
}

.adweb-icon-after {
    margin-left: 4px;
}

/* 按钮文本样式 */
.adweb-button-text {
    font-weight: inherit;
    line-height: inherit;
}

/* 消息样式 */
.adweb-cart-messages {
    margin-top: 15px;
}

.adweb-cart-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.adweb-cart-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.adweb-cart-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.adweb-cart-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.adweb-cart-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.adweb-message-icon {
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.adweb-message-text {
    flex: 1;
    line-height: 1.4;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.adweb-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

.adweb-loading-spinner svg {
    width: 100%;
    height: 100%;
}

/* 消息动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.adweb-cart-message.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* 布局变体 */
.elementor-add-to-cart-product--layout-inline .adweb-cart-product-form {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.elementor-add-to-cart-product--layout-inline .adweb-quantity-wrapper {
    flex: 0 0 auto;
}

.elementor-add-to-cart-product--layout-inline .adweb-add-to-cart-button {
    flex: 1;
    min-width: 120px;
}

.elementor-add-to-cart-product--layout-stacked .adweb-cart-product-form {
    flex-direction: column;
}

.elementor-add-to-cart-product--layout-auto .adweb-cart-product-form {
    flex-direction: column;
}

/* 对齐方式 */
.elementor-add-to-cart-product--align-left {
    text-align: left;
}

.elementor-add-to-cart-product--align-left .adweb-quantity-wrapper {
    justify-content: flex-start;
}

.elementor-add-to-cart-product--align-center {
    text-align: center;
}

.elementor-add-to-cart-product--align-center .adweb-quantity-wrapper {
    justify-content: center;
}

.elementor-add-to-cart-product--align-right {
    text-align: right;
}

.elementor-add-to-cart-product--align-right .adweb-quantity-wrapper {
    justify-content: flex-end;
}

.elementor-add-to-cart-product--align-justify .adweb-add-to-cart-button {
    width: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .elementor-add-to-cart-product--layout-inline .adweb-cart-product-form {
        flex-direction: column;
        gap: 12px;
    }
    
    .adweb-quantity-wrapper {
        justify-content: center;
    }
    
    .adweb-add-to-cart-button {
        width: 100%;
        min-width: auto;
    }
    
    .adweb-quantity-input {
        width: 70px;
        height: 36px;
        font-size: 14px;
    }
    
    .adweb-add-to-cart-button {
        padding: 10px 20px;
        font-size: 15px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .adweb-add-to-cart-product-wrapper {
        gap: 12px;
    }
    
    .adweb-cart-product-form {
        gap: 10px;
    }
    
    .adweb-quantity-input {
        width: 60px;
        height: 32px;
        font-size: 14px;
        padding: 6px 8px;
    }
    
    .adweb-add-to-cart-button {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .adweb-cart-message {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .adweb-quantity-input {
        border-width: 3px;
    }
    
    .adweb-add-to-cart-button {
        border: 2px solid transparent;
    }
    
    .adweb-add-to-cart-button:focus {
        border-color: currentColor;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .adweb-add-to-cart-button,
    .adweb-quantity-input,
    .adweb-cart-message {
        transition: none;
    }
    
    .adweb-loading-spinner {
        animation: none;
    }
    
    .adweb-cart-message {
        animation: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .adweb-quantity-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .adweb-quantity-input:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
    }
    
    .adweb-cart-message.success {
        background: #2d5a3d;
        color: #9ae6b4;
        border-color: #38a169;
    }
    
    .adweb-cart-message.error {
        background: #5a2d2d;
        color: #feb2b2;
        border-color: #e53e3e;
    }
    
    .adweb-cart-message.info {
        background: #2d4a5a;
        color: #90cdf4;
        border-color: #3182ce;
    }
    
    .adweb-cart-message.warning {
        background: #5a4d2d;
        color: #faf089;
        border-color: #d69e2e;
    }
}

/* Elementor编辑器特定样式 */
.elementor-editor-active .adweb-add-to-cart-product-wrapper {
    pointer-events: auto;
}

.elementor-editor-active .adweb-add-to-cart-button {
    cursor: default;
}

/* 无障碍支持 */
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    word-wrap: normal !important;
    border: 0;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    width: 1px;
}

/* 焦点可见性 */
.adweb-quantity-input:focus-visible,
.adweb-add-to-cart-button:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .adweb-add-to-cart-product-wrapper {
        display: none;
    }
}