/**
 * Frontend styles for Protar Quote Tools
 */

/* Packing Estimate */
.pqt-packing-estimate {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.95em;
    color: #555;
}

.pqt-packing-estimate strong {
    color: #333;
}

/* Product Add-ons */
.pqt-product-addons {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.pqt-addons-title {
    margin: 0 0 15px;
    font-size: 18px;
    color: #333;
}

.pqt-addon-field {
    margin-bottom: 20px;
}

.pqt-addon-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.pqt-addon-field .required {
    color: #dc3545;
}

.pqt-addon-field .pqt-tooltip {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: #666;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    cursor: help;
    margin-left: 5px;
}

.pqt-addon-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.pqt-addon-input:focus {
    border-color: #0274be;
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 116, 190, 0.1);
}

/* File Upload */
.pqt-file-upload-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.pqt-file-upload-area-clickable {
    width: 100%;
    cursor: pointer;
    display: block;
    position: relative;
    margin-bottom: 0;
}

.pqt-file-upload-area-clickable .pqt-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.pqt-drop-zone {
    width: 100%;
    min-height: 60px;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-align: center;
    box-sizing: border-box;
}

.pqt-drop-zone.drag-over,
.pqt-file-upload-area-clickable:hover .pqt-drop-zone {
    background: #e8f3fb;
    border-color: #0274be;
}

.pqt-drop-text {
    color: #333;
    font-weight: 600;
    white-space: nowrap;
}

.pqt-drop-help {
    color: #777;
    font-size: 12px;
}

.pqt-upload-progress {
    margin-top: 10px;
    margin-bottom: 0;
    width: 100%;
    display: block;
}

.pqt-progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.pqt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0274be, #0295d9);
    transition: width 0.3s;
    width: 0%;
}

.pqt-progress-text {
    font-size: 12px;
    color: #666;
}

.pqt-uploaded-files {
    margin-top: 12px;
    margin-bottom: 0;
    clear: both;
    width: 100%;
    display: block;
    position: relative;
}

.pqt-uploaded-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 6px;
    min-height: auto;
    gap: 8px; /* 元素间距 */
    overflow: hidden; /* 防止溢出 */
}

.pqt-uploaded-file.pqt-compact {
    padding: 4px 10px;
    font-size: 13px;
    min-height: 32px;
    align-items: flex-start; /* 允许内容顶部对齐，便于换行 */
    padding-top: 6px; /* 稍微增加上内边距 */
    padding-bottom: 6px;
}

.pqt-file-check-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    min-width: 18px; /* 防止被压缩 */
    min-height: 18px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px; /* 与换行文字对齐 */
    align-self: flex-start; /* 顶部对齐 */
}

.pqt-uploaded-file .file-name {
    flex: 1;
    min-width: 0; /* 允许flex item缩小 */
    color: #333;
    margin-right: 8px;
    word-break: break-word; /* 允许长单词换行 */
    word-wrap: break-word; /* 兼容性 */
    overflow-wrap: break-word; /* 标准属性 */
    hyphens: auto; /* 自动断词 */
    line-height: 1.4;
}

.pqt-remove-file {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    border: none;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
    margin-top: 2px; /* 与换行文字对齐 */
    align-self: flex-start; /* 顶部对齐 */
}

.pqt-remove-file:hover {
    background: #c82333;
}

/* Checkbox Labels */
.pqt-checkbox-label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal !important;
}

.pqt-checkbox-label input {
    margin-right: 8px;
}

/* Cart Styles */
.pqt-cart-totals-summary {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.pqt-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.pqt-totals-row:last-child {
    border-bottom: none;
}

.pqt-label {
    font-weight: 600;
    color: #333;
}

.pqt-value {
    color: #555;
}

.pqt-quote-button {
    width: 100%;
    margin-top: 10px !important;
    text-align: center;
}

/* Checkout Send Quote Button - Match Place Order Button Style */
.woocommerce-checkout .place-order .pqt-send-quote-button {
    width: 100% !important;
    font-size: 1em;
    padding: 0.6180469716em 1.41575em;
    line-height: 1.41575em;
    display: block;
    box-sizing: border-box;
    text-align: center;
}

.pqt-packing-meta {
    color: #666;
    font-size: 0.9em;
}

.pqt-addons-display {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}

/* 购物车和mini购物车中的文件名长度限制 */
table.cart .pqt-addons-display,
.woocommerce-cart .pqt-addons-display,
.cart-popup .pqt-addons-display,
.cart-sidebar .pqt-addons-display,
.flatsome-mini-cart .pqt-addons-display,
.widget_shopping_cart .pqt-addons-display,
#cart-popup .pqt-addons-display,
.cart-dropdown .pqt-addons-display,
.off-canvas-cart .pqt-addons-display {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}

table.cart .pqt-addons-display a,
.woocommerce-cart .pqt-addons-display a,
.cart-popup .pqt-addons-display a,
.cart-sidebar .pqt-addons-display a,
.flatsome-mini-cart .pqt-addons-display a,
.widget_shopping_cart .pqt-addons-display a,
#cart-popup .pqt-addons-display a,
.cart-dropdown .pqt-addons-display a,
.off-canvas-cart .pqt-addons-display a {
    display: inline-block;
    max-width: 150px; /* 约15个英文字符的宽度 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Mini Cart 特定样式 */
.cart-popup .pqt-addons-display,
.cart-sidebar .pqt-addons-display,
.flatsome-mini-cart .pqt-addons-display,
.widget_shopping_cart .pqt-addons-display,
#cart-popup .pqt-addons-display,
.cart-dropdown .pqt-addons-display,
.off-canvas-cart .pqt-addons-display {
    font-size: 0.85em;
}

.cart-popup .pqt-addons-display a,
.cart-sidebar .pqt-addons-display a,
.flatsome-mini-cart .pqt-addons-display a,
.widget_shopping_cart .pqt-addons-display a,
#cart-popup .pqt-addons-display a,
.cart-dropdown .pqt-addons-display a,
.off-canvas-cart .pqt-addons-display a {
    max-width: 120px;
}

/* Edit Add-ons Button */
.pqt-edit-addons-wrapper {
    margin-top: 8px;
}

.pqt-edit-addons-link {
    display: inline-block;
    color: #e64b3c !important;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.pqt-edit-addons-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Modal */
.pqt-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.pqt-modal-content {
    position: relative;
    margin: 50px auto;
    max-width: 600px;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.pqt-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

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

/* Quote Received Page */
.pqt-quote-received-wrapper {
    margin: 30px 0;
}

.pqt-thank-you-message h1 {
    color: #333;
    margin-bottom: 15px;
}

.pqt-message-box {
    padding: 20px;
    background: #ffebee;
    border-left: 4px solid #dc3545;
    border-radius: 4px;
    color: #721c24;
    line-height: 1.6;
}

.pqt-packing-info,
.pqt-addons-info {
    color: #666;
    font-size: 0.9em;
}

/* My Account Quotes */
.pqt-quotes-list {
    margin: 20px 0;
}

.pqt-quote-alert {
    padding: 15px;
    margin-bottom: 20px;
    background: #ffebee;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.pqt-excel-download {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.pqt-excel-download h3 {
    margin-top: 0;
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .pqt-modal-content {
        margin: 20px;
        padding: 20px;
        max-height: 90vh;
    }
    
    .pqt-cart-totals-summary {
        font-size: 0.9em;
    }
}



