/* ================= Desktop Table ================= */
.kg-category-title {
  font-size: 28px;
  margin: 26px 0 12px;
}

.kg-order-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 24px;
  font-size: 15px;
}
.kg-order-table th,
.kg-order-table td {
  border: 1px solid #e5e5e5;
  padding: 10px;
  text-align: center;
  vertical-align: middle;
}
.kg-order-table th {
  background: #f8f8f8;
  font-weight: 600;
}
.kg-order-table .kg-image img {
  max-width: 120px;
  height: auto;
}
.kg-order-table .kg-qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kg-order-table .kg-qty-controls button {
  width: 30px;
  height: 30px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  border-radius: 4px;
}
.kg-order-table input.kg-qty {
  width: 80px;
  max-width: 100%;
  text-align: center;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #ddd;
}
.kg-order-table .button.kg-add-to-cart {
  background: #ff6600;
  color: #fff;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 4px;
}
.kg-order-table .button.kg-add-to-cart.kg-loading {
  opacity: 0.7;
  cursor: wait;
}
.kg-order-table .kg-error {
  color: #c00;
  font-size: 13px;
  margin-top: 6px;
}

/* 🔹 Note for per-piece products */
.kg-order-table .kg-note {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  text-align: left;
}

/* ================= Bulk Buttons ================= */
.kg-bulk-sticky {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 20px;
}
.kg-bulk-sticky .kg-add-selected {
  background: #007cba;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.kg-bulk-sticky .kg-add-selected.kg-loading {
  opacity: 0.7;
  cursor: wait;
}
/* ================= Mobile Card Layout ================= */
@media (max-width: 768px) {

  /* Hide table header */
  .kg-order-table thead { 
    display: none !important; 
  }

  /* Hide checkboxes (Requirement #1) */
  .kg-order-table .kg-select,
  .kg-order-table .kg-select-all {
    display: none !important;
  }

  .kg-order-table tbody { 
    display: block !important; 
  }

  .kg-order-table tbody tr {
    display: flex !important;
    flex-direction: column !important;
    border: 1px solid #e9e9e9;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  }

  /* Each cell as row */
  .kg-order-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border: 0 !important;
    padding: 8px 0 !important;
    text-align: left;
  }

  /* 1️⃣ Recipe name FIRST */
  .kg-order-table td.kg-name {
    order: 0 !important;
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    padding: 6px 0 !important;
    margin-bottom: 6px;
  }

  /* 2️⃣ Image immediately BELOW name */
  .kg-order-table td.kg-image {
    order: 1 !important;
    width: 100%;
    text-align: center;
    padding-bottom: 10px !important;
    display: flex;
    justify-content: center;
  }

  .kg-order-table td.kg-image img {
    width: 140px !important;
    height: 140px !important;
    object-fit: cover !important;
    border-radius: 8px;
  }

  /* 3️⃣ All other data rows AFTER image */
  .kg-order-table td.kg-price,
  .kg-order-table td.kg-qty-td,
  .kg-order-table td.kg-total,
  .kg-order-table td.kg-advance,
  .kg-order-table td.kg-remaining {
    order: 2 !important;
  }

  /* Labels */
  .kg-order-table td:not(.kg-image):not(.kg-name):not(.kg-action):before {
    content: attr(data-label);
    color: #5b5b5b;
    font-size: 13px;
    font-weight: 600;
    margin-right: 10px;
    flex: 0 0 auto;
  }

  /* Values aligned right */
  .kg-order-table td > *:last-child {
    flex: 1 1 auto;
    text-align: right;
  }

  /* Quantity controls */
  .kg-order-table .kg-qty-controls {
    justify-content: flex-end;
    gap: 8px;
  }

  .kg-order-table input.kg-qty {
    width: 90px !important;
    text-align: center;
  }

  /* Per-piece note */
  .kg-order-table .kg-note {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    width: 100%;
    text-align: left;
    display: block;
  }

  /* 4️⃣ Add to Cart LAST + centered */
  .kg-order-table td.kg-action {
    order: 99 !important;
    width: 100%;
    padding-top: 12px !important;
    display: flex !important;
    justify-content: center !important;
  }

  .kg-order-table td.kg-action button,
  .kg-order-table td.kg-action .button {
    width: 95% !important;
    padding: 12px !important;
    border-radius: 10px !important;
    background: #ff6600 !important;
    color: #fff !important;
    border: 0 !important;
    font-weight: 700;
    text-align: center;
  }

  /* Text sizing */
  .kg-order-table td:not(.kg-image):not(.kg-name):not(.kg-action) {
    font-size: 14px;
  }
}
