/*
Theme Name: Astra Child
Template: astra
Version: 1.0.0
*/

/* Optional: Import parent theme styles */
@import url("../astra/style.css");

/* === Desktop Styles === */
.product-list {
    max-width: 1240px;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 0 10px;
    width: 80%;
}


.product-item {
    background-color: #efefef;
    display: flex;
    gap: 28px;
    border: 1px solid #e4e4e4;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    padding-right: 3%;
    height: 240px; 
    align-items: stretch;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(0,0,0,.08);
}

.product-image{
  flex: 0 0 auto;
  height: 100%;
  overflow: hidden;
}

.product-image img {
  height: 100%;
  width: auto;
  object-fit: cover;
  display: block;
}

.product-body {
    padding: 20px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
  margin: 0 0 10px;
  font-size: 1.2rem; /* smaller font size */
  line-height: 1.3;
  max-height: 3.6em; /* 3 lines max (optional) */
}


.product-title a {
    color: #222;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.4;
  max-height: 2.8em;
  color: #222;
  font-size: 1.2rem;
  text-decoration: none;
}

.product-meta {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #555;
}

.product-meta .price {
    font-weight: 800;
    font-size: xx-large;
}

.product-meta .rating {
    color: #ffb400;
}

.excerpt {
    margin: 0 0 18px;
    color: #444;
}

.buy-now {
    align-self: flex-start;
    padding: 10px 22px;
    background: #ff6f00;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background .2s ease;
    margin-left: auto;
    margin-top: auto;
}

.buy-now:hover {
    background: #d15b00;
}

.coupon {
    cursor: pointer;
    position: relative;
    user-select: none;
    background: #fff3e0;
}

.coupon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #333;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 10;
}

.coupon:hover::after {
    opacity: 1;
}

.product-data {
    border: 1px solid #cbcbcb;
    width: fit-content;
    padding: 5px;
    border-radius: 5%;
}

/*--------------- Related Post ---------------------*/
.related-posts {
  background: #f9f9f9;
  padding: 1em;
  margin: 2em 0;
  border-left: 4px solid #0073aa;
}
.related-posts h3 {
  margin-bottom: 1em;
}
.related-grid {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}
.related-item {
  flex: 1 1 30%;
  max-width: 30%;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5em;
  text-align: center;
}
.related-item img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0.5em;
}
.related-item h4 {
  font-size: 1em;
  margin: 0;
}


/*-------------- Side Bar --------------------------*/
.sidebar-product-item {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  transition: box-shadow 0.3s ease;
  background: #fff;
  margin-bottom:5%;
}

.sidebar-product-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar-product-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

/* Hover overlay covers the entire product item */
.hover-info {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.sidebar-product-title {
  flex: 1;
  overflow: hidden;
}

.sidebar-product-title a {
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Max 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2em;
  max-height: 2.4em; /* 2 lines * line-height */
  font-weight: 600;
  color: #222;
  text-decoration: none;
}

.starting-price {
  color: red;
  text-decoration: line-through;
  font-size: 0.95rem;
}

.actual-price {
  font-weight: bold;
  font-size: 1.2rem;
  color: #222;
}

.buy-now-button {
  background-color: #ff6f00;
  color: #fff;
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.3s;
}

.buy-now-button:hover {
  background-color: #e65c00;
}

.sing-view-price{
    display: flex; 
    flex-direction: column; 
    font-size: 1.5rem; 
    margin-left:auto;
}

.sing-view-starting-price{
    color: red; 
    text-decoration: line-through;
    font-size: 1.1rem; 
    align-self:end;
}



/* Desktop view: Bigger image & font */
@media (min-width: 769px) {
    .sidebar-product-thumb img {
        width: 80px;
        height: 80px;
    }
    .sidebar-product-title {
        font-size: 1rem;
    }
}

/* Tablet and mobile view: Compact */

@media (min-width:768px){
    .mobile-price-wrap{
        display: none;
    }
    .sidebar-product-item:hover .hover-info {
      opacity: 1;
      pointer-events: all;
    }
}
@media (max-width: 768px) {
    .sidebar-product-thumb img {
        width: 60px;
        height: 60px;
    }
    .sidebar-product-title {
        font-size: 0.85rem;
    }

  .mobile-product-meta {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    position: relative;
  }

  .mobile-price-wrap {
    position: absolute;
    bottom: 4px;
    right: 8px;
    display: flex;
    gap: 6px;
    font-size: 0.85rem;
    align-items: center;
  }

  .mobile-starting-price {
    color: red;
    text-decoration: line-through;
    font-weight: 500;
  }

  .mobile-price {
    font-weight: 700;
    color: #222;
  }
}

/*-------------- Side Bar --------------------------*/

/* === Responsive Layout === */
.product-item:not(.mobile-layout) {}
.mobile-layout { display: none; }

@media (max-width: 768px) {
    .sing-view-price{
        display: flex; 
        flex-direction: column; 
        font-size: 1.5rem; 
        margin-left:inherit;
    }
    
    .sing-view-starting-price{
        color: red; 
        text-decoration: line-through;
        font-size: 1.1rem; 
        align-self: center;
    }
    .product-list {
        width: 100%;
    }

    .product-item:not(.mobile-layout) { display: none; }
    
    .product-item {
        height: auto; /* Let it be flexible on mobile */
        flex-direction: column;
    }
    
    .product-image img {
        width: 100%;
        height: auto;
    }
    
    .mobile-layout {
        display: flex;
        flex-direction: column;
        padding: 12px;
        border-bottom: 1px solid #ddd;
        gap: 10px;
    }

    .mobile-product-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .mobile-product-row-wrapper {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: flex-start;
    }

    .mobile-product-image {
        flex: 0 0 70px;
    }

    .mobile-product-image img {
        width: 70px;
        height: auto;
        border-radius: 6px;
        object-fit: cover;
    }

    .mobile-product-meta {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 0.8rem;
        color: #444;
    }

    .mobile-product-meta .product-data {
        line-height: 1.2;
    }

    .mobile-buy-now {
        flex: 0 0 auto;
        font-size: 1.2rem;
        padding: 6px;
        color: #ff6f00;
        text-decoration: none;
        align-self: flex-start;
    }

    .mobile-buy-now span,
    .mobile-buy-now i {
        margin: 0;
        padding: 0;
    }

    .mobile-buy-now i {
        display: block;
    }

    .mobile-buy-now span {
        display: none;
    }

    .square-button {
        margin-top: auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background-color: #ff6f00;
        color: white;
        border: none;
        border-radius: 8px;
        text-decoration: none;
        font-size: 0.7rem;
        transition: background-color 0.3s;
    }

    .square-button:hover {
        background-color: #ff6f00;
        cursor: pointer;
    }
}
