/* ═══════════════════════════════════════════════════════
   Thorius Checkout — UI düzeltmeleri v1.2.4
   Kupon ikonu · PayTR okunabilirlik · Geniş form · Sticky sidebar
   ═══════════════════════════════════════════════════════ */

/* ── Checkout grid: hata kutusu tam genişlik, form yapısı korunur ── */
body.woocommerce-checkout .woocommerce > .woocommerce-notices-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  margin-bottom: 24px !important;
}

form.checkout {
  display: grid !important;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 370px) !important;
  gap: 40px !important;
  align-items: start !important;
}

form.checkout > .woocommerce-NoticeGroup,
form.checkout > .woocommerce-NoticeGroup-checkout,
form.checkout > .woocommerce-notices-wrapper {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  clear: both !important;
  margin: 0 0 8px 0 !important;
}

#customer_details {
  grid-column: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
}

#order_review,
.woocommerce-checkout-review-order {
  grid-column: 2 !important;
}

/* Üstte tek hata özeti */
body.woocommerce-checkout .woocommerce-notices-wrapper ul.woocommerce-error,
body.woocommerce-checkout .woocommerce-NoticeGroup-checkout ul.woocommerce-error,
form.checkout .woocommerce-NoticeGroup ul.woocommerce-error {
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  border-radius: 12px !important;
  padding: 16px 20px 16px 36px !important;
  margin: 0 0 20px 0 !important;
  list-style: disc !important;
}

body.woocommerce-checkout .woocommerce-error li {
  color: #991b1b !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  margin-bottom: 6px !important;
}

body.woocommerce-checkout .woocommerce-error li:last-child {
  margin-bottom: 0 !important;
}

/* Alan içi hata metinlerini gizle — form düzeni bozulmasın */
.woocommerce-checkout #customer_details .form-row .woocommerce-error,
.woocommerce-checkout #customer_details .checkout-inline-error-message,
.woocommerce-checkout #customer_details .form-row .form-row-error,
.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper .woocommerce-error {
  display: none !important;
}

/* Hatalı alan: sadece kırmızı çerçeve */
.woocommerce-checkout #customer_details .form-row.woocommerce-invalid input.input-text,
.woocommerce-checkout #customer_details .form-row.woocommerce-invalid select,
.woocommerce-checkout #customer_details .form-row.woocommerce-invalid-required-field input.input-text,
.woocommerce-checkout #customer_details .form-row.woocommerce-invalid-required-field select {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 1px #fecaca !important;
}

/* Zorunlu alan yıldızı */
.woocommerce-checkout .form-row label abbr.required {
  text-decoration: none !important;
  color: #dc2626 !important;
  border: none !important;
  font-weight: 700 !important;
}

.thorius-checkout-required-note {
  margin: 0 0 16px 0 !important;
  padding: 10px 14px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  color: #475569 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.woocommerce-checkout h1 {
  font-size: 34px !important;
  margin-bottom: 20px !important;
}

.woocommerce-checkout h3 {
  font-size: 20px !important;
  margin-bottom: 18px !important;
}

.woocommerce-billing-fields {
  padding: 24px 28px !important;
}

/* Ad/soyad ve telefon/e-posta: grid ile eşit geniş iki sütun */
.woocommerce-billing-fields__field-wrapper {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px 24px !important;
}

/* Eski WC sürümleri: alanlar doğrudan billing-fields içinde */
body.woocommerce-checkout .woocommerce-billing-fields:not(:has(.woocommerce-billing-fields__field-wrapper)) {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px 24px !important;
}

body.woocommerce-checkout
  .woocommerce-billing-fields:not(:has(.woocommerce-billing-fields__field-wrapper))
  > h3,
body.woocommerce-checkout
  .woocommerce-billing-fields:not(:has(.woocommerce-billing-fields__field-wrapper))
  > .thorius-checkout-required-note {
  grid-column: 1 / -1 !important;
}

.woocommerce-billing-fields__field-wrapper::before,
.woocommerce-billing-fields__field-wrapper::after {
  content: none !important;
  display: none !important;
}

/* Tam genişlik satırlar */
#billing_country_field,
#billing_address_1_field,
#billing_city_field {
  grid-column: 1 / -1 !important;
}

#billing_first_name_field,
#billing_last_name_field,
#billing_company_field,
#billing_vkn_field,
#billing_phone_field,
#billing_email_field {
  width: 100% !important;
  max-width: none !important;
  float: none !important;
  clear: none !important;
  margin-bottom: 0 !important;
}

#billing_first_name_field .input-text,
#billing_last_name_field .input-text,
#billing_phone_field .input-text,
#billing_email_field .input-text {
  min-width: 0 !important;
}

/* Sağ panel (fiyat + ödeme) form başlığıyla hizalı, yukarıda sabit */
#order_review,
.woocommerce-checkout-review-order {
  position: sticky !important;
  top: 24px !important;
  align-self: start !important;
}

.woocommerce-checkout-review-order {
  padding: 24px !important;
}

.woocommerce-checkout-review-order::before {
  margin-bottom: 16px !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}

.woocommerce form .form-row {
  margin-bottom: 12px !important;
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row select,
.select2-container--default .select2-selection--single {
  height: 52px !important;
  font-size: 15px !important;
  width: 100% !important;
}

.woocommerce form .form-row textarea {
  height: 72px !important;
  min-height: 72px !important;
}

/* Gereksiz alanları gizle */
#billing_address_2_field,
#billing_postcode_field,
#billing_state_field,
.woocommerce-additional-fields {
  display: none !important;
}

/* ── Kupon kutusu: ikon + metin çakışması ── */
.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
  position: relative !important;
  padding: 14px 18px 14px 44px !important;
  margin-bottom: 16px !important;
  line-height: 1.5 !important;
}

.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info::before {
  position: absolute !important;
  left: 16px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  line-height: 1 !important;
}

/* ── PayTR: koyu sidebar üzerinde okunabilir metin ── */
.woocommerce-checkout-review-order #payment .payment_box,
.woocommerce-checkout-review-order #payment .payment_box p,
.woocommerce-checkout-review-order #payment .payment_method_paytr_payment_gateway .payment_box,
.woocommerce-checkout-review-order #payment .payment_method_paytr_payment_gateway .payment_box p {
  color: rgba(255, 255, 255, 0.88) !important;
}

.woocommerce-checkout-review-order #payment ul.payment_methods li label {
  color: #ffffff !important;
}

.woocommerce-checkout-review-order #payment .payment_box {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Sağ panel dışındaki ödeme kutusu (fallback) */
body.woocommerce-checkout #payment .payment_box,
body.woocommerce-checkout #payment .payment_box p {
  color: #334155 !important;
}

/* ── Mobil ── */
@media (max-width: 992px) {
  form.checkout {
    grid-template-columns: 1fr !important;
  }

  #customer_details,
  #order_review,
  .woocommerce-checkout-review-order {
    grid-column: 1 !important;
  }

  #order_review,
  .woocommerce-checkout-review-order {
    position: static !important;
  }

  .woocommerce-billing-fields__field-wrapper {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  #billing_country_field,
  #billing_address_1_field,
  #billing_city_field {
    grid-column: auto !important;
  }

  .woocommerce-billing-fields {
    padding: 20px !important;
  }
}
