
/* ===== DESIGN TOKENS ===== */
:root {
  --bg-card: #ffffff;
  --accent: #37AB91;
  --accent-hover: #2e9a82;
  --accent-light: rgba(55, 171, 145, 0.08);
  --accent-glow: rgba(55, 171, 145, 0.25);
  --accent-bg-form: rgba(55, 171, 145, 0.02);
  --text: #000000;
  --text-muted: #77787D;
  --text-footer: #777777;
  --border-light: #E5E5E5B2;
  --border-input: #E6E6E6;
  --border-payment: #F2F2F2;
  --border-footer: #eaeaea;
  --radius: 1rem; /* 16px */
  --radius-lg: 1.25rem; /* 20px */
  --radius-md: 0.625rem; /* 10px */
  --shadow-btn: 0 0.25rem 1rem rgba(55, 171, 145, 0.35);
  --shadow-input-1: rgba(0, 0, 0, 0.03);
  --shadow-input-2: rgba(0, 0, 0, 0.02);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --danger: #ef4444;
  --success: #25D366;
  --font: 'Assistant', system-ui, -apple-system, sans-serif;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: url('/images/bg.jpg');
  background-size: cover;
  background-position: center;
  color: var(--text);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  line-height: 1.4;
  position: relative;
  overflow-x: hidden;
  padding: 2.5rem 0.9375rem; /* 40px 15px */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ===== CHECKOUT PAGE WRAPPER ===== */
.checkout-page {
  width: 100%;
  max-width: 80rem; /* 1280px */
  padding: 3.75rem 4.6875rem; /* 60px 75px */
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
}

/* ===== CHECKOUT GRID ===== */
.checkout-grid {
  display: flex;
  justify-content: space-between;
  align-items: start;
  flex: 1;
}

.product-card {
  width: 100%;
  max-width: 28.125rem; /* 450px */
  padding-left: 1.25rem; /* 20px */
}

.payment-card {
  padding-right: 3.75rem; /* 60px */
  border-right: 0.0625rem solid var(--border-light);
}

/* ===== PRODUCT CARD (ORDER SUMMARY) ===== */
.product-name {
  font-size: 1.375rem; /* 22px */
  font-weight: 700;
  color: var(--text);
  margin: 0.625rem 0; /* 10px */
}

.product-desc {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.9375rem; /* 15px */
}

/* Separator */
.product-divider {
  border: none;
  border-top: 0.0625rem solid var(--border-light);
  margin: 0;
}

/* Product rows */
.product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9375rem 0; /* 15px */
}

.product-row+.product-row {
  border-top: 0.0625rem solid var(--border-light);
}

.product-label {
  font-size: 1rem;
  color: var(--text-muted);
}

.product-value {
  font-size: 1rem;
  color: var(--text);
}

/* Total row */
.total-row {
  padding-top: 0.9375rem; /* 15px */
  border-top: 0.0625rem solid var(--border-light) !important;
}

.total-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.total-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== QUANTITY SELECTOR ===== */
.qty-selector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 0.0625rem solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.qty-btn {
  width: 1.5rem; /* 24px */
  height: 2.25rem; /* 36px */
  border: none;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.qty-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.qty-btn:active {
  transform: scale(0.92);
}

.qty-value {
  font-size: 1rem;
  min-width: 2.375rem; /* 38px */
  text-align: center;
  line-height: 2.375rem; /* 38px */
}

/* ===== PAYMENT CARD ===== */
.payment-section-title {
  font-size: 1.25rem; /* 20px */
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.9375rem; /* 15px */
  text-align: center;
}

/* ===== FORM FIELDS ===== */
.form-group{
  margin-bottom: 0.9375rem; /* 15px */
}
.form-group label {
  display: block;
  font-size: 0.9375rem; /* 15px */
  margin-bottom: 0.25rem; /* 4px */
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 0.75rem; /* 12px */
  border: 0.0625rem solid var(--border-input);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  box-shadow: 0 0.0625rem 0.0625rem 0 var(--shadow-input-1), 0 0.1875rem 0.375rem 0 var(--shadow-input-2); /* 1px 1px, 3px 6px */
  font-size: 1rem; /* 16px */
  font-family: var(--font);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

textarea.form-input {
  resize: none;
  min-height: 5.3125rem; /* 85px */
}

.form-input.error {
  border-color: var(--danger) !important;
}

.form-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.3125rem; /* 5px */
  display: none;
}

.form-hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.hint-tag {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-right: 0.35rem;
}

.form-input--ltr,
.form-input--en {
  direction: ltr;
  text-align: left;
}

/* invoice in a company's name */
.form-group label.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0;
  width: fit-content;
}
.check-row input[type=checkbox] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.company-fields {
  margin-top: 0.75rem;
  padding: 0.9375rem 0.9375rem 0.0625rem;
  border-radius: var(--radius-md);
  background: var(--accent-bg-form);
  border: 0.0625rem solid var(--border-payment);
}
.company-fields[hidden] { display: none; }
#company-name::placeholder, #company-id::placeholder { text-align: left; }

/* intl-tel-input integration */
.iti {
  width: 100%;
  display: block;
  direction: ltr; /* the number and the +code always read left to right */
}
.iti input[type=tel] { text-align: left; direction: ltr; }
.iti .iti__selected-flag .iti__selected-dial-code { direction: ltr; unicode-bidi: isolate; font-weight: 600; color: #111; margin-left: 10px !important; margin-right: 4px !important; }
#cust-email, #cust-name { direction: ltr; text-align: left; }
#cust-email::placeholder, #cust-name::placeholder { text-align: left; }
.iti--show-selected-dial-code .iti__selected-flag { background: #f6f8f7; border-right: 1px solid var(--border-input); border-radius: var(--radius-md) 0 0 var(--radius-md); }
.iti__country-list {
  text-align: left;
  direction: ltr;
}


/* ===== STRIPE PAYMENT ELEMENT ===== */
.form-payment {
  background: var(--accent-bg-form);
  padding: 1.5625rem; /* 25px */
  border-radius: var(--radius-lg);
  border: 0.0625rem solid var(--border-payment);
  margin-top: 1.25rem; /* 20px */
}

#payment-message {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
  text-align: center;
}

/* ===== SUBMIT BUTTON ===== */
.submit-btn {
  width: 100%;
  padding: 0.9375rem; /* 15px */
  background: var(--accent);
  color: var(--bg-card);
  border: none;
  border-radius: 31.25rem; /* 500px */
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  letter-spacing: 0.0125rem; /* 0.2px */
}

.submit-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-0.0625rem); /* -1px */
  box-shadow: var(--shadow-btn);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn .spinner {
  display: none;
  width: 1.375rem; /* 22px */
  height: 1.375rem; /* 22px */
  border: 0.15625rem solid rgba(255, 255, 255, 0.3); /* 2.5px */
  border-top-color: var(--bg-card);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.submit-btn.loading .btn-text {
  display: none;
}

.submit-btn.loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.terms-text {
  font-size: 0.875rem; /* 14px */
  color: var(--text);
  margin: 0.9375rem 0 0.625rem; /* 15px 0 10px */
  text-align: center;
}

.terms-text a {
  color: var(--accent);
  text-decoration: underline;
}

.stripe-footer {
  border-top: 0.0625rem solid var(--border-footer);
  padding-top: 0.625rem; /* 10px */
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stripe-info {
  display: flex;
  align-items: center;
  gap: 0.3125rem; /* 5px */
}

.stripe-text {
  font-size: 0.625rem; /* 10px */
  color: var(--text-footer);
}

.footer-links {
  font-size: 0.625rem; /* 10px */
  color: var(--text-footer);
  display: flex;
  align-items: center;
  gap: 0.25rem; /* 4px */
}

.footer-links a {
  color: var(--text-footer);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-links .separator {
  color: var(--text-footer);
  user-select: none;
}

@media (max-width: 30rem) { /* 480px */
  .stripe-footer {
    flex-direction: column-reverse;
    gap: 0.3125rem; /* 5px */
    text-align: center;
  }
}

/* ===== FOOTER ===== */
.checkout-footer {
  margin-top: 1.5625rem; /* 25px */
}

.footer-stripe {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  color: var(--bg-card);
  text-align: center;
}

/* ===== ERROR BLOCK ===== */
.error-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  max-width: 31.25rem; /* 500px */
  margin: 3rem auto;
}

.error-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.75rem;
}

.error-card-text {
  font-size: 1rem;
  color: var(--text-muted);
}

/* ===== SUCCESS BLOCK ===== */
.success-block {
  max-width: 34.375rem; /* 550px */
  margin: auto;
  text-align: center;
}

.success-icon {
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-title {
  font-size: 2rem; /* 32px */
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.9375rem; /* 15px */
}

.success-text {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1.5625rem; /* 25px */
}

.success-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem; /* 10px */
}

.success-btn a{
  display: flex;
  align-items: center;
  gap: 0.3125rem; /* 5px */
  font-size: 1rem;
  color: var(--bg-card);
  font-weight: 700;
  padding: 1rem;
  border-radius: 31.25rem; /* 500px */
  background: var(--success);
  text-decoration: none;
  transition: var(--transition);
}
.success-btn .receipt-link a{
  background: var(--accent);
}
.success-btn a:hover{
  transform: scale(1.05);
}
.receipt-loading {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.receipt-error {
  display: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
[dir="rtl"] .iti--allow-dropdown .iti__flag-container, [dir="rtl"] .iti--show-selected-dial-code .iti__flag-container{
  right: auto!important;
  left: 0!important
}
[dir="rtl"] .iti--allow-dropdown input.iti__tel-input, [dir="rtl"] .iti--allow-dropdown input.iti__tel-input[type="text"], [dir="rtl"] .iti--allow-dropdown input.iti__tel-input[type="tel"], [dir="rtl"] .iti--show-selected-dial-code input.iti__tel-input, [dir="rtl"] .iti--show-selected-dial-code input.iti__tel-input[type="text"], [dir="rtl"] .iti--show-selected-dial-code input.iti__tel-input[type="tel"]{
padding-right: 6px!important;
  padding-left: 52px!important
}  

/* ===== RESPONSIVE ===== */
@media (max-width: 64rem) { /* 1024px */
  .checkout-grid {
    flex-direction: column;
  }
  .product-card{
    padding-left: 0;
    text-align: center;
    max-width: none;
  }

  .payment-card{
    width: 100%;
    padding-right: 0;
    border-right: none;
    border-top: 0.0625rem solid var(--border-light);
    padding-top: 1.25rem; /* 20px */
  }
}

@media (max-width: 48rem) { /* 768px */
  .checkout-page{
    padding: 1.5625rem 1.25rem; /* 25px 20px */
  }
  .success-btn{
    flex-direction: column;
  }
  .footer-stripe-logo svg,.logo{
    max-width: 7.375rem; /* 118px */
  }
  .success-btn a, .receipt-link{
    width: 100%;
    justify-content: center;
  }
  .success-title{
    font-size: 1.375rem; /* 22px */
  }
  .footer-stripe{
    font-size: 0.875rem; /* 14px */
  }
  .success-icon svg{
    width: 2.625rem; /* 42px */
    height: 2.625rem; /* 42px */
  }
  .payment-section-title{
    font-size: 1.125rem; /* 18px */
  }
  .form-payment{
    padding: 0.9375rem; /* 15px */
  }
}