/**
 * WooCommerce 报价系统样式
 * 
 * @package WooCommerce_Quote_System
 */

/* =============================================
   报价按钮样式
   ============================================= */

.wqs-add-quote-wrapper {
    margin-top: 10px;
}

.wqs-add-to-quote,
.wqs-add-to-quote-loop {
    background-color: #2196F3 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    border-radius: 4px !important;
    min-width: 120px !important;
}

.wqs-add-to-quote:hover,
.wqs-add-to-quote-loop:hover {
    background-color: #1976D2 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3) !important;
}

.wqs-add-to-quote.added,
.wqs-add-to-quote-loop.added {
    background-color: #27ae60 !important;
}

.wqs-add-to-quote.loading,
.wqs-add-to-quote-loop.loading,
.wqs-add-to-quote-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Guest (not logged in) button style */
.wqs-guest-btn,
.wqs-add-to-quote-btn.wqs-guest-btn {
    background-color: #95a5a6 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    border-radius: 4px !important;
    min-width: 120px !important;
    text-decoration: none !important;
}

.wqs-guest-btn:hover {
    background-color: #7f8c8d !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(149, 165, 166, 0.3) !important;
}

.wqs-login-notice {
    margin-top: 10px;
}

.wqs-login-btn {
    background-color: #95a5a6 !important;
    color: #fff !important;
}

/* =============================================
   Header Icon Shortcode Styles
   ============================================= */

.wqs-header-icon {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.wqs-header-icon-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
    text-decoration: none;
    position: relative;
    padding: 5px;
    transition: all 0.3s ease;
}

.wqs-header-icon-link:hover {
    color: #2196F3;
}

.wqs-header-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wqs-header-icon-svg svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.wqs-header-icon-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #ccc;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.wqs-header-icon-count.has-items {
    background: #f39c12;
}

.wqs-header-icon-text {
    font-size: 13px;
    font-weight: 500;
}

/* Woodmart theme compatibility */
.woodmart-header-row .wqs-header-icon-link {
    height: 100%;
    display: flex;
    align-items: center;
}

.wd-header-my-account + .wqs-header-icon,
.wd-header-cart + .wqs-header-icon {
    margin-left: 15px;
}

.wqs-header-icon + .wd-header-cart,
.wqs-header-icon + .wd-header-my-account {
    margin-left: 15px;
}

/* =============================================
   报价页面样式
   ============================================= */

.wqs-quote-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.wqs-quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c3e50;
    flex-wrap: wrap;
    gap: 10px;
}

.wqs-quote-header h2 {
    font-size: 24px;
    margin: 0;
}

.wqs-download-csv {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #17a2b8 !important;
    color: #fff !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.wqs-download-csv:hover {
    background: #138496 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.wqs-download-csv .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

.wqs-current-quote h2,
.wqs-quote-history h2 {
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c3e50;
}

/* 空报价单 */
.wqs-empty-quote {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.wqs-empty-quote p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

/* 登录提示 */
.wqs-login-required {
    text-align: center;
    padding: 60px 20px;
    background: #fff3cd;
    border-radius: 10px;
    border: 1px solid #ffc107;
}

.wqs-login-required p {
    font-size: 18px;
    color: #856404;
    margin-bottom: 20px;
}

/* =============================================
   验证条件提示
   ============================================= */

.wqs-validation-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wqs-validation-notice.valid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.wqs-validation-notice.invalid {
    background: #fff3cd;
    border: 1px solid #ffeeba;
}

.wqs-validation-notice h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #333;
}

.wqs-validation-notice ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wqs-validation-notice li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 14px;
}

.wqs-validation-notice .condition-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.wqs-validation-notice .condition-met .condition-icon {
    background: #28a745;
    color: #fff;
}

.wqs-validation-notice .condition-unmet .condition-icon {
    background: #dc3545;
    color: #fff;
}

/* =============================================
   报价单表格
   ============================================= */

.wqs-quote-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.wqs-quote-table th,
.wqs-quote-table td {
    padding: 15px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e5e5e5;
}

.wqs-quote-table th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.wqs-quote-table .product-thumbnail img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}

.wqs-quote-table .product-name a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.wqs-quote-table .product-name a:hover {
    color: #2c3e50;
}

.wqs-min-quantity {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 3px;
}

/* 数量选择器 */
.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wqs-qty-minus,
.wqs-qty-plus {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.wqs-qty-minus:hover,
.wqs-qty-plus:hover {
    background: #e0e0e0;
}

.wqs-quantity-input {
    width: 100px;
    height: 36px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wqs-quantity-input::-webkit-outer-spin-button,
.wqs-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 移除按钮 */
.wqs-remove-item {
    width: 30px;
    height: 30px;
    border: none;
    background: #e74c3c;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wqs-remove-item:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* 表格底部 */
.wqs-quote-table tfoot td {
    background: #f9f9f9;
    font-weight: 500;
}

.wqs-quote-table tfoot .label {
    text-align: right;
    font-weight: 600;
}

.wqs-quote-table tfoot .value {
    font-size: 16px;
    color: #2c3e50;
}

/* =============================================
   Customer Information Section
   ============================================= */

.wqs-customer-info-section {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
    margin-top: 30px;
}

.wqs-customer-info-section h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wqs-customer-info-section .required-notice {
    font-size: 12px;
    color: #e74c3c;
    font-weight: normal;
}

.wqs-address-book {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.wqs-address-book label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.wqs-address-select {
    width: 100%;
    max-width: 500px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
}

.wqs-address-select:focus {
    outline: none;
    border-color: #2196F3;
}

.wqs-customer-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wqs-field-row {
    display: flex;
    gap: 20px;
}

.wqs-field {
    flex: 1;
}

.wqs-field-full {
    flex: 1 1 100%;
}

.wqs-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.wqs-field label .required {
    color: #e74c3c;
}

.wqs-field input,
.wqs-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.wqs-field input:focus,
.wqs-field textarea:focus {
    outline: none;
    border-color: #2196F3;
}

.wqs-field input.error,
.wqs-field textarea.error,
.wqs-field input.wqs-field-error,
.wqs-field textarea.wqs-field-error,
input.wqs-field-error,
textarea.wqs-field-error {
    border-color: #e74c3c !important;
    background-color: #fff8f8 !important;
}

.wqs-field .field-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
}

/* Field row responsive */
@media screen and (max-width: 600px) {
    .wqs-field-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* =============================================
   报价单操作区域
   ============================================= */

.wqs-quote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    margin-top: 20px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.wqs-customer-notes {
    flex: 1;
    min-width: 300px;
}

.wqs-customer-notes label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.wqs-customer-notes textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    font-size: 14px;
}

.wqs-customer-notes textarea:focus {
    outline: none;
    border-color: #2c3e50;
}

.wqs-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: flex-end;
}

.wqs-clear-quote {
    background: #95a5a6 !important;
    color: #fff !important;
}

.wqs-clear-quote:hover {
    background: #7f8c8d !important;
}

.wqs-submit-quote {
    background: #27ae60 !important;
    color: #fff !important;
    padding: 15px 30px !important;
    font-size: 16px !important;
}

.wqs-submit-quote:hover:not(:disabled) {
    background: #219a52 !important;
}

.wqs-submit-quote:disabled {
    background: #bdc3c7 !important;
    cursor: not-allowed;
}

/* =============================================
   历史报价单
   ============================================= */

.wqs-quote-history {
    margin-top: 50px;
}

.wqs-history-table {
    width: 100%;
    border-collapse: collapse;
}

.wqs-history-table th,
.wqs-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.wqs-history-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.wqs-status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.wqs-status-pending {
    background: #fff3cd;
    color: #856404;
}

.wqs-status-processing {
    background: #cce5ff;
    color: #004085;
}

.wqs-status-completed {
    background: #d4edda;
    color: #155724;
}

.wqs-status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* History CSV Download Button */
.wqs-download-history-csv {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #17a2b8 !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    white-space: nowrap;
}

.wqs-download-history-csv:hover {
    background: #138496 !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.wqs-download-history-csv .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

/* =============================================
   Pagination
   ============================================= */

.wqs-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
    padding: 15px 0;
    flex-wrap: wrap;
}

.wqs-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.wqs-page-link:hover:not(.disabled):not(.current) {
    background: #f5f5f5;
    border-color: #2196F3;
    color: #2196F3;
}

.wqs-page-link.current {
    background: #2196F3;
    border-color: #2196F3;
    color: #fff;
    font-weight: 600;
}

.wqs-page-link.disabled {
    background: #f9f9f9;
    color: #ccc;
    cursor: not-allowed;
}

.wqs-page-link.prev,
.wqs-page-link.next {
    padding: 0 15px;
}

.wqs-page-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wqs-page-dots {
    padding: 0 8px;
    color: #999;
}

@media screen and (max-width: 600px) {
    .wqs-pagination {
        gap: 5px;
    }
    
    .wqs-page-link {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 13px;
    }
    
    .wqs-page-link.prev,
    .wqs-page-link.next {
        padding: 0 10px;
        font-size: 12px;
    }
}

/* =============================================
   成功弹窗
   ============================================= */

.wqs-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wqs-modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wqs-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.wqs-modal-close:hover {
    color: #333;
}

.wqs-modal-icon {
    width: 60px;
    height: 60px;
    background: #27ae60;
    color: #fff;
    font-size: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.wqs-modal-content h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.wqs-modal-content p {
    color: #666;
    margin-bottom: 20px;
}

.wqs-modal-ok {
    min-width: 120px;
}

/* =============================================
   加载动画
   ============================================= */

.wqs-loading {
    position: relative;
    pointer-events: none;
}

.wqs-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   通知消息
   ============================================= */

.wqs-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
    z-index: 99999;
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wqs-notice.success {
    background: #27ae60;
}

.wqs-notice.error {
    background: #e74c3c;
}

.wqs-notice.warning {
    background: #f39c12;
}

/* =============================================
   响应式设计
   ============================================= */

@media screen and (max-width: 768px) {
    .wqs-quote-table thead {
        display: none;
    }
    
    .wqs-quote-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        padding: 15px;
    }
    
    .wqs-quote-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .wqs-quote-table tbody td::before {
        content: attr(data-title);
        font-weight: 600;
        color: #666;
    }
    
    .wqs-quote-table tbody td:last-child {
        border-bottom: none;
    }
    
    .wqs-quote-table tbody .product-thumbnail {
        justify-content: center;
    }
    
    .wqs-quote-table tbody .product-thumbnail::before {
        display: none;
    }
    
    .wqs-quote-table tfoot tr {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
    }
    
    .wqs-quote-table tfoot td[colspan] {
        display: none;
    }
    
    .wqs-quote-actions {
        flex-direction: column;
    }
    
    .wqs-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .wqs-floating-widget {
        right: 10px;
        bottom: 80px;
    }
    
    .wqs-widget-link {
        padding: 10px;
    }
    
    .wqs-widget-text {
        display: none;
    }
    
    .wqs-history-table thead {
        display: none;
    }
    
    .wqs-history-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e5e5e5;
        border-radius: 8px;
        padding: 10px;
    }
    
    .wqs-history-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .wqs-history-table tbody td::before {
        content: attr(data-title);
        font-weight: 600;
        color: #666;
    }
    
    .wqs-history-table tbody td:last-child {
        border-bottom: none;
    }
}

@media screen and (max-width: 480px) {
    .wqs-modal-content {
        padding: 30px 20px;
    }
    
    .wqs-buttons {
        flex-direction: column;
    }
    
    .wqs-buttons button {
        width: 100%;
    }
}
