/* ===========================================================
   MAIN ITEM BOX LAYOUT
   =========================================================== */
.main_itemBox {
    display: flex;
    width: 90%;
    margin: 20px auto;
    border-radius: 15px;
}

/* ===========================================================
   LEFT CATEGORY PANEL
   =========================================================== */
.mainBox_left {
    width: 20%;
    border-right: 1px solid #ddd;
    padding: 15px 0 15px 15px;
}

.mainBox_left_category {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mainBox_left_category li {
    padding: 8px 0;
}

.mainBox_left_category a {
    display: block;
    padding: 6px 12px;
    color: #333;
    text-decoration: none;
    font-size: 0.95em;
    transition: font-weight 0.2s;
}

.mainBox_left_category a:hover,
.mainBox_left_category a.active {
    font-weight: bold;
}

.mainBox_left_category a.active {
    border-right: 2px solid #d8460291;   /* red divider line */
    color: #333;
    background-color: #c9c7c757;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15); /* subtle shadow like a button */
}

/* ===========================================================
   RIGHT PRODUCT PANEL
   =========================================================== */
.mainBox_right {
    width: 80%;
    padding-left: 10px;
}

/* Product grid layout */
.mainBox_right_top {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    justify-items: center;
}

/* Responsive grid breakpoints */
@media (max-width: 1350px) { .mainBox_right_top { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1180px) { .mainBox_right_top { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .mainBox_right_top { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 850px)  { .mainBox_right_top { grid-template-columns: repeat(1, 1fr); } }

/* ===========================================================
   PRODUCT CARD
   =========================================================== */
.item_card {
    width: 250px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px auto;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box; 

    display: flex;
    flex-direction: column;
}

.item_card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===========================================================
   ITEM CARD IMAGE
   =========================================================== */
.item_card_img {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px;
    padding: 6px;
    background: #fafafa;
}

.item_card_img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* ===========================================================
   FIXED HEIGHT TEXT SECTIONS
   =========================================================== */
.item_card_name {
    padding: 5px;
    box-sizing: border-box;
    line-height: 1.4;
    height: 52px; /* ✅ enough for 2 lines without clipping */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item_card_desc {
    padding: 5px;
    box-sizing: border-box;
    font-size: 14px;
    color: #555;
    line-height: 1.4em;
    height: 44px; /* ✅ slightly taller so descenders fit */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}


.item_card_price {
    padding: 5px;
    box-sizing: border-box;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    height: 30px; /* fixed height for price row */
}

.card_promo_price, .card_old_price { margin-right: 6px; }

/* ===========================================================
   ACTION ROW (always pinned at bottom)
   =========================================================== */
.item_card_action {
    margin-top: auto; /* push to bottom */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    border-top: 1px solid #bbbaba81;
    height: 50px; /* fixed height for action row */
}

.qty_input {
    width: 60px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-size: 0.95em;
}

.qty_available {
    font-size: 0.9em;
    color: #555;
    margin: 0 10px;
}

.add-to-cart {
    background: linear-gradient(135deg, #c54f00, #d84602);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
}

.add-to-cart:hover {
    background: linear-gradient(135deg, #d60000, #f00000);
    transform: translateY(-2px);
}

/* Responsive action row */
@media (max-width: 768px) {
    .item_card_action {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        height: auto; /* let it expand on mobile */
    }
    .qty_input, .add-to-cart { width: 100%; }
    .add-to-cart { height: 42px; font-size: 1em; }
    .qty_available { text-align: center; margin: 0; }
}


/* ===========================================================
   BOTTOM NAVIGATION
   =========================================================== */
.mainBox_right_bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    width: 100%;
}

/* ===========================================================
   PRICE STYLES
   =========================================================== */
.card_promo_price {
    color: #d9534f;
    font-weight: bold;
    font-size: 1rem;
}

.card_old_price {
    text-decoration: line-through;
    color: #888;
    /* font-size: 0.9rem; */
}

.discount_percent {
    background: #ff9900;
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
}


/* ===========================================================
   HREF STYLE
   =========================================================== */
.item_card_name a,
.item_card_img a {
    text-decoration: none;   /* remove underline */
    color: inherit;          /* inherit parent text color */
}

.item_card_name a:hover,
.item_card_img a:hover {
    text-decoration: none;   /* keep underline off on hover */
    color: inherit;          /* prevent default blue/purple */
}

.item_card_name a {
    text-decoration: none;   /* remove underline */
    color: inherit;          /* keep same text color */
    font-weight: 600;        /* make it slightly bold */
}

.item_card_name a:hover {
    text-decoration: none;   /* no underline on hover */
    color: inherit;          /* prevent default hover color */
}
