/**
 * Smart BOM Frontend Styles
 *
 * @package SmartBOM
 */

/* Container */
.smart-bom-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.smart-bom-header {
    text-align: center;
    margin-bottom: 40px;
}

.smart-bom-header h2 {
    font-size: 32px;
    color: #333;
    margin-bottom: 10px;
}

/* Input Methods */
.smart-bom-input-wrapper {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    position: relative;
    align-items: flex-start;
}

.smart-bom-input-wrapper::before {
    content: "OR";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 10px 20px;
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
    z-index: 1;
}

.smart-bom-input-method {
    flex: 1;
    min-width: 0;
}

.smart-bom-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.smart-bom-card h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Text Area */
.smart-bom-text-area {
    margin-bottom: 20px;
}

.smart-bom-text-area textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

.smart-bom-text-area textarea:focus {
    outline: none;
    border-color: #0073aa;
}

/* Upload Area */
.smart-bom-upload-area {
    border: 2px dashed #0073aa;
    border-radius: 4px;
    padding: 40px 20px;
    text-align: center;
    background: #f9f9f9;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.smart-bom-upload-area:hover {
    background: #f0f8ff;
    border-color: #005a87;
}

.smart-bom-upload-area.dragover {
    background: #e0f2ff;
    border-color: #005a87;
}

.smart-bom-upload-content p {
    margin-bottom: 15px;
    color: #666;
    font-size: 16px;
}

.smart-bom-btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    padding: 12px 24px;
}

.smart-bom-upload-icon {
    font-size: 20px;
}

.smart-bom-upload-info {
    text-align: center;
    margin-top: 15px;
}

.smart-bom-file-types {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.smart-bom-download-sample {
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
}

.smart-bom-download-sample:hover {
    text-decoration: underline;
}

.smart-bom-manage-link {
    text-align: right;
    margin-top: 20px;
}

.smart-bom-manage-bom {
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
}

.smart-bom-manage-bom:hover {
    text-decoration: underline;
}

/* Buttons */
.smart-bom-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.smart-bom-btn-primary {
    background: #0073aa;
    color: white;
}

.smart-bom-btn-primary:hover {
    background: #005a87;
}

.smart-bom-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.smart-bom-btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.smart-bom-btn-secondary:hover {
    background: #e0e0e0;
}

.smart-bom-btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.smart-bom-btn-danger {
    background: #dc3545;
    color: white;
}

.smart-bom-btn-danger:hover {
    background: #c82333;
}

.smart-bom-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

/* Loading */
.smart-bom-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.smart-bom-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.smart-bom-loading p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* Modal */
.smart-bom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smart-bom-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.smart-bom-modal-header h3 {
    margin: 0;
    font-size: 24px;
}

.smart-bom-modal-close {
    font-size: 30px;
    cursor: pointer;
    color: #999;
}

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

.smart-bom-modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Preview Modal Styles */
.smart-bom-preview-content {
    min-width: 600px;
}

.smart-bom-preview-content p {
    font-size: 16px;
    margin-bottom: 15px;
}

.smart-bom-preview-options {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.smart-bom-preview-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.smart-bom-preview-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.smart-bom-preview-table-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 20px;
}

.smart-bom-preview-table-wrapper table {
    margin: 0;
}

.smart-bom-preview-table-wrapper th,
.smart-bom-preview-table-wrapper td {
    padding: 10px;
    font-size: 14px;
}

.smart-bom-preview-qty {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.smart-bom-preview-qty:focus {
    outline: none;
    border-color: #0073aa;
}

.smart-bom-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.smart-bom-modal-actions .smart-bom-btn {
    margin: 0;
}

/* Cart Success Dialog */
.smart-bom-cart-success {
    text-align: center;
}

.smart-bom-cart-success h3 {
    color: #28a745;
    font-size: 24px;
    margin-bottom: 15px;
}

.smart-bom-cart-success p {
    font-size: 16px;
    margin-bottom: 15px;
}

.smart-bom-cart-total {
    font-size: 18px;
    color: #0073aa;
    margin: 20px 0;
}

.smart-bom-cart-errors {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.smart-bom-cart-errors strong {
    color: #856404;
}

.smart-bom-cart-errors ul {
    margin: 10px 0 0 20px;
    color: #856404;
}

.smart-bom-cart-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.smart-bom-cart-actions .smart-bom-btn {
    margin: 0;
    min-width: 150px;
}

/* Bulk Search Results */
.smart-bom-search-results {
    width: 100%;
    max-width: 980px;
}

.smart-bom-search-results h3 {
    margin-bottom: 10px;
    color: #333;
}

.smart-bom-search-actions-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fb 100%);
    border: 1px solid #e5ecf3;
    border-radius: 10px;
}

.smart-bom-search-actions-top label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.smart-bom-search-actions-top input[type="text"] {
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #d6dbe3;
    border-radius: 8px;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.smart-bom-search-actions-top input[type="text"]:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,.15);
    outline: none;
}

.smart-bom-search-results-list {
    margin-bottom: 20px;
}

.smart-bom-search-item {
    border: 1px solid #e7edf4;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    background: #fff;
    transition: box-shadow .2s ease, transform .05s ease;
}

.smart-bom-search-item:hover {
    box-shadow: 0 8px 24px rgba(18,38,63,.08);
}

.smart-bom-search-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.smart-bom-search-item-header h4 {
    margin: 0;
    color: #333;
}

.smart-bom-search-best-match {
    margin-bottom: 15px;
}

.smart-bom-product-select {
    display: block;
    cursor: pointer;
    padding: 14px;
    border: 2px solid #ecf1f6;
    border-radius: 12px;
    transition: all 0.3s;
}

.smart-bom-product-select:hover {
    border-color: #0073aa;
    background: #f6fbff;
}

.smart-bom-product-select input:checked ~ .smart-bom-product-card {
    border-color: #0073aa;
    background: #eef7ff;
}

.smart-bom-product-card {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 16px;
    align-items: start;
    border: 1px dashed transparent;
    border-radius: 12px;
}

.smart-bom-product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.smart-bom-product-info {
    flex: 1;
}

.smart-bom-product-info h5 {
    margin: 0 0 6px 0;
    color: #333;
    font-size: 18px;
}

.smart-bom-product-sku {
    color: #666;
    font-size: 12px;
    margin: 0 0 8px 0;
}

.smart-bom-product-price {
    color: #0a7abf;
    font-size: 18px;
    font-weight: 700;
    margin: 6px 0;
}

.smart-bom-product-stock {
    color: #28a745;
    font-size: 14px;
    margin: 5px 0;
}

.smart-bom-product-description {
    color: #516070;
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.5;
}

.smart-bom-match-score {
    color: #666;
    font-size: 12px;
    margin: 5px 0;
    font-style: italic;
}

.smart-bom-search-no-match {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 4px;
}

.smart-bom-alternative-matches {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.smart-bom-alternative-matches strong {
    display: block;
    margin-bottom: 10px;
    color: #333;
}

.smart-bom-alternative {
    margin-bottom: 10px;
}

.smart-bom-product-card-sm {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 10px;
    align-items: center;
}

.smart-bom-product-image-sm {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.smart-bom-product-info-sm {
    flex: 1;
}

.smart-bom-product-info-sm h6 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 14px;
}

.smart-bom-product-info-sm p {
    margin: 0;
    color: #666;
    font-size: 12px;
}

.smart-bom-search-actions-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Reusable badges */
.smart-bom-badges { display:flex; gap:8px; flex-wrap: wrap; margin:8px 0; }
.smart-bom-badge { display:inline-block; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:600; }
.smart-bom-badge--moq { background:#e6f4ff; color:#045fa3; border:1px solid #cfe9ff; }
.smart-bom-badge--stock { background:#eaf8f0; color:#1e7e34; border:1px solid #cdeed8; }
.smart-bom-badge--sku { background:#f6f7fb; color:#5b6b7f; border:1px solid #e8ecf3; }

/* Responsive Preview Modal */
@media (max-width: 768px) {
    .smart-bom-preview-content { min-width: auto; }
    .smart-bom-modal-actions { flex-direction: column; }
    .smart-bom-modal-actions .smart-bom-btn { width: 100%; }
    .smart-bom-search-results { max-width: 100%; }
    .smart-bom-product-card { grid-template-columns: 1fr; }
    .smart-bom-product-image { width: 80px; height: 80px; }
    .smart-bom-search-actions-top { flex-direction: column; gap: 10px; align-items: flex-start; }
    .smart-bom-search-actions-bottom { flex-direction: column; gap: 10px; }
}

/* List View */
.smart-bom-list-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.smart-bom-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smart-bom-table {
    width: 100%;
    border-collapse: collapse;
}

.smart-bom-table th,
.smart-bom-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.smart-bom-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #333;
}

.smart-bom-table tbody tr:hover {
    background: #f9f9f9;
}

.smart-bom-empty {
    text-align: center;
    padding: 40px !important;
    color: #999;
}

/* Details View */
.smart-bom-details-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.smart-bom-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smart-bom-details-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.smart-bom-selected-info {
    font-size: 16px;
}

.smart-bom-selected-info strong {
    color: #ff6600;
    font-size: 20px;
}

.smart-bom-batch-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.smart-bom-batch-options label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tabs */
.smart-bom-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.smart-bom-tab {
    padding: 15px 25px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.smart-bom-tab:hover {
    color: #0073aa;
}

.smart-bom-tab.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* Details Table */
.smart-bom-details-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.smart-bom-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.smart-bom-details-table th {
    padding: 12px;
    text-align: left;
    background: #f9f9f9;
    font-weight: 600;
    white-space: nowrap;
}

.smart-bom-details-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.smart-bom-details-table tbody tr:hover {
    background: #f9f9f9;
}

.smart-bom-details-table tbody tr.selected {
    background: #e8f4fd;
}

.smart-bom-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.smart-bom-status-active {
    background: #d4edda;
    color: #155724;
}

.smart-bom-status-pending {
    background: #fff3cd;
    color: #856404;
}

.smart-bom-qty-input {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.smart-bom-amount {
    color: #ff6600;
}

.smart-bom-no-match {
    color: #999;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .smart-bom-container {
        padding: 15px;
    }
    
    .smart-bom-input-wrapper {
        flex-direction: column;
        gap: 20px;
    }
    
    .smart-bom-input-wrapper::before {
        display: none;
    }
    
    .smart-bom-card {
        padding: 20px;
    }
    
    .smart-bom-card h3 {
        font-size: 18px;
    }
    
    .smart-bom-header h2 {
        font-size: 24px;
    }
    
    .smart-bom-btn-primary {
        width: 100%;
        margin-top: 10px;
    }
    
    .smart-bom-upload-area {
        padding: 30px 15px;
    }
    
    .smart-bom-details-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .smart-bom-details-actions {
        width: 100%;
    }
    
    .smart-bom-details-actions .smart-bom-btn-primary {
        width: 100%;
    }
    
    .smart-bom-batch-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .smart-bom-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .smart-bom-tab {
        padding: 10px 15px;
        font-size: 14px;
        white-space: nowrap;
    }
    
    .smart-bom-table {
        display: block;
        overflow-x: auto;
    }
    
    .smart-bom-details-table-wrapper {
        overflow-x: auto;
    }
    
    .smart-bom-details-table {
        min-width: 1200px;
    }
}

#smart_bom_bulk_add_to_cart{padding:6px 10px!important;font-size:13px!important;border-radius:6px!important;line-height:1.2;}

.smart-bom-search-actions-top label{margin-right:14px;}

/* Smaller, responsive modal */
.smart-bom-modal-content{max-width:860px;width:92%;max-height:88vh;}
.smart-bom-modal-body{max-height:calc(88vh - 64px);overflow:auto;}

/* Ensure search list is responsive */
.smart-bom-search-results-list{max-height:60vh;overflow:auto;}

