/* Reset and Base Styles */
.bulk-search-container * {
    box-sizing: border-box !important;
}

.bulk-search-container {
    max-width: 1000px !important;
    margin: 20px auto !important;
    padding: 0 15px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Main Form Container */
.bulk-search-form {
    background: #ffffff !important;
    border-radius: 20px !important;
    padding: 30px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e1e5e9 !important;
}

/* Search Rows Container */
#search-rows {
    margin-bottom: 25px !important;
}

/* Individual Search Row */
.search-row {
    background: #f8f9fa !important;
    border: 2px solid #e9ecef !important;
    border-radius: 15px !important;
    padding: 20px !important;
    margin-bottom: 15px !important;
    display: grid !important;
    grid-template-columns: 1fr 100px 50px !important;
    gap: 15px !important;
    align-items: center !important;
    transition: all 0.3s ease !important;
    position: relative !important;
}

.search-row:hover {
    border-color: #007cba !important;
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.1) !important;
    transform: translateY(-2px) !important;
}

/* Search Input Wrapper */
.search-input-wrapper {
    position: relative !important;
    width: 100% !important;
}

/* Product Search Input */
.product-search {
    width: 100% !important;
    padding: 15px 45px 15px 15px !important;
    border: 2px solid #dee2e6 !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    background: #ffffff !important;
    transition: all 0.3s ease !important;
    outline: none !important;
}

.product-search:focus {
    border-color: #007cba !important;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1) !important;
}

.product-search.searching {
    border-color: #ffc107 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffc107' stroke-width='2'%3E%3Cpath d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 20px !important;
}

/* Search Status */
.search-status {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 20px !important;
    pointer-events: none !important;
}

.search-status .found {
    color: #28a745 !important;
    font-weight: bold !important;
}

/* Quantity Input */
.quantity {
    width: 100% !important;
    padding: 15px 10px !important;
    border: 2px solid #dee2e6 !important;
    border-radius: 10px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    background: #ffffff !important;
    outline: none !important;
    transition: all 0.3s ease !important;
}

.quantity:focus {
    border-color: #007cba !important;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1) !important;
}

/* Remove Button */
.remove-row {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    border-radius: 50% !important;
    background: #dc3545 !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.remove-row:hover {
    background: #c82333 !important;
    transform: scale(1.1) !important;
}

/* Product Info */
.product-info {
    grid-column: 1 / -1 !important;
    margin-top: 15px !important;
    padding: 15px !important;
    background: #e8f4f8 !important;
    border-radius: 10px !important;
    border-left: 4px solid #007cba !important;
    display: none !important;
}

.product-info.show {
    display: block !important;
    animation: slideDown 0.3s ease !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-details {
    margin: 0 !important;
}

.product-details p {
    margin: 8px 0 !important;
    font-size: 14px !important;
    color: #495057 !important;
}

.product-details strong {
    color: #212529 !important;
}

/* Stock Status */
.in-stock {
    color: #28a745 !important;
    font-weight: 600 !important;
}

.out-of-stock {
    color: #dc3545 !important;
    font-weight: 600 !important;
}

/* Control Buttons */
.search-controls {
    display: flex !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
    flex-wrap: wrap !important;
}

.cart-actions {
    display: flex !important;
    gap: 10px !important;
    padding-top: 20px !important;
    border-top: 2px solid #e9ecef !important;
}

/* Button Styles */
.button {
    padding: 12px 24px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 120px !important;
}

#add-row {
    background: #28a745 !important;
    color: white !important;
}

#add-row:hover {
    background: #218838 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
}

#reset-search {
    background: #6c757d !important;
    color: white !important;
}

#reset-search:hover {
    background: #5a6268 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3) !important;
}

#add-to-cart {
    background: #007cba !important;
    color: white !important;
    font-size: 18px !important;
    padding: 15px 30px !important;
    min-width: 200px !important;
}

#add-to-cart:hover {
    background: #0056b3 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.3) !important;
}

#add-to-cart:disabled {
    background: #6c757d !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Autocomplete Dropdown */
.ui-autocomplete {
    background: white !important;
    border: 2px solid #007cba !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
    padding: 5px 0 !important;
}

.ui-autocomplete .ui-menu-item {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.ui-autocomplete .ui-menu-item .ui-menu-item-wrapper {
    padding: 12px 16px !important;
    border-bottom: 1px solid #f1f3f4 !important;
    cursor: pointer !important;
}

.ui-autocomplete .ui-menu-item:last-child .ui-menu-item-wrapper {
    border-bottom: none !important;
}

.ui-autocomplete .ui-menu-item.ui-state-active .ui-menu-item-wrapper,
.ui-autocomplete .ui-menu-item.ui-state-focus .ui-menu-item-wrapper {
    background: #007cba !important;
    color: white !important;
}

.autocomplete-item {
    display: block !important;
}

.item-name {
    font-weight: 600 !important;
    font-size: 15px !important;
    margin-bottom: 4px !important;
}

.item-details {
    font-size: 13px !important;
    opacity: 0.9 !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 15px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bulk-search-form {
        padding: 20px !important;
        border-radius: 15px !important;
    }
    
    .search-row {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        padding: 15px !important;
    }
    
    .quantity {
        max-width: 100px !important;
        justify-self: start !important;
    }
    
    .remove-row {
        justify-self: end !important;
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
    }
    
    .search-controls,
    .cart-actions {
        flex-direction: column !important;
    }
    
    .button {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .bulk-search-container {
        padding: 0 10px !important;
    }
    
    .bulk-search-form {
        padding: 15px !important;
    }
    
    .search-row {
        padding: 15px !important;
        margin-bottom: 10px !important;
    }
    
    .product-search,
    .quantity {
        padding: 12px !important;
        font-size: 14px !important;
    }
    
    .remove-row {
        width: 35px !important;
        height: 35px !important;
        font-size: 16px !important;
    }
}

/* Loading and Success States */
.search-row.loading {
    opacity: 0.7 !important;
}

.search-row.success {
    border-color: #28a745 !important;
    background: #f8fff9 !important;
}

.search-row.error {
    border-color: #dc3545 !important;
    background: #fff5f5 !important;
}

/* ===== EXCEL PASTE SECTION STYLES ===== */

/* Excel Paste Section */
.excel-paste-section {
    background: #f8f9fa !important;
    border: 2px solid #e9ecef !important;
    border-radius: 15px !important;
    padding: 25px !important;
    margin-bottom: 30px !important;
}

.excel-paste-section h3 {
    margin: 0 0 15px 0 !important;
    font-size: 20px !important;
    color: #212529 !important;
}

.excel-paste-section p {
    margin: 5px 0 !important;
    font-size: 14px !important;
    color: #6c757d !important;
}

.excel-paste-section p strong {
    color: #495057 !important;
}

/* Excel Textarea */
#excel-data {
    width: 100% !important;
    padding: 15px !important;
    border: 2px solid #ced4da !important;
    border-radius: 10px !important;
    font-family: 'Courier New', monospace !important;
    font-size: 14px !important;
    background: #ffffff !important;
    resize: vertical !important;
    margin-top: 15px !important;
    min-height: 120px !important;
    transition: all 0.3s ease !important;
}

#excel-data:focus {
    border-color: #007cba !important;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1) !important;
    outline: none !important;
}

/* Excel Controls */
.excel-controls {
    display: flex !important;
    gap: 10px !important;
    margin-top: 15px !important;
    flex-wrap: wrap !important;
}

/* Button Styles */
.button-primary {
    background: #007cba !important;
    color: white !important;
}

.button-primary:hover {
    background: #0056b3 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3) !important;
}

.button-success {
    background: #28a745 !important;
    color: white !important;
    padding: 15px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin-top: 15px !important;
}

.button-success:hover {
    background: #218838 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3) !important;
}

/* Parsing Results */
#parsing-results {
    margin-top: 20px !important;
}

.parsed-results-container {
    background: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 10px !important;
    padding: 20px !important;
    margin-top: 15px !important;
}

/* Parse Summary Header */
.parse-summary-header {
    background: #e8f4f8 !important;
    border: 1px solid #007cba !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
    font-size: 16px !important;
    color: #004085 !important;
}

/* Parse Errors */
.parse-errors {
    background: #fff3cd !important;
    border: 1px solid #ffc107 !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
}

.parse-errors ul {
    margin: 10px 0 0 0 !important;
    padding-left: 20px !important;
}

.parse-errors li {
    color: #856404 !important;
    margin: 5px 0 !important;
    line-height: 1.6 !important;
}

/* Parsed Table */
.parsed-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 15px !important;
    background: #ffffff !important;
}

.parsed-table thead {
    background: #007cba !important;
    color: white !important;
}

.parsed-table th {
    padding: 12px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

.parsed-table td {
    padding: 12px !important;
    border-bottom: 1px solid #dee2e6 !important;
    font-size: 14px !important;
}

/* Match Status Row Colors */
.parsed-table tr.match-found {
    background-color: #d1edff !important;
}

.parsed-table tr.match-multiple {
    background-color: #fff3cd !important;
}

.parsed-table tr.match-error {
    background-color: #ffebee !important;
}

.parsed-table tr.warning-row {
    background-color: #fff9e6 !important;
    border-left: 4px solid #ff9800 !important;
}

.parsed-table tr:hover {
    opacity: 0.9 !important;
}

/* Matched Product Display */
.matched-product {
    padding: 5px 0 !important;
}

.matched-product strong {
    color: #212529 !important;
}

.matched-product small {
    color: #6c757d !important;
}

.no-match {
    color: #dc3545 !important;
    font-style: italic !important;
}

/* Product Select Dropdown */
.product-select {
    width: 100% !important;
    padding: 8px !important;
    border: 2px solid #ffc107 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    background: #ffffff !important;
    cursor: pointer !important;
}

.product-select:focus {
    border-color: #007cba !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1) !important;
}

/* Quantity Input in Parsed Table */
.qty-input {
    width: 80px !important;
    padding: 8px !important;
    border: 2px solid #dee2e6 !important;
    border-radius: 6px !important;
    text-align: center !important;
    font-weight: 600 !important;
}

.qty-input:focus {
    border-color: #007cba !important;
    outline: none !important;
}

/* Totals Display */
.parsed-totals {
    background: #e8f4f8 !important;
    border: 1px solid #007cba !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin-top: 15px !important;
}

.totals-display {
    font-size: 16px !important;
    color: #212529 !important;
}

/* Message Styles */
.loading-message {
    background: #e7f3ff !important;
    border: 1px solid #007cba !important;
    color: #004085 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    text-align: center !important;
    font-size: 16px !important;
}

.error-message {
    background: #ffebee !important;
    border: 1px solid #dc3545 !important;
    color: #721c24 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    white-space: pre-line !important;
}

.success-message {
    background: #d4edda !important;
    border: 1px solid #28a745 !important;
    color: #155724 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    white-space: pre-line !important;
}

/* Section Divider */
.section-divider {
    text-align: center !important;
    margin: 30px 0 !important;
    position: relative !important;
}

.section-divider::before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    width: 100% !important;
    height: 1px !important;
    background: #dee2e6 !important;
}

.section-divider span {
    position: relative !important;
    background: #ffffff !important;
    padding: 0 20px !important;
    color: #6c757d !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

/* Manual Search Section */
.manual-search-section h3 {
    margin: 0 0 20px 0 !important;
    font-size: 20px !important;
    color: #212529 !important;
}

/* Stock Status Colors */
.in-stock {
    color: #28a745 !important;
    font-weight: 600 !important;
}

.out-of-stock {
    color: #dc3545 !important;
    font-weight: 600 !important;
}

.low-stock {
    color: #ff9800 !important;
    font-weight: 600 !important;
}

.insufficient-stock {
    color: #d32f2f !important;
    font-weight: 700 !important;
}

.not-purchasable {
    color: #6c757d !important;
    font-weight: 600 !important;
    font-style: italic !important;
}

/* Warnings and Match Score */
.warnings-text {
    color: #ff6f00 !important;
    font-size: 11px !important;
    font-style: italic !important;
    display: block !important;
    margin-top: 4px !important;
}

.match-score {
    color: #6c757d !important;
    font-size: 11px !important;
    display: block !important;
    margin-top: 4px !important;
}

/* Enhanced Totals Display */
.totals-display strong {
    font-size: 16px !important;
    color: #212529 !important;
}

.totals-display {
    line-height: 1.8 !important;
}

/* Responsive Design for Excel Paste */
@media (max-width: 768px) {
    .excel-paste-section {
        padding: 15px !important;
    }

    .parsed-table {
        font-size: 12px !important;
    }

    .parsed-table th,
    .parsed-table td {
        padding: 8px 6px !important;
    }

    .excel-controls {
        flex-direction: column !important;
    }

    .excel-controls .button {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .excel-paste-section h3,
    .manual-search-section h3 {
        font-size: 18px !important;
    }

    #excel-data {
        font-size: 12px !important;
        padding: 10px !important;
    }

    .parsed-table {
        font-size: 11px !important;
        display: block !important;
        overflow-x: auto !important;
    }
}