/* =========================================================
   TAMMIA — keranjang dan checkout
   CSS Injector "tammia_redesign_cart", kondisi Request path:
     /cart
     /checkout*

   Dua-duanya form bawaan Drupal Commerce dan TIDAK diganti. Yang
   dikerjakan cuma menggayakannya mengikuti .cart-table, .order-summary,
   .summary-row, dan .checkout-form di template.
   ========================================================= */

/* ---- Judul halaman ---- */
body #block-tammia-theme-page-title h1 {
  font-family: "Comfortaa", "Poppins", sans-serif !important;
  font-size: clamp(2rem, 4.5vw, 3.4rem) !important;
  font-weight: 300 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.02em !important;
  color: #1a1a1a !important;
  text-transform: none !important;
  text-align: left !important;
  margin: 0 0 36px !important;
}

/* =========================================================
   KERANJANG
   ========================================================= */
/* Isi form keranjang: tabel, blok total, lalu tombol. Ketiganya anak
   langsung form-nya, jadi bisa ditata jadi dua kolom tanpa JS. */
@media (min-width: 992px) {
  body .cart-form form[id^="views-form-commerce-cart-form"] {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
  }
  body .cart-form form[id^="views-form-commerce-cart-form"] > table { grid-column: 1; grid-row: 1 / span 2; }
  body .cart-form form[id^="views-form-commerce-cart-form"] > div:has(.field--name-total-price) { grid-column: 2; grid-row: 1; }
  body .cart-form form[id^="views-form-commerce-cart-form"] > #edit-actions { grid-column: 2; grid-row: 2; }
}

/* ---- Tabel keranjang ---- */
body .cart-form table.views-table {
  width: 100%; border-collapse: collapse; margin: 0;
  background: transparent !important;
}
body .cart-form table.views-table tbody tr,
body .cart-form table.views-table tbody tr:nth-child(odd) { background: transparent !important; }
body .cart-form table.views-table th {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: #414042; text-align: left; font-weight: 500;
  padding: 16px 12px; border-bottom: 1px solid #e6e2dd; border-top: none;
  background: transparent !important;
}
body .cart-form table.views-table td {
  padding: 24px 12px; border-bottom: 1px solid #e6e2dd; border-top: none;
  vertical-align: middle;
}
body .cart-form table.views-table td img {
  width: 88px; height: 88px; object-fit: cover;
  border-radius: 12px; display: block;
  background: linear-gradient(160deg,#fcf0f0,#f8f1e2);
}
body .cart-form .views-field-purchased-entity .field--name-title {
  font-family: "Poppins", sans-serif; font-size: 14px; font-weight: 500; color: #1a1a1a; line-height: 1.4;
}
body .cart-form .views-field-purchased-entity .field--name-product-id { font-size: 12px; color: #414042; }
body .cart-form .views-field-unit-price__number,
body .cart-form .views-field-total-price__number {
  font-family: "Comfortaa", "Poppins", sans-serif; font-size: 15px; font-weight: 500; color: #1a1a1a;
}

/* Jumlah dan tombol hapus */
body .cart-form .quantity-edit-input {
  width: 70px; text-align: center;
  border: 1px solid #e6e2dd !important; border-radius: 999px !important;
  padding: 9px 10px !important; background: #fff !important;
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  box-shadow: none !important;
}
body .cart-form .quantity-edit-input:focus {
  border-color: #d3ac50 !important; box-shadow: 0 0 0 4px rgba(225,29,37,.15) !important; outline: none !important;
}
body .cart-form .delete-order-item {
  background: transparent !important; border: none !important;
  color: #414042 !important; font-size: 16px !important;
  padding: 0 !important; width: 36px; height: 36px; border-radius: 999px;
}
body .cart-form .delete-order-item:hover { color: #e11d25 !important; background: #fcf0f0 !important; }

/* ---- Ringkasan total, digayakan seperti .order-summary ---- */
body .cart-form form[id^="views-form-commerce-cart-form"] > div:has(.field--name-total-price) {
  background: #faf9f7; border-radius: 28px; padding: 32px;
  /* lebarnya dipatok theme, dipaksa penuh supaya kartunya rata dengan kolom */
  width: 100% !important; max-width: none !important; justify-self: stretch;
}
@media (min-width: 992px) {
  body .cart-form form[id^="views-form-commerce-cart-form"] > div:has(.field--name-total-price) {
    position: sticky; top: 100px;
  }
}
body .cart-form .order-total-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; font-size: 14px; color: #2b2b2b;
}
body .cart-form .order-total-line__total {
  border-top: 1px solid #e6e2dd; margin-top: 14px; padding-top: 18px;
  font-family: "Comfortaa", "Poppins", sans-serif;
  font-size: 22px; font-weight: 500; color: #1a1a1a;
}
body .cart-form .order-total-line__total .order-total-line-value { font-size: 22px; }

/* ---- Tombol ---- */
body .cart-form #edit-actions { display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; }
@media (min-width: 992px) { body .cart-form #edit-actions { margin-top: -12px; } }
/* cart-checkout.css milik Bion memaksa #edit-checkout jadi width:auto
   dengan !important lewat .path-cart #edit-actions #edit-checkout, yaitu
   dua id. Jadi selektor di sini juga harus dua id, kalau cuma satu id
   plus kelas dia tetap kalah walau sama-sama !important. */
body.path-cart #edit-actions #edit-checkout,
body .cart-form #edit-checkout {
  width: 100% !important; order: 1;
  font-family: "Poppins", sans-serif !important; font-weight: 500 !important; font-size: 14px !important;
  padding: 15px 28px !important; border-radius: 999px !important;
  background: #e11d25 !important; color: #fff !important; border: 1px solid #e11d25 !important;
  box-shadow: 0 12px 30px -10px rgba(225,29,37,0.45) !important;
  transition: all .3s cubic-bezier(.2,.8,.2,1) !important;
}
body.path-cart #edit-actions #edit-checkout:hover,
body .cart-form #edit-checkout:hover {
  background: #a22a34 !important; border-color: #a22a34 !important;
  transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(162,42,52,0.55) !important;
}
body.path-cart #edit-actions #edit-submit,
body .cart-form #edit-submit {
  width: 100% !important; order: 2;
  font-family: "Poppins", sans-serif !important; font-weight: 500 !important; font-size: 14px !important;
  padding: 12px 24px !important; border-radius: 999px !important;
  background: transparent !important; color: #1a1a1a !important; border: 1px solid #e6e2dd !important;
}
body.path-cart #edit-actions #edit-submit:hover,
body .cart-form #edit-submit:hover { border-color: #1a1a1a !important; }

/* =========================================================
   CHECKOUT
   ========================================================= */
body .commerce-checkout-flow .layout-checkout-form { gap: 40px; }
body .checkout-pane { border: none; }
/* Tiap langkah jadi kartu putih */
body fieldset.checkout-pane {
  background: #fff; border: 1px solid #e6e2dd; border-radius: 28px;
  padding: 28px 32px; margin-bottom: 24px;
}
body fieldset.checkout-pane > legend {
  font-family: "Comfortaa", "Poppins", sans-serif;
  font-size: 20px; font-weight: 400; color: #1a1a1a;
  padding: 0; margin: 0 0 18px; border: none; width: auto; float: none;
  text-transform: none;
}
body fieldset.checkout-pane .fieldset-wrapper { padding: 0; }

/* Isian form, nilai sama dengan .checkout-form di template */
body .commerce-checkout-flow input[type="text"],
body .commerce-checkout-flow input[type="email"],
body .commerce-checkout-flow input[type="tel"],
body .commerce-checkout-flow input[type="password"],
body .commerce-checkout-flow textarea,
body .commerce-checkout-flow select {
  width: 100%;
  background: #faf9f7 !important;
  border: 1px solid #e6e2dd !important;
  border-radius: 10px !important;
  padding: 14px 16px !important;
  font-family: inherit; font-size: 14px; color: #1a1a1a;
  box-shadow: none !important;
  transition: all .2s ease;
}
body .commerce-checkout-flow input[type="text"]:focus,
body .commerce-checkout-flow input[type="email"]:focus,
body .commerce-checkout-flow input[type="tel"]:focus,
body .commerce-checkout-flow input[type="password"]:focus,
body .commerce-checkout-flow textarea:focus,
body .commerce-checkout-flow select:focus {
  outline: none !important; background: #fff !important;
  border-color: #d3ac50 !important;
  box-shadow: 0 0 0 4px rgba(225,29,37,.15) !important;
}
body .commerce-checkout-flow label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: #414042; margin-bottom: 8px; font-weight: 500;
}
body .commerce-checkout-flow .form-item { margin-bottom: 18px; }

/* Kolom kanan checkout: ringkasan pesanan */
body .layout-region-checkout-secondary > h3 {
  font-family: "Comfortaa", "Poppins", sans-serif !important;
  font-size: 22px !important; font-weight: 400 !important;
  color: #1a1a1a !important; margin: 0 0 18px !important;
  text-transform: none !important; text-align: left !important;
}
body .layout-region-checkout-secondary > h3::after,
body .layout-region-checkout-secondary > h3::before { display: none !important; }
body #edit-order-summary,
body #edit-coupon-redemption {
  background: #faf9f7; border-radius: 28px; padding: 28px; margin-bottom: 20px;
}
@media (min-width: 992px) {
  body .layout-region-checkout-secondary { position: sticky; top: 100px; }
}
body .layout-region-checkout-secondary .order-total-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; font-size: 14px; color: #2b2b2b;
}
body .layout-region-checkout-secondary .order-total-line__total {
  border-top: 1px solid #e6e2dd; margin-top: 14px; padding-top: 18px;
  font-family: "Comfortaa", "Poppins", sans-serif;
  font-size: 22px; font-weight: 500; color: #1a1a1a;
}

/* Tombol lanjut */
body .commerce-checkout-flow #edit-actions { padding: 0; margin-top: 8px; }
body .commerce-checkout-flow #edit-actions .button--primary,
body .commerce-checkout-flow #edit-login-guest-continue,
body .commerce-checkout-flow #edit-login-returning-customer-submit {
  font-family: "Poppins", sans-serif !important; font-weight: 500 !important; font-size: 14px !important;
  padding: 15px 32px !important; border-radius: 999px !important;
  background: #e11d25 !important; color: #fff !important; border: 1px solid #e11d25 !important;
  box-shadow: 0 12px 30px -10px rgba(225,29,37,0.45) !important;
  transition: all .3s cubic-bezier(.2,.8,.2,1) !important;
}
body .commerce-checkout-flow #edit-actions .button--primary:hover,
body .commerce-checkout-flow #edit-login-guest-continue:hover,
body .commerce-checkout-flow #edit-login-returning-customer-submit:hover {
  background: #a22a34 !important; border-color: #a22a34 !important;
  transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(162,42,52,0.55) !important;
}
body .commerce-checkout-flow .link--previous {
  font-size: 13px; color: #414042; margin-left: 18px;
}

@media (max-width: 991px) {
  /* Commerce menahan dua kolom sampai layar cukup sempit, hasilnya kolom
     ringkasan tinggal 178px di 820px. Dibuat menumpuk mulai di bawah 992px,
     sama seperti halaman lain. */
  body .commerce-checkout-flow .layout-region-checkout-main,
  body .commerce-checkout-flow .layout-region-checkout-secondary,
  body .commerce-checkout-flow .layout-region-checkout-footer {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body .layout-region-checkout-secondary { position: static !important; margin-top: 24px; }
  body fieldset.checkout-pane { padding: 22px 20px; border-radius: 20px; }
  body #edit-order-summary, body #edit-coupon-redemption { padding: 22px 20px; border-radius: 20px; }
  body .cart-form form[id^="views-form-commerce-cart-form"] > div:has(.field--name-total-price) {
    padding: 22px 20px; border-radius: 20px; margin-top: 24px;
  }
}
/* Tabel keranjang di HP: biar bisa digeser sendiri, bukan mendorong halaman */
@media (max-width: 767px) {
  body .cart-form form[id^="views-form-commerce-cart-form"] { overflow-x: auto; }
  body .cart-form table.views-table { min-width: 560px; }
  body .cart-form table.views-table td { padding: 16px 8px; }
  body .cart-form table.views-table td img { width: 64px; height: 64px; }
}
