/* Modern Product Cards (SaaS-style) */

.table-responsive .product-cards-table,
.table-responsive .product-cards-table thead,
.table-responsive .product-cards-table tbody,
.table-responsive .product-cards-table th,
.table-responsive .product-cards-table td,
.table-responsive .product-cards-table tr {
    display: block;
}

.table-responsive .product-cards-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

.table-responsive .product-cards-table tr {
    position: relative;
    margin-bottom: 0.625rem;
    padding: 0.9rem 0.9rem 0.8rem 2.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    display: grid !important;
    grid-template-columns: 1fr 160px;
    grid-template-rows: auto auto auto auto auto;
    column-gap: 1rem;
    row-gap: 0.4rem;
    align-items: center;
}

.table-responsive .product-cards-table tr.expanded {
    grid-template-columns: 96px 1fr 160px;
}

.table-responsive .product-cards-table tr:hover {
    transform: translateY(-1px);
    border-color: #d1d5db;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
    background: #ffffff !important;
}

.table-responsive .product-cards-table.table-hover tbody tr:hover,
.table-responsive .product-cards-table.table-hover tbody tr:hover > * {
    background: #ffffff !important;
    --bs-table-bg-state: #ffffff;
    --bs-table-bg-type: #ffffff;
}

.table-responsive .product-cards-table.table-striped tbody tr:nth-of-type(odd),
.table-responsive .product-cards-table.table-striped tbody tr:nth-of-type(even) {
    background: #ffffff !important;
}

.table-responsive .product-cards-table td {
    border: 0 !important;
    padding: 0 !important;
    margin: 0;
    background: transparent !important;
    display: none !important;
}

.table-responsive .product-cards-table td:first-child {
    display: block !important;
    position: absolute;
    top: 0.95rem;
    left: 0.95rem;
    z-index: 2;
}

.table-responsive .product-cards-table .product-checkbox {
    width: 1rem;
    height: 1rem;
}

.table-responsive .product-cards-table td[data-label="Image"] {
    display: none !important;
    grid-column: 1;
    grid-row: 1 / 5;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Image"] {
    display: flex !important;
}

.table-responsive .product-cards-table .product-thumb,
.table-responsive .product-cards-table .product-thumb-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 12px;
}

.table-responsive .product-cards-table .product-thumb {
    object-fit: cover;
    border: 1px solid #e5e7eb;
}

.table-responsive .product-cards-table .product-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #d1d5db;
    background: #f8fafc;
}

.table-responsive .product-cards-table td[data-label="Name"] {
    display: block !important;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Name"] {
    grid-column: 2;
}

.table-responsive .product-title {
    display: block;
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.25;
    color: #111827;
}

.table-responsive .product-cards-table td[data-label="Title"] strong,
.table-responsive .product-cards-table td[data-label="Name"] strong {
    font-weight: 500 !important;
}

.table-responsive .product-description {
    color: #6b7280;
    font-size: 0.84rem;
}

.table-responsive .product-cards-table td[data-label="Status"] {
    display: block !important;
    grid-column: 1;
    grid-row: 2;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Status"] {
    grid-column: 2;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.inactive {
    background: #e5e7eb;
    color: #374151;
}

.table-responsive .product-cards-table td[data-label="Price"] {
    display: block !important;
    grid-column: 1;
    grid-row: 3;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Price"] {
    grid-column: 2;
}

.product-price-value {
    color: #0f766e;
    font-size: 1.05rem;
    font-weight: 800;
}

.table-responsive .product-cards-table td[data-label="Total Stock"] {
    display: block !important;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    font-size: 0.86rem;
    color: #6b7280;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Total Stock"] {
    grid-column: 3;
}

.table-responsive .product-cards-table td[data-label="Total Stock"]::before {
    content: "QTY";
    margin-right: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.qty-value {
    font-size: 0.98rem;
    font-weight: 800;
    color: #111827;
}

.qty-zero {
    color: #b91c1c;
}

.table-responsive .product-cards-table td[data-label="SKU"],
.table-responsive .product-cards-table td[data-label="Barcode"],
.table-responsive .product-cards-table td[data-label="Category"] {
    display: inline-flex !important;
    align-items: center;
    grid-row: 4;
    align-self: start;
    padding: 0.2rem 0.5rem !important;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #eef2f7;
    color: #6b7280;
    font-size: 0.75rem;
    margin-right: 0.35rem;
}

.table-responsive .product-cards-table td[data-label="SKU"] { grid-column: 2; justify-self: start; }
.table-responsive .product-cards-table td[data-label="Barcode"] { grid-column: 2; justify-self: center; }
.table-responsive .product-cards-table td[data-label="Category"] { grid-column: 2; justify-self: end; }

.table-responsive .product-cards-table td[data-label="SKU"]::before,
.table-responsive .product-cards-table td[data-label="Barcode"]::before,
.table-responsive .product-cards-table td[data-label="Category"]::before {
    font-weight: 700;
    color: #9ca3af;
    margin-right: 0.25rem;
}

.table-responsive .product-cards-table td[data-label="SKU"]::before { content: "SKU"; }
.table-responsive .product-cards-table td[data-label="Barcode"]::before { content: "Barcode"; }
.table-responsive .product-cards-table td[data-label="Category"]::before { content: "Category"; }

.table-responsive .product-cards-table td[data-label="Omaha"],
.table-responsive .product-cards-table td[data-label="Illinois"] {
    display: inline-flex !important;
    grid-column: 2;
    justify-self: end;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Omaha"],
.table-responsive .product-cards-table tr.expanded td[data-label="Illinois"] {
    grid-column: 3;
}

.location-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.28rem 0.6rem;
}

.location-pill.omaha {
    background: #dbeafe;
    color: #1d4ed8;
}

.location-pill.illinois {
    background: #cffafe;
    color: #155e75;
}

.table-responsive .product-cards-table td[data-label="Omaha"] { grid-row: 2; }
.table-responsive .product-cards-table td[data-label="Illinois"] { grid-row: 3; }

.table-responsive .product-cards-table td[data-label="Actions"] {
    display: block !important;
    grid-column: 1 / -1;
    grid-row: 5;
    justify-self: stretch;
    width: 100%;
    margin-top: 0.35rem;
    padding-top: 0.35rem !important;
    border-top: 1px dashed #eef2f7;
}

.table-responsive .product-cards-table tr.expanded td[data-label="Actions"] {
    grid-column: 1 / -1;
}

.product-actions {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: flex-end;
    gap: 0.25rem;
}

.product-actions .btn-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.product-actions .btn-icon i {
    font-size: 0.78rem;
}

.table-responsive .product-cards-table .card-expand-btn {
    position: absolute !important;
    top: 0.9rem !important;
    right: 0.9rem !important;
    width: 30px !important;
    height: 30px !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.table-responsive .product-cards-table .card-expand-btn i {
    color: #6b7280 !important;
    font-size: 0.85rem !important;
}

.table-responsive .product-cards-table tr.expanded .card-expand-btn i {
    transform: rotate(180deg);
}

.table-responsive .product-cards-table tr:not(.expanded) td.secondary-info {
    display: none !important;
}

@media (max-width: 1100px) {
    .table-responsive .product-cards-table tr {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto auto;
        padding: 0.85rem 0.85rem 0.8rem 2.35rem;
    }

    .table-responsive .product-cards-table tr.expanded {
        grid-template-columns: 84px 1fr;
    }

    .table-responsive .product-cards-table td[data-label="Image"] {
        grid-column: 1;
        grid-row: 1 / 4;
        width: 84px;
        height: 84px;
    }

    .table-responsive .product-cards-table tr.expanded td[data-label="Image"] {
        display: flex !important;
    }

    .table-responsive .product-cards-table .product-thumb,
    .table-responsive .product-cards-table .product-thumb-placeholder {
        width: 84px;
        height: 84px;
    }

    .table-responsive .product-cards-table td[data-label="Name"],
    .table-responsive .product-cards-table td[data-label="Status"],
    .table-responsive .product-cards-table td[data-label="Price"],
    .table-responsive .product-cards-table td[data-label="Total Stock"],
    .table-responsive .product-cards-table td[data-label="Actions"] {
        grid-column: 1;
        justify-self: start;
    }

    .table-responsive .product-cards-table tr.expanded td[data-label="Name"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Status"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Price"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Total Stock"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Actions"] {
        grid-column: 2;
    }

    .table-responsive .product-cards-table td[data-label="Total Stock"] {
        grid-row: 3;
    }

    .table-responsive .product-cards-table td[data-label="Omaha"] { grid-column: 1; grid-row: 4; justify-self: start; }
    .table-responsive .product-cards-table td[data-label="Illinois"] { grid-column: 1; grid-row: 4; justify-self: end; }

    .table-responsive .product-cards-table tr.expanded td[data-label="Omaha"] { grid-column: 2; }
    .table-responsive .product-cards-table tr.expanded td[data-label="Illinois"] { grid-column: 2; }

    .table-responsive .product-cards-table td[data-label="SKU"],
    .table-responsive .product-cards-table td[data-label="Barcode"],
    .table-responsive .product-cards-table td[data-label="Category"] {
        grid-column: 1;
        justify-self: start;
        margin-top: 0.2rem;
    }

    .table-responsive .product-cards-table tr.expanded td[data-label="SKU"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Barcode"],
    .table-responsive .product-cards-table tr.expanded td[data-label="Category"] {
        grid-column: 2;
    }

    .table-responsive .product-cards-table td[data-label="Actions"] {
        grid-row: 6;
        margin-top: 0.4rem;
        justify-self: stretch;
        width: 100%;
        padding-top: 0.35rem !important;
        border-top: 1px dashed #eef2f7;
    }
}

@media (max-width: 640px) {
    .table-responsive .product-cards-table tr {
        grid-template-columns: 1fr;
        padding: 0.75rem 0.75rem 0.7rem 2rem;
    }

    .table-responsive .product-cards-table td[data-label="Status"] {
        display: none !important;
    }

    .table-responsive .product-cards-table td[data-label="Image"] {
        display: none !important;
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: 170px;
    }

    .table-responsive .product-cards-table tr.expanded td[data-label="Image"] {
        display: flex !important;
    }

    .table-responsive .product-cards-table .product-thumb,
    .table-responsive .product-cards-table .product-thumb-placeholder {
        width: 100%;
        height: 170px;
    }

    .table-responsive .product-cards-table td[data-label="Name"] { grid-row: 2; }
    .table-responsive .product-cards-table td[data-label="Status"] { grid-row: 3; }
    .table-responsive .product-cards-table td[data-label="Price"] { grid-row: 4; }
    .table-responsive .product-cards-table td[data-label="Total Stock"] { grid-row: 5; }

    .table-responsive .product-cards-table td[data-label="SKU"],
    .table-responsive .product-cards-table td[data-label="Barcode"],
    .table-responsive .product-cards-table td[data-label="Category"] {
        justify-self: start !important;
    }

    .table-responsive .product-cards-table td[data-label="Omaha"] { grid-row: 6; justify-self: start !important; }
    .table-responsive .product-cards-table td[data-label="Illinois"] { grid-row: 6; justify-self: end !important; }

    .table-responsive .product-cards-table td[data-label="Actions"] {
        grid-row: 7;
        justify-self: stretch !important;
        width: 100%;
        margin-top: 0.35rem;
        padding-top: 0.35rem !important;
        border-top: 1px dashed #eef2f7;
    }

    .product-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .product-actions .btn-icon {
        width: 28px;
        height: 28px;
    }
}
