/* GRENKE leasing - premium theme integration */
.grenke-leasing-box,
.grenke-payment-form {
  box-sizing: border-box;
  width: 100%;
  margin: 16px 0 20px;
  padding: 16px 18px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: none;
}

.grenke-leasing-box *,
.grenke-payment-form *,
.grenke-list-finance * {
  font-family: inherit;
  box-sizing: border-box;
}

.grenke-brand-line,
.grenke-modal-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.grenke-logo {
  display: block;
  width: auto;
  max-width: 118px;
  max-height: 28px;
  object-fit: contain;
}

.grenke-finance-badge,
.grenke-list-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid #d8dde5;
  border-radius: 999px;
  background: #f7f8fa;
  color: #232323;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}

.grenke-highlight-card {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid #e5e9ef;
  border-radius: 7px;
  background: #f8fafc;
}

.grenke-highlight-label {
  display: block;
  margin: 0 0 2px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 400;
}

.grenke-highlight-card strong {
  display: block;
  margin: 0;
  color: #232323;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.grenke-highlight-card small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.35;
}

.grenke-leasing-label {
  display: block;
  margin: 0 0 7px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  color: inherit;
}

.grenke-leasing-select {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 8px 36px 8px 12px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  background-color: #fff;
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 400;
  box-shadow: none;
  outline: none;
}

.grenke-leasing-select:focus {
  border-color: #b7c1cc;
  box-shadow: none;
}

/* Product list integration */
.grenke-list-finance {
  display: block;
  width: 100%;
  margin: 5px 0 3px;
  color: #5f6b7a;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.grenke-list-finance strong {
  color: #232323;
  font-weight: 700;
}

/* Checkout/payment step */
.grenke-payment-form {
  margin: 8px 0 0;
  padding: 14px 16px;
}

.grenke-payment-highlight {
  max-width: 420px;
}

.grenke-payment-form .grenke-leasing-label {
  margin-top: 10px;
}

.grenke-payment-form .grenke-leasing-select {
  max-width: 360px;
}

.grenke-payment-result {
  margin-top: 12px;
}


/* Force product-page placement above the add-to-cart block on desktop and mobile. */
.page-product .grenke-leasing-box.grenke-above-add-to-cart {
  clear: both;
  width: 100%;
  margin: 12px 0 14px;
  order: -1;
}

.page-product .product-add-to-cart + .grenke-leasing-box,
.page-product .add-to-cart-or-refresh + .grenke-leasing-box {
  display: none !important;
}

@media (max-width: 767px) {
  .page-product .grenke-leasing-box.grenke-above-add-to-cart {
    margin: 10px 0 12px;
  }
}

/* Modal is appended to body by JS, so it is not affected by header/breadcrumb stacking contexts */
.grenke-leasing-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.grenke-leasing-modal.is-open {
  display: flex;
}

.grenke-leasing-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.58);
}

.grenke-leasing-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: auto;
  padding: 20px 22px 22px;
  border-radius: 8px;
  background: #fff;
  color: #232323;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.30);
  transform: none;
}

.grenke-leasing-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #333;
  font-size: 26px;
  line-height: 30px;
  cursor: pointer;
}

.grenke-leasing-modal-dialog h3 {
  margin: 0 38px 8px 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  color: inherit;
}

.grenke-leasing-modal-subtitle {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #6b7280;
}

.grenke-leasing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.grenke-leasing-grid div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e5e9ef;
  border-radius: 6px;
  background: #f8fafc;
}

.grenke-leasing-grid span {
  display: block;
  margin-bottom: 4px;
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.35;
}

.grenke-leasing-grid strong {
  display: block;
  color: #232323;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
}

.grenke-leasing-note,
.grenke-leasing-disclaimer,
.grenke-payment-info p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.grenke-leasing-disclaimer,
.grenke-payment-info {
  color: #5f6b7a;
}

body.grenke-modal-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .grenke-leasing-box,
  .grenke-payment-form {
    padding: 14px 15px;
  }

  .grenke-logo {
    max-width: 105px;
    max-height: 25px;
  }

  .grenke-highlight-card strong {
    font-size: 18px;
  }

  .grenke-leasing-modal-dialog {
    padding: 18px 16px;
  }

  .grenke-leasing-modal-dialog h3 {
    font-size: 18px;
  }

  .grenke-leasing-grid {
    grid-template-columns: 1fr;
  }
}

/* Visibility controlled from Back Office */
@media (min-width: 768px) {
  .grenke-leasing-box.grenke-hide-desktop {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .grenke-leasing-box.grenke-hide-mobile {
    display: none !important;
  }
}

/* Popup layout optimizat pentru conversie */
.grenke-modal-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 38px 12px 0;
}

.grenke-modal-period {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #232323;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}

.grenke-modal-main-rate {
  margin: 12px 0 14px;
  padding: 16px 18px;
  border: 1px solid #e5e9ef;
  border-radius: 8px;
  background: #f8fafc;
  text-align: left;
}

.grenke-modal-main-label {
  display: block;
  margin: 0 0 4px;
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

.grenke-modal-main-rate strong {
  display: block;
  margin: 0;
  color: #232323;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.grenke-modal-main-rate strong small {
  font-size: 15px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
}

.grenke-modal-main-rate em {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.35;
  font-style: normal;
}

.grenke-breakdown {
  margin: 0;
  border: 1px solid #e5e9ef;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.grenke-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  border-bottom: 1px solid #edf0f4;
}

.grenke-breakdown-row:last-child {
  border-bottom: 0;
}

.grenke-breakdown-row span {
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.35;
}

.grenke-breakdown-row strong {
  color: #232323;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .grenke-modal-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    margin-right: 34px;
  }

  .grenke-modal-main-rate {
    padding: 14px 15px;
  }

  .grenke-modal-main-rate strong {
    font-size: 26px;
  }

  .grenke-breakdown-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .grenke-breakdown-row strong {
    text-align: left;
    white-space: normal;
  }
}
