/* ==========================================================================
   Template Product Manager — Frontend Styles
   ========================================================================== */

/* ---- Wrapper ------------------------------------------------------------- */
.tpm-wrapper {
    box-sizing: border-box;
}

/* ---- Filter bar ---------------------------------------------------------- */
.tpm-filters {
    background: #fff;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.tpm-filter-form {
    margin: 0;
}

.tpm-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tpm-filter-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.tpm-filter-select {
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: auto !important;
}

.tpm-filter-btn,
.tpm-clear-btn {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.tpm-clear-btn {
    background: var(--wd-primary-color, #d4af37);
    color: #000 !important;
    border: none;
}

/* ---- Table container (horizontal scroll) --------------------------------- */
.tpm-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #ddd;
    border-radius: 4px;
    scroll-behavior: smooth;
}

.tpm-table-container::-webkit-scrollbar        { height: 8px; }
.tpm-table-container::-webkit-scrollbar-track  { background: #f1f1f1; border-radius: 4px; }
.tpm-table-container::-webkit-scrollbar-thumb  { background: #c1c1c1; border-radius: 4px; }
.tpm-table-container::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* ---- Products table ------------------------------------------------------ */
.tpm-products-table {
    min-width: 820px;
    margin: 0;
    border: none;
    border-collapse: collapse;
}

.tpm-products-table th {
    font-size: 14px !important;
    white-space: nowrap;
}

/* Column widths */
.tpm-col-image      { width: 80px;  min-width: 80px; }
.tpm-col-name       { width: 220px; min-width: 200px; }
.tpm-col-sku        { width: 110px; min-width: 100px; font-size: 12px; }
.tpm-col-price      { width: 110px; min-width: 100px; font-size: 12px; }
.tpm-col-stock      { width: 130px; min-width: 120px; }
.tpm-col-visibility { width: 140px; min-width: 130px; }
.tpm-col-actions    { width: 90px;  min-width: 80px; }

/* ---- Product name cell --------------------------------------------------- */
.tpm-product-title {
    font-weight: bold;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.tpm-product-id {
    font-size: 12px;
    color: #666;
    line-height: 1.2;
}

/* ---- No-image placeholder ------------------------------------------------ */
.tpm-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    font-size: 10px;
    text-align: center;
    color: #666;
    border-radius: 2px;
}

/* ---- Stock status badges ------------------------------------------------- */
.tpm-stock--instock     { color: #7ad03a; font-weight: 600; }
.tpm-stock--outofstock  { color: #a00;    font-weight: 600; }
.tpm-stock--onbackorder { color: #ffba00; font-weight: 600; }

/* ---- Visibility select & status ----------------------------------------- */
.tpm-visibility-select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.tpm-visibility-status {
    font-size: 11px;
    margin-top: 3px;
    min-height: 14px;
}

/* ---- View button --------------------------------------------------------- */
.tpm-view-btn {
    background: var(--wd-primary-color, #d4af37) !important;
    color: #000 !important;
    border: none !important;
    padding: 6px 12px;
    text-decoration: none;
    display: inline-block;
    border-radius: 3px;
    font-weight: 500;
    font-size: 13px;
}

/* ---- Summary line -------------------------------------------------------- */
.tpm-summary {
    margin-top: 10px;
    font-size: 13px;
    color: #555;
}

/* ==========================================================================
   Desktop (≥ 768 px)
   ========================================================================== */
@media (min-width: 768px) {
    .tpm-filter-row {
        flex-wrap: nowrap;
        gap: 15px;
    }

    .tpm-filter-input {
        flex: 2;
        min-width: 250px;
        max-width: 400px;
        padding: 10px 12px;
    }

    .tpm-filter-select {
        flex: 0 0 auto;
        min-width: 140px;
        padding: 10px 12px;
    }

    .tpm-filter-btn,
    .tpm-clear-btn {
        flex: 0 0 auto;
        padding: 10px 20px;
        min-width: 80px;
    }
}

/* ==========================================================================
   Mobile (< 768 px)
   ========================================================================== */
@media (max-width: 767px) {
    .tpm-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tpm-filter-input,
    .tpm-filter-select,
    .tpm-filter-btn,
    .tpm-clear-btn {
        width: 100%;
        min-width: unset;
    }

    .tpm-filter-input { padding: 10px; }

    /* Wider table floor for small viewports */
    .tpm-products-table { min-width: 900px; font-size: 14px; }

    .tpm-products-table th,
    .tpm-products-table td {
        text-align: center;
        vertical-align: middle;
    }

    .tpm-col-name    { text-align: left; }
    .tpm-col-image   { text-align: center; }

    .tpm-col-image img,
    .tpm-no-image { margin: 0 auto; display: block; }

    .tpm-visibility-select { margin: 0 auto; display: block; }

    .tpm-products-table th { background: #f9f9f9; font-size: 12px !important; }

    .tpm-col-image    { width: 70px; min-width: 70px; }
    .tpm-col-name     { width: 180px; min-width: 180px; }

    .tpm-product-title { font-size: 13px; line-height: 1.3; margin-bottom: 2px; }
    .tpm-product-id    { font-size: 9px; }

    .tpm-visibility-select { padding: 6px; font-size: 10px; }

    .tpm-view-btn { padding: 4px 8px; font-size: 10px; }

    .tpm-no-image { width: 40px; height: 40px; font-size: 9px; }

    .tpm-col-stock      { font-size: 10px; }
    .tpm-col-stock small { font-size: 9px; }
}

/* ==========================================================================
   Small mobile (< 480 px)
   ========================================================================== */
@media (max-width: 479px) {
    .tpm-filters { padding: 10px; }
    .tpm-filter-row { gap: 6px; }

    .tpm-products-table { min-width: 950px; font-size: 10px; }

    .tpm-products-table th,
    .tpm-products-table td { padding: 6px 4px; }
}
