.back-button {
    position: absolute;
    left: 0;
    background-color: #0e1167;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-left: 30px;
}
.back-button:hover {
    background-color: #1c2687;
}
/* Logical direction: auto-align to start of direction (RTL or LTR) */
html[dir="ltr"] .back-button {
    left: 30px;
    right: auto;
}

html[dir="rtl"] .back-button {
    right: 30px;
    left: auto;
}
.product-section-title {
    text-align: center;
    color: black;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 302px);
    justify-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px;
}
.product {
  position: relative;
  background: #dfebf6;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 250px;
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* This is important for the ribbon effect */
}

.product-image-container {
    position: relative; /* Added for badge positioning */
    height: 250px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #cdddef;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* MODIFIED: Replace your existing .sale-badge styles with this entire block */

.sale-badge {
    position: absolute;
    width: 150px;
    height: 35px;
    line-height: 35px; /* Vertically centers the text */
    text-align: center;
    background: #e74c3c; /* Main ribbon color */
    color: white;
    font-weight: bold;
    font-size: 14px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* This creates the dark triangular "shadow" that gives the folded look */
.sale-badge::after {
    content: '';
    position: absolute;
    top: 100%; /* Position it right below the main ribbon */
    width: 0;
    height: 0;
    border-style: solid;
    border-color: transparent;
}

/* This creates the notch effect for LTR (English) */
html[dir="ltr"] .sale-badge {
    top: 20px;
    left: -40px;
    transform: rotate(-45deg);
}

html[dir="ltr"] .sale-badge::after {
    left: 0; /* Position the notch on the left side */
    border-width: 0 20px 20px 0; /* Creates the triangle shape */
    border-right-color: #c0392b; /* A darker shade of red for the shadow */
}

/* This creates the notch effect for RTL (Arabic) */
html[dir="rtl"] .sale-badge {
    top: 20px;
    right: -40px;
    transform: rotate(45deg);
}

html[dir="rtl"] .sale-badge::after {
    right: 0; /* Position the notch on the right side */
    border-width: 0 0 20px 20px; /* Creates the triangle shape, mirrored */
    border-left-color: #c0392b; /* A darker shade of red for the shadow */
}

.product-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product .add-to-cart {
  margin-top: auto;
}
.name {
    font-size: 16px;
    font-weight: bold;
    color: black;
    margin: 5px 0 8px 0;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    min-height: 45px;
}
.model-number {
    font-size: 16px;
    font-weight: bold;
    color: black;
    margin: 0 0 8px 0;
    word-wrap: break-word;
    white-space: normal;
}
.description {
    font-size: 14px;
    color: black;
    margin-bottom: 10px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: normal;
    flex-grow: 1;
    min-height: 65px;
}
.warranty {
    font-size: 14px;
    color: black;
    margin-bottom: 5px;
}
.price{
    font-size: 24px;
    font-weight: bold;
    color: #000;
    margin: 10px 0;
}
.new-price {
    font-size: 18px;
    font-weight: bold;
    color: #000;
}
.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
}
.discount {
    background: red;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 5px;
}
.add-to-cart{
  background: #007bff;
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  width: 100%;
  transition: background 0.2s;
}
.add-to-cart:hover{
  background: #0056b3;
}
.add-gift-btn{
  background: #007bff;
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  width: 100%;
  transition: background 0.2s;
}
.add-gift-btn:hover{
  background: #0056b3;
}
.cart-msg-box {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #0e1167;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    font-size: 14px;
    z-index: 999;
    display: none;
}
.cart-msg-box.success { background-color: #28a745; }
.cart-msg-box.error { background-color: #dc3545; }
.footer {
    background-color: #0e1167;
    color: white;
    text-align: center;
    padding: 20px 0;
    position: relative;
    bottom: 0;
    width: 100%;
}
.footer p { margin: 0; font-size: 16px; }
.footer .socials { margin-top: 10px; }
.footer .socials a {
    color: white;
    text-decoration: underline;
    margin: 0 15px;
    font-size: 18px;
    transition: color 0.3s, transform 0.3s;
}
.footer .socials a:hover {
    color: #30348e;
    transform: scale(1.1);
}
/* Put this at the END of your CSS to override position based on language */
html[dir="ltr"] .cart-msg-box { left: 20px; right: auto; }
html[dir="rtl"] .cart-msg-box { right: 20px; left: auto; }

/* ===== Gift badge: opposite corner, bigger, colored ===== */
.gift-float{
  position:absolute;
  top:8px;
  z-index:12;
  display:flex;
  align-items:center;
  gap:8px;
  pointer-events:none;
}

/* Swapped sides: LTR -> top-right, RTL -> top-left */
html[dir="ltr"] .gift-float{ right:8px; left:auto; }
html[dir="rtl"] .gift-float{ left:8px; right:auto; }

/* Circle icon (bigger + colored) */
.gift-float .gift-icon-closed{
  font-size:28px;                 /* bigger icon */
  line-height:1;
  color:#fff;                     /* icon color */
  background: linear-gradient(135deg,#ff6b6b,#f06595); /* colored circle */
  border-radius:50%;
  padding:10px;                   /* bigger hit area */
  box-shadow:0 4px 10px rgba(0,0,0,.2);
  transition:opacity .2s ease, transform .2s ease;
}

/* Hover popout tag */
.gift-float .gift-open{
  position:absolute;
  top:0;
  display:flex;
  align-items:center;
  gap:6px;
  background:#fff5e6;
  border:1px solid #f0b35a;
  border-radius:20px;
  padding:7px 12px;
  opacity:0;
  transform:translateY(6px);
  transition:opacity .25s ease, transform .25s ease;
}

/* Direction-aware popout alignment next to the circle */
html[dir="ltr"] .gift-float .gift-open{ right:44px; left:auto; }  /* pops leftwards */
html[dir="rtl"] .gift-float .gift-open{ left:44px; right:auto; }  /* pops rightwards */

.gift-float .gift-open i{ color:#e67e22; }
.gift-float .gift-amount{ font-weight:700; color:#2d2d2d; font-size:14px; white-space:nowrap; }

/* Show tag on hover */
.product:hover .gift-float .gift-open{ opacity:1; transform:translateY(0); }
.product:hover .gift-float .gift-icon-closed{ opacity:0; }



