* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  overflow-x: hidden;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f9ff;
  color: #333;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.d-none {
  display: none;
}

/* ===================== Header ===================== */
header {
  background: white;
  padding: 14px clamp(16px, 4vw, 80px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  box-shadow: none;
  border-bottom: 1px solid #e8e8e8;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 25px);
  flex-wrap: wrap;
}

.logos {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logos img {
  width: clamp(36px, 5vw, 55px);
}

.logo-text-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-republic {
  font-size: clamp(12px, 1.6vw, 22px);
  color: #999;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.logo-ministry {
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: linear-gradient(89.9deg, #127e76 42.51%, #127e76 98.27%);
  color: transparent;
  -webkit-background-clip: text;
}

/* ===================== Language Selector ===================== */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border: 1.5px solid #e0e0e0;
  border-radius: 25px;
  cursor: pointer;
  font-size: clamp(12px, 1.5vw, 14px);
  color: #333;
  background: white;
  transition: all 0.3s;
  position: relative;
  user-select: none;
  white-space: nowrap;
}

.lang-selector:hover,
.lang-selector.open {
  border-color: #127e76;
  background: #f8fbff;
}

.lang-selector.open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.flag-icon {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  flex-shrink: 0;
}

.dropdown-arrow {
  font-size: 11px;
  color: #666;
  transition: transform 0.3s;
}

.lang-selector.open .dropdown-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  left: -1.5px;
  right: -1.5px;
  background: white;
  border: 1.5px solid #127e76;
  border-top: none;
  border-radius: 0 0 25px 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow: hidden;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 14px;
}

.lang-option:hover {
  background: #f8fbff;
  padding-left: 25px;
}

.lang-option.active {
  background: #f0f8ff;
  font-weight: 600;
  color: #127e76;
}

.lang-option .fa-check {
  margin-left: auto;
  color: #127e76;
  font-size: 12px;
}

.lang-option:first-child { padding-top: 15px; }
.lang-option:last-child { padding-bottom: 15px; }

/* ===================== Preloader ===================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.preloader {
  text-align: center;
  max-width: 90vw;
}

.preloader img {
  width: clamp(140px, 35vw, 346px);
  animation: shake 1.5s infinite;
}

.preloader h1 {
  font-size: clamp(15px, 2.5vw, 20px);
  color: #127e76;
  font-weight: 600;
  margin-top: 12px;
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* ===================== Page layout (mono-colonne) ===================== */
.payment-page {
  width: 100%;
  min-height: calc(100vh - 80px);
  padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 40px) clamp(50px, 8vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-intro {
  text-align: center;
  max-width: 700px;
  margin-bottom: clamp(25px, 4vw, 45px);
}

.page-intro h1 {
  font-size: clamp(22px, 3.5vw, 36px);
  font-weight: 700;
  line-height: 1.3;
  background: linear-gradient(89.9deg, #127E76 42.51%, #127E76 98.27%);
  color: transparent;
  -webkit-background-clip: text;
}

.payment-wrapper {
  width: 100%;
  max-width: 720px;
}

/* ===================== Process Card ===================== */
.process-card {
  background: white;
  border-radius: 18px;
  padding: clamp(22px, 4vw, 45px);
  box-shadow: 0 10px 40px rgba(18, 126, 118, 0.12);
}

.process-card-title {
  color: #dc3545;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 700;
  margin-bottom: clamp(20px, 3vw, 30px);
}

.section-subtitle {
  color: #1a1a1a;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 700;
  margin-bottom: 18px;
}

/* ===================== Info Grid ===================== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-bottom: clamp(22px, 3vw, 30px);
}

.info-field {
  display: flex;
  flex-direction: column;
}

.info-field label {
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.info-field.required label::after {
  content: ' *';
  color: #dc3545;
}

.info-field input {
  padding: 12px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #333;
  background: #f8f9fa;
  transition: all 0.25s;
}

.info-field input:focus {
  outline: none;
  border-color: #127e76;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(18, 126, 118, 0.1);
}

.info-field.full-width {
  grid-column: 1 / -1;
}

.info-field select {
  padding: 12px 40px 12px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #333;
  background-color: #f8f9fa;
  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='%23127e76' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all 0.25s;
}

.info-field select:focus {
  outline: none;
  border-color: #127e76;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(18, 126, 118, 0.1);
}

.info-field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.specialite-field {
  margin-bottom: clamp(22px, 3vw, 30px);
  width: 100%;
}

.specialite-field select {
  width: 100%;
}

/* Email/select full width fixes */
.info-field input,
.info-field select {
  width: 100%;
  display: block;
}

/* Prevent select from visually colliding with next card */
.payment-box {
  margin-top: 0;
}

/* ===================== Payment Box (montant) ===================== */
.payment-box {
  background: #dc3545;
  border-radius: 12px;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(22px, 3vw, 30px);
}

.payment-box .label {
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
}

.payment-box .amount {
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
}

/* ===================== Payment Method ===================== */
.payment-method {
  margin-bottom: clamp(22px, 3vw, 30px);
}

.operator-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

.operator-card {
  position: relative;
  padding: 1.2rem 1rem;
  border: 3px solid #e0e0e0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.operator-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.operator-card:focus-visible {
  outline: 2px solid #127e76;
  outline-offset: 2px;
}

.operator-card.active {
  border-color: currentColor;
}

.operator-card.orange {
  color: #FF6600;
}

.operator-card.orange.active {
  background: linear-gradient(135deg, rgba(255, 102, 0, 0.1), rgba(255, 102, 0, 0.05));
}

.operator-card.mtn {
  color: #FFCC00;
}

.operator-card.mtn.active {
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.15), rgba(255, 204, 0, 0.05));
}

.operator-logo {
  width: clamp(60px, 10vw, 90px);
  height: clamp(60px, 10vw, 90px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.operator-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.operator-name {
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  color: #333;
}

/* ===================== Phone Input ===================== */
.phone-input-group {
  position: relative;
}

.phone-label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 600;
  font-size: 0.9rem;
}

.phone-label::after {
  content: ' *';
  color: #dc3545;
}

.phone-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.operator-icon {
  position: absolute;
  left: 0.8rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
  opacity: 0;
  transform: scale(0.8);
  overflow: hidden;
  background: white;
  padding: 3px;
}

.operator-icon.show {
  opacity: 1;
  transform: scale(1);
}

.operator-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.phone-input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 4.2rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  transition: all 0.25s ease;
  outline: none;
  letter-spacing: 0.5px;
  background: #f8f9fa;
}

.phone-input:disabled {
  cursor: not-allowed;
  color: #999;
}

.phone-input:not(:disabled) {
  background: white;
}

.phone-input:focus {
  box-shadow: 0 0 0 3px rgba(18, 126, 118, 0.12);
}

.phone-input.orange-border {
  border-color: #FF6600;
}

.phone-input.mtn-border {
  border-color: #FFCC00;
}

.error-message {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

.error-message.show {
  display: block;
}

/* ===================== Confirmation Checkbox ===================== */
.confirmation-check {
  margin-bottom: clamp(22px, 3vw, 28px);
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}

.checkbox-container input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  min-width: 22px;
  height: 22px;
  background-color: #fff;
  border: 2px solid #ddd;
  border-radius: 5px;
  position: relative;
  transition: all 0.25s;
  flex-shrink: 0;
}

.checkbox-container:hover .checkmark {
  border-color: #127e76;
}

.checkbox-container input:checked ~ .checkmark {
  background-color: #127e76;
  border-color: #127e76;
}

.checkmark:after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-label {
  color: #555;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ===================== Pay Button ===================== */
#paymentForm {
  display: flex;
}

.btn-pay {
  width: 100%;
  padding: 1.1rem;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-pay.orange {
  background: linear-gradient(135deg, #FF6600, #FF8833);
}

.btn-pay.mtn {
  background: linear-gradient(135deg, #FFCC00, #FFD633);
  color: #000;
}

.btn-pay.default {
  background: linear-gradient(135deg, #127e76, #1AA09F);
}

.btn-pay:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

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

/* ===================== Error / Success toasts ===================== */
.error-card,
.success-card {
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 18px;
  font-weight: 600;
  text-align: center;
}

.error-card {
  background-color: #fdecea;
  color: #c0392b;
  border: 1px solid #f5c6c0;
}

.success-card {
  background-color: #edf7ed;
  color: #2f855a;
  border: 1px solid #c6f6d5;
}

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
  header {
    padding: 18px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .logo-section {
    width: 100%;
  }

  .lang-selector {
    align-self: flex-start;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .operator-selection {
    gap: 12px;
  }

  .payment-box {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .operator-selection {
    grid-template-columns: 1fr;
  }

  .operator-card {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }

  .operator-logo {
    width: 50px;
    height: 50px;
  }

  .process-card-title {
    font-size: 16px;
  }
}