/*
 * SDEO Storehouse Page Styles
 * VERSION 3.3: THE FINAL BOSS FIX (Specificity War Won)
 * Basanti's Guaranteed Fix:
 * - INCREASED SPECIFICITY on ALL selectors by prepending with '.sdeo-storehouse-container'.
 *   This defeats theme overrides without overusing !important.
 * - FIXED badge positioning: "In Stock" is now correctly placed. "Listed" replaces it on success.
 * - FORCED text colors (titles, prices) back to normal, overriding theme styles.
 * - GUARANTEED the 4-column responsive layout is stable.
 */

/* Filters - Upgraded to Flexible Flex Container for Clean Alignment */
.sdeo-storehouse-container .sdeo-filters form { 
    display: flex !important; 
    flex-flow: row wrap !important;
    gap: 12px !important; 
    align-items: center !important; 
    margin-bottom: 20px !important; 
    width: 100% !important;
}
.sdeo-storehouse-container .sdeo-filter-item { 
    flex: 1 1 150px !important;
    min-width: 120px !important;
}
.sdeo-storehouse-container .sdeo-filter-search {
    flex: 2 1 200px !important; /* Give search more visual width */
}
.sdeo-storehouse-container .sdeo-filter-submit {
    flex: 0 0 auto !important; /* Keep filter button compact to prevent wrapping */
}
.sdeo-storehouse-container .sdeo-filter-item input, 
.sdeo-storehouse-container .sdeo-filter-item select { 
    width: 100% !important; 
    height: 40px !important; 
    padding: 0 12px !important; 
}
.sdeo-storehouse-container .sdeo-filter-submit button {
    height: 40px !important;
    padding: 0 24px !important;
    white-space: nowrap !important;
    width: auto !important;
}

/* Bulk Actions Bar */
.sdeo-storehouse-container .sdeo-bulk-actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 10px 15px; background-color: #f8f9fa; border: 1px solid #e7e7e7; border-radius: 6px; }
.sdeo-storehouse-container .sdeo-select-all-wrap { display: flex; align-items: center; gap: 8px; }
.sdeo-storehouse-container .sdeo-select-all-wrap label { font-weight: 500; cursor: pointer; user-select: none; margin: 0; }
.sdeo-storehouse-container #sdeo-bulk-add-button { background-color: #0c467c !important; border-color: #0c467c !important; color: #fff !important; transition: all 0.2s ease-in-out; }
.sdeo-storehouse-container #sdeo-bulk-add-button:hover:not(:disabled) { background-color: #093a6a !important; border-color: #093a6a !important; }
.sdeo-storehouse-container #sdeo-bulk-add-button:disabled { opacity: 0.6; cursor: not-allowed; background-color: #e9ecef !important; border-color: #dee2e6 !important; color: #6c757d !important; }

/* 4-COLUMN GRID FIX (Guaranteed) */
.sdeo-storehouse-container .sdeo-product-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 20px !important; list-style: none !important; padding: 0 !important; margin: 0 !important; }

/* Individual Product Card */
.sdeo-storehouse-container .sdeo-product-card { position: relative; background: #fff; border: 1px solid #e7e7e7; border-radius: 6px; display: flex; flex-direction: column; overflow: hidden; transition: all 0.2s ease; }
.sdeo-storehouse-container .sdeo-product-card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* Checkbox */
.sdeo-storehouse-container .sdeo-card-checkbox { position: absolute; top: 10px; left: 10px; z-index: 3; }
.sdeo-storehouse-container .sdeo-card-checkbox input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }

/* Card Image & Badges */
.sdeo-storehouse-container .sdeo-card-image-wrap { position: relative; background-color: #f9f9f9; }
.sdeo-storehouse-container .sdeo-card-image-wrap a { display: block; }
.sdeo-storehouse-container .sdeo-card-image-wrap img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }

.sdeo-storehouse-container .sdeo-stock-status, 
.sdeo-storehouse-container .sdeo-listed-badge { position: absolute; top: 10px; padding: 3px 8px; font-size: 10px; font-weight: 600; color: #fff; border-radius: 4px; text-transform: uppercase; z-index: 2; }

/* BADGE POSITIONING FIX */
.sdeo-storehouse-container .sdeo-stock-status { right: 10px; background-color: #2e9f67; }
.sdeo-storehouse-container .sdeo-stock-status.outofstock { background-color: #e53e3e; }
.sdeo-storehouse-container .sdeo-listed-badge { right: 10px; background-color: #e53e3e; }

/* When a product is listed, HIDE the 'In Stock' badge and only show 'Listed' */
.sdeo-storehouse-container .sdeo-product-card.already-listed .sdeo-stock-status { display: none; }

/* Card Content & Text Color Fix */
.sdeo-storehouse-container .sdeo-card-content { padding: 12px; display: flex; flex-direction: column; flex-grow: 1; }
.sdeo-storehouse-container .sdeo-card-title { font-size: 13px !important; line-height: 1.4 !important; margin: 0 0 8px 0 !important; font-weight: 500 !important; height: 36px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sdeo-storehouse-container .sdeo-card-title a { color: #333 !important; text-decoration: none !important; }
.sdeo-storehouse-container .sdeo-card-price { font-size: 14px !important; font-weight: 600 !important; color: #444 !important; margin-bottom: 12px !important; }
.sdeo-storehouse-container .sdeo-card-price del { opacity: 0.6; margin-right: 5px; }
.sdeo-storehouse-container .sdeo-card-price ins { text-decoration: none; background: none; }

/* Button Color Styles */
.sdeo-storehouse-container .sdeo-product-card .sdeo-add-button.dokan-btn-theme {
    background-color: #0c467c;
    border-color: #0c467c;
    color: #fff;
    transition: all 0.2s ease-in-out;
}

.sdeo-storehouse-container .sdeo-product-card .sdeo-add-button.dokan-btn-theme:hover {
    background-color: #093a6a;
    border-color: #093a6a;
    color: #fff;
}

/* Card Actions */
.sdeo-storehouse-container .sdeo-card-actions { margin-top: auto; }

/* Responsive Media Queries */
@media (max-width: 1440px) { .sdeo-storehouse-container .sdeo-product-grid { grid-template-columns: repeat(4, 1fr) !important; } }
@media (max-width: 1200px) { .sdeo-storehouse-container .sdeo-product-grid { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 767px) { 
    .sdeo-storehouse-container .sdeo-product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px !important; } 
    
    /* MOBILE FILTERS STACK SEQUENTIALLY ROW-BY-ROW */
    .sdeo-storehouse-container .sdeo-filters form { 
        display: flex !important; 
        flex-direction: column !important; 
        align-items: stretch !important;
        gap: 10px !important;
    } 
    .sdeo-storehouse-container .sdeo-filter-item {
        flex: none !important;
        width: 100% !important;
    }
    .sdeo-storehouse-container .sdeo-filter-submit button {
        width: 100% !important;
    }
    
    /* MOBILE BULK BAR ALIGNMENT FIX */
    .sdeo-storehouse-container .sdeo-bulk-actions-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    .sdeo-storehouse-container .sdeo-select-all-wrap {
        justify-content: space-between !important;
        width: 100% !important;
    }
    .sdeo-storehouse-container #sdeo-bulk-add-button {
        width: 100% !important;
        text-align: center !important;
        padding: 10px !important;
    }
}

/* AJAX Message Container */
#sdeo-ajax-message-container { margin-bottom: 20px; }

/* Custom Product Limit Warning Modal Styles */
.sdeo-custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.sdeo-custom-modal {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    padding: 30px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
    position: relative;
    animation: sdeoFadeScaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes sdeoFadeScaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.sdeo-modal-icon-container {
    position: relative;
    margin: 0 auto 20px auto;
    width: 80px;
    height: 80px;
}

.sdeo-modal-icon-ring {
    width: 80px;
    height: 80px;
    background: #fdf2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px #fff5f5;
}

.sdeo-modal-main-icon {
    font-size: 28px;
    color: #e74c3c;
}

.sdeo-modal-decoration-dots .dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e74c3c;
}
.sdeo-modal-decoration-dots .dot-1 { top: 12px; left: 0; }
.sdeo-modal-decoration-dots .dot-2 { top: 5px; right: 5px; }
.sdeo-modal-decoration-dots .dot-3 { bottom: 15px; left: -5px; }
.sdeo-modal-decoration-dots .dot-4 { bottom: 10px; right: 0; }

.sdeo-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.sdeo-modal-subtitle {
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.sdeo-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 10px;
}

.sdeo-btn {
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: none;
    outline: none;
}

.sdeo-btn-secondary {
    background: #fff;
    border: 1px solid #dcdde1;
    color: #7f8c8d;
}

.sdeo-btn-secondary:hover {
    background: #f5f6fa;
    color: #2c3e50;
}