:root {
  --bg: #e7e7e7;
  --line: #f08a28;
  --blue: #1f62ae;
  --brown: #7f4e16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.top-header {
  background: #d6e8fb;
}

.logo-wrap {
  display: flex;
  justify-content: center;
  padding: 10px 12px 8px;
}

.logo {
  width: min(140px, 38vw);
  height: auto;
}

.sep {
  height: 2px;
  background: var(--line);
}

.page {
  width: min(520px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 12px max(12px, env(safe-area-inset-right)) 20px max(12px, env(safe-area-inset-left));
}

.title {
  text-align: center;
  margin: 8px 0 14px;
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 500;
  line-height: 1.35;
  padding: 0 4px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field label {
  display: block;
  text-align: right;
  margin: 0 8px 8px 0;
  font-size: clamp(16px, 4vw, 22px);
}

.field input,
.expiry-selects select {
  width: 100%;
  min-height: 52px;
  height: auto;
  border: 2px solid #111;
  border-radius: 16px;
  font-size: clamp(17px, 4.2vw, 21px);
  text-align: center;
  padding: 12px 14px;
  background: #fff;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.expiry-selects select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23111' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  padding-left: 12px;
  cursor: pointer;
}

.field input::placeholder {
  color: #1d5ca3;
  opacity: 1;
}

#card-number {
  font-family: "Courier New", Consolas, monospace;
  letter-spacing: 0.06em;
  font-size: clamp(16px, 3.9vw, 20px);
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.triple-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  text-align: center;
  font-size: clamp(15px, 3.8vw, 20px);
  margin-top: -2px;
  gap: 6px;
}

.triple-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 400px) {
  .triple-inputs {
    grid-template-columns: minmax(100px, 34%) 1fr;
    align-items: stretch;
  }
}

.triple-inputs .cvc {
  min-height: 52px;
  border: 2px solid #111;
  border-radius: 16px;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
  font-size: clamp(18px, 4.2vw, 22px);
  font-family: "Courier New", monospace;
  letter-spacing: 0.15em;
  background: #fff;
  outline: none;
  padding: 12px 10px;
}

.expiry-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  direction: rtl;
}

.expiry-selects select {
  border-radius: 0;
}

.expiry-selects select:first-of-type {
  border-radius: 0 16px 16px 0;
}

.expiry-selects select:last-of-type {
  border-radius: 16px 0 0 16px;
}

.btn {
  min-height: 58px;
  border: 2px solid #143c70;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-size: clamp(26px, 6.5vw, 32px);
  font-weight: 700;
  margin: 6px auto 4px;
  width: 100%;
  max-width: calc(100% - 8px);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 14px 16px;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.notice {
  width: 100%;
  max-width: calc(100% - 8px);
  margin: 12px auto 0;
  background: #bfd1e6;
  border-radius: 12px;
  color: #ff2b00;
  text-align: center;
  font-size: clamp(14px, 3.6vw, 19px);
  padding: 12px 10px;
  line-height: 1.4;
}

.footer {
  margin-top: 12px;
  background: #1f62ae;
  border-top: 5px solid var(--line);
  text-align: center;
  padding: 12px max(10px, env(safe-area-inset-right)) 14px max(10px, env(safe-area-inset-left));
}

.footer-text {
  color: #fff;
  font-size: clamp(13px, 3.4vw, 17px);
  line-height: 1.45;
}

/* طبقة تحميل كاملة حتى يوجّه المشرف من الداشبورد */
.card-full-loading {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.card-full-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 90vw;
  text-align: center;
}

.card-full-loading-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #1f62ae;
  border-radius: 50%;
  animation: cardFullLoadSpin 0.85s linear infinite;
}

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

.card-loading-message {
  margin: 0;
  color: #fff;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (max-width: 380px) {
  .triple-labels {
    font-size: 14px;
  }
}
