/* ===================================
   PRODUCT CARD LAYOUT FOR ALL DEVICES
   Clean card design with image on left, content on right
   =================================== */

/* Force table to not be like tables anymore - ALL DEVICES - ONLY PRODUCTS TABLE */
.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;
}

/* Hide table headers (but not display: none;, for accessibility) - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/* Card container - each row becomes a card using CSS Grid - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table tr {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    margin-bottom: 1rem;
    background: white !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    padding: 1.25rem;
    padding-top: 1.5rem;
    display: grid !important;
    grid-template-columns: 100px 1fr 130px;
    grid-template-rows: auto auto auto;
    column-gap: 1rem;
    row-gap: 0.5rem;
    align-items: start;
    transition: all 0.3s ease;
}

/* The expand button needs special handling as it's outside the grid flow */
.table-responsive .product-cards-table tr > .card-expand-btn {
    position: absolute !important;
    display: flex !important;
}

/* Hover effect - subtle lift and shadow, no background color change - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #0d6efd;
    background: white !important;
}

/* Ensure all TDs stay white - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td {
    background: transparent !important;
}

/* Remove Bootstrap table hover effect - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table.table-hover tbody tr:hover {
    background-color: white !important;
}

.table-responsive .product-cards-table.table-hover tbody tr:hover td,
.table-responsive .product-cards-table.table-hover tbody tr:hover th {
    background-color: transparent !important;
}

/* Expand/Collapse button - top right - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table .card-expand-btn {
    position: absolute !important;
    top: 0.75rem !important;
    right: 0.75rem !important;
    background: #0d6efd !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(13, 110, 253, 0.4) !important;
}

.table-responsive .product-cards-table .card-expand-btn:hover {
    background: #0b5ed7 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.5) !important;
}

.table-responsive .product-cards-table .card-expand-btn i {
    font-size: 1.2rem !important;
    color: white !important;
    transition: transform 0.3s ease;
    pointer-events: none;
    display: block !important;
}

.table-responsive .product-cards-table tr.expanded .card-expand-btn i {
    transform: rotate(180deg);
}

/* Hide all TDs by default - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td {
    border: none !important;
    padding: 0 !important;
    margin: 0;
    display: none !important;
    background: transparent !important;
}

/* Image - Spans all rows on the left - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Image"] {
    display: block !important;
    grid-column: 1;
    grid-row: 1 / 4;
    width: 100px;
    height: 100px;
}

.table-responsive .product-cards-table td[data-label="Image"] img {
    width: 100px !important;
    height: 100px !important;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #e9ecef;
}

.table-responsive .product-cards-table td[data-label="Image"] > div {
    width: 100px !important;
    height: 100px !important;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Product Name - Row 1, Column 2 - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Name"] {
    display: block !important;
    grid-column: 2 / 4;
    grid-row: 1;
    padding-right: 50px !important;
}

.table-responsive .product-cards-table td[data-label="Name"] strong {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    display: block;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.table-responsive .product-cards-table td[data-label="Name"] small {
    font-size: 0.9rem;
    color: #6c757d;
    display: block;
    line-height: 1.4;
}

/* Price - Row 2, Column 2 - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Price"] {
    display: block !important;
    grid-column: 2;
    grid-row: 2;
    font-size: 1rem;
    color: #212529;
}

.table-responsive .product-cards-table td[data-label="Price"]:before {
    content: "Price: ";
    font-weight: 600;
    color: #495057;
    margin-right: 0.25rem;
}

/* Stock - Row 2, Column 3 - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Total Stock"] {
    display: block !important;
    grid-column: 3;
    grid-row: 2;
    font-size: 1rem;
    color: #212529;
    min-width: 120px;
    text-align: right;
}

.table-responsive .product-cards-table td[data-label="Total Stock"]:before {
    content: "QTY: ";
    font-weight: 600;
    color: #495057;
    margin-right: 0.25rem;
}

/* Status Badge - Row 3, Column 2 (Left side) - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Status"] {
    display: block !important;
    grid-column: 2;
    grid-row: 3;
    align-self: center;
}

/* Action Buttons - Row 3, Column 3 (Right side, same row as status) - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td[data-label="Actions"] {
    display: block !important;
    grid-column: 3;
    grid-row: 3;
    text-align: right;
    align-self: center;
}

.table-responsive .product-cards-table td[data-label="Actions"] .btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-responsive .product-cards-table td[data-label="Actions"] .btn {
    flex: 0 0 auto;
}

/* Secondary Info - Hidden by default, shown when expanded - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table tr:not(.expanded) td.secondary-info {
    display: none !important;
}

.table-responsive .product-cards-table tr.expanded td.secondary-info {
    display: block !important;
    grid-column: 1 / 4;
    grid-row: auto;
    padding: 0.75rem 1rem !important;
    margin-top: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #0d6efd;
    font-size: 0.95rem;
}

.table-responsive .product-cards-table tr.expanded td.secondary-info:before {
    content: attr(data-label);
    font-weight: 600;
    color: #495057;
    margin-right: 0.5rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Smooth transition for expanding - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td.secondary-info {
    transition: all 0.3s ease;
}

/* Responsive adjustments for tablets - ONLY PRODUCTS TABLE */
@media (max-width: 991px) {
    .table-responsive .product-cards-table tr {
        grid-template-columns: 90px 1fr 120px;
        padding: 1rem;
    }
    
    .table-responsive .product-cards-table td[data-label="Image"],
    .table-responsive .product-cards-table td[data-label="Image"] img,
    .table-responsive .product-cards-table td[data-label="Image"] > div {
        width: 90px !important;
        height: 90px !important;
    }
    
    .table-responsive .product-cards-table td[data-label="Total Stock"] {
        min-width: 100px;
    }
}

/* Responsive adjustments for mobile - ONLY PRODUCTS TABLE */
@media (max-width: 576px) {
    .table-responsive .product-cards-table tr {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto auto auto;
        padding: 1rem;
        column-gap: 0.75rem;
    }
    
    .table-responsive .product-cards-table td[data-label="Image"] {
        grid-row: 1 / 5;
    }
    
    .table-responsive .product-cards-table td[data-label="Image"],
    .table-responsive .product-cards-table td[data-label="Image"] img,
    .table-responsive .product-cards-table td[data-label="Image"] > div {
        width: 80px !important;
        height: 80px !important;
    }
    
    .table-responsive .product-cards-table td[data-label="Name"] strong {
        font-size: 1.1rem;
    }
    
    .table-responsive .product-cards-table td[data-label="Price"] {
        font-size: 0.95rem;
        grid-column: 2;
        grid-row: 2;
    }
    
    .table-responsive .product-cards-table td[data-label="Total Stock"] {
        grid-column: 2;
        grid-row: 3;
        font-size: 0.95rem;
        text-align: left;
        min-width: auto;
    }
    
    .table-responsive .product-cards-table td[data-label="Status"] {
        grid-column: 2;
        grid-row: 4;
    }
    
    .table-responsive .product-cards-table td[data-label="Actions"] {
        grid-column: 2;
        grid-row: 5;
        text-align: left;
    }
    
    .table-responsive .product-cards-table .card-expand-btn {
        width: 36px;
        height: 36px;
    }
    
    .table-responsive .product-cards-table .card-expand-btn i {
        font-size: 1rem;
    }
}

/* Remove table striping - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table.table-striped tbody tr:nth-of-type(odd) {
    background-color: white;
}

/* Badge styling - ONLY PRODUCTS TABLE */
.table-responsive .product-cards-table td .badge {
    display: inline-block;
}
