/* General Styles */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: #f9f9fc;
}

/* Table Container */
.table-container {
    margin: 40px auto;
    max-width: 1200px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Table Header */
.table-header {
    background: #000080;
    color: white;
    text-align: center;
    padding: 15px;
}

.table-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.table-header i {
    margin-right: 10px;
    vertical-align: middle;
}

/* Table */
.table {
    width: 100%;
    border-spacing: 0;
}

/* Table Row */
.table-row {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    margin: 0;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
    position: relative;
    transition: background 0.2s;
}

.table-row:last-child {
    border-bottom: none;
}

/* Product Column */
.product {
    display: flex;
    align-items: center;
    flex: 5;
    min-width: 180px;
}

.product-icon,
.bm-icon {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 50%;
    background-color: #000080;
    border: none;
    color: white;
    padding: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-icon i,
.bm-icon i {
    color: white;
    font-size: 18px;
}

.product-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    word-break: break-word;
}

/* Product Info Styling */
.product-info {
    display: flex;
    flex-direction: column;
    min-width: 90px;
}

.region {
    font-size: 12px;
    color: #777;
    margin-top: 3px;
}

/* Stock Column */
.stock {
    flex: 1.5;
    text-align: center;
    background: transparent;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    min-width: 70px;
}

/* Price Column */
.price {
    flex: 2;
    text-align: center;
    background: transparent;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: bold;
    color: #000080;
    min-width: 85px;
}

/* Action Column */
.action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 2;
    min-width: 120px;
    gap: 10px;
}

.buy-btn {
    background: #000080;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.buy-btn:hover {
    background: #000066;
}

.buy-btn.out-of-stock {
    background-color: #9e9e9e;
    cursor: not-allowed;
}

.circular-dropdown {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.circular-dropdown:hover {
    background-color: #f0f0f0;
}

.circular-dropdown i {
    transition: transform 0.3s ease;
}

.circular-dropdown.active i {
    transform: rotate(180deg);
}

.dropdown-icon {
    display: none;
}

/* Product Description */
.product-description {
    display: none;
    width: 100%;
    padding: 20px;
    background: #f9f9fc;
    border-radius: 8px;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    text-align: justify;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-description::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 5%;
    width: 90%;
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

.description-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    color: #000080;
}

.product-description.active {
    display: block;
}

.product-description p {
    margin: 0;
    padding: 0;
    text-align: justify;
}

/* Popular Badge - Diagonal at Top Left with black background */
.card.popular {
    position: relative;
    overflow: hidden;
    border: 2px solid #000080;
}

.popular-badge {
    position: absolute;
    top: 20px;
    left: -60px;
    width: 200px;
    background-color: #000000;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 0;
    text-align: center;
    transform: rotate(-45deg);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card.popular::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    z-index: 5;
    pointer-events: none;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .table-container {
        max-width: 98vw;
    }

    .table-row {
        padding: 12px 6px;
    }
}

@media (max-width: 900px) {
    .table-row {
        flex-wrap: wrap;
        padding: 10px 3px;
    }

    .product {
        min-width: 120px;
    }

    .product-info {
        max-width: 130px;
    }

    .stock,
    .price,
    .action {
        min-width: 60px;
        font-size: 13px;
    }

    .popular-badge {
        font-size: 12px;
        padding: 4px 0;
        top: 12px;
        left: -45px;
        width: 140px;
    }
}

/* Key part for center alignment on mobile/tablet */
@media (max-width: 768px) {
    .table-container {
        max-width: 99vw;
        margin: 24px 0;
        border-radius: 8px;
    }

    .table-header {
        padding: 10px;
    }

    .table-header h2 {
        font-size: 17px;
    }

    .table-row {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 16px 4vw;
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
        margin: 0 3vw 5px;
        border: 1px solid #f0f0f2;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        overflow: hidden;
    }

    .table-row:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    }

    .table-row:last-child {
        margin-bottom: 0;
    }

    .table-row .table-cell {
        width: 100%;
        height: auto;
        gap: 8px;
        padding: 5px 0;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        opacity: 0;
        animation: fadeIn 0.5s ease forwards;
    }

    .table-row .table-cell .product-icon {
        width: 50px;
        height: 36px;
        font-size: 16px;
        margin-right: 10px;
        border-radius: 12px;
        margin-right: 10px;
    }
    .table-row .table-cell .product-text
    {
        text-align: justify;
    }
    .table-row .stock{
        background-color: #f2f5fd;
        width: 100%;
        font-weight: 400;
        padding: 10px 0;
    }
    .table-row .price{
        background-color: #f2f5fd;
        width: 100%;
        font-weight: 400;
        padding: 10px 0;
        margin-top: 0;
    }
    .table-row .action {
        width: 100%;
        position: relative;
    }
    .table-row .action .buy-btn {
        width: 100%;
        padding: 10px 0;
        font-size: 14px;
    }
    .table-row .action .circular-dropdown
    {
        position: absolute;
        right: 10px;
        background-color: #fff;
        border: none;
        color: #000080;
    }
    /* Fade-in animation for table-cell content */
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .product,
    .stock,
    .price,
    .action {
        width: 100%;
        min-width: unset;
        justify-content: center !important;
        text-align: center;
        margin-bottom: 7px;
        display: flex;
    }

    .stock,
    .price {
        justify-content: center;
        align-items: center;
        text-align: center;
        margin-bottom: 7px;
        width: 100%;
    }

    .action {
        justify-content: center !important;
        align-items: center !important;
        gap: 10px;
        display: flex;
        width: 100%;
        margin-bottom: 0;
    }

    .buy-btn,
    .buy-btn.out-of-stock {
        margin: 0 !important;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 120px;
        padding: 8px 0;
        font-size: 13px;
    }

    .circular-dropdown {
        margin-left: 0;
    }

    .product-description {
        padding: 14px 2vw;
        font-size: 13px;
    }

    .product-info {
        max-width: none;
    }

    .popular-badge {
        font-size: 11px;
        width: 110px;
        top: 7px;
        left: -35px;
    }
}

@media (max-width: 500px) {
    .table-container {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    }

    .table-header h2 {
        font-size: 15px;
    }

    .table-row {
        padding: 9px 2vw;
    }

    .buy-btn,
    .buy-btn.out-of-stock {
        width: 100px;
        padding: 7px 0;
        font-size: 12px;
    }

    .circular-dropdown {
        width: 20px;
        height: 20px;
        font-size: 13px;
    }

    .product-icon,
    .bm-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
        margin-right: 8px;
    }

    .product-text {
        font-size: 12px;
    }

    .region,
    .price,
    .stock {
        font-size: 12px;
    }

    .description-title {
        font-size: 14px;
    }

    .product-description {
        font-size: 12px;
        padding: 10px 2vw;
    }

    .popular-badge {
        font-size: 10px;
        width: 90px;
        top: 3px;
        left: -24px;
    }
}

@media (max-width: 380px) {
    .table-header h2 {
        font-size: 13px;
    }

    .buy-btn,
    .buy-btn.out-of-stock {
        width: 80px;
        font-size: 10px;
        padding: 5px 0;
    }

    .product-icon,
    .bm-icon {
        width: 22px;
        height: 22px;
        font-size: 10px;
        margin-right: 5px;
    }

    .product-description {
        font-size: 10px;
        padding: 8px 1vw;
    }

    .popular-badge {
        font-size: 8px;
        width: 60px;
        top: 0;
        left: -16px;
    }
}