/*
 * Custom code — Checkout Onepage (ns-onepage-checkout)
 * Integrado com a identidade visual do tema.
 * Guardar como UTF-8.
 */

/* ============================================================
   1. CHECKBOXES / RADIOS CUSTOMIZADOS (escopo isolado)
   ============================================================ */
#ns-onepage-checkout .container {
  padding-left: 50px;
  position: relative;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  text-align:left;
}

#ns-onepage-checkout .container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

#ns-onepage-checkout .checkmark {
  position: absolute;
  left: 15px;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background-color: #eee;
  transition: background-color 0.2s ease;
}

#ns-onepage-checkout .container:hover input ~ .checkmark {
  background-color: #ccc;
}

#ns-onepage-checkout .container input:checked ~ .checkmark {
  background: linear-gradient(90deg, #0043FE 0%, #2890FF 100%);
}

#ns-onepage-checkout .checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

#ns-onepage-checkout .container input:checked ~ .checkmark:after {
  display: block;
}

#ns-onepage-checkout .container .checkmark:after {
  left: 9px;
  top: 5px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 3px 3px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

/* ============================================================
   2. WRAPPER E SECÇÕES
   ============================================================ */
#ns-opc-wrapper section {
  border: 1px solid #e5e5e5;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #f9f9f9;
  border-radius: 20px;
  box-shadow: 0px 3px 6px #00000029;
}

#ns-opc-wrapper h2 {
  margin-top: 0;
  font-size: 1.4rem;
  color: #333;
  font-family: "TestSansBold", sans-serif;
}

#ns-onepage-checkout h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
  font-family: "TestSansBold", sans-serif;
}

/* ============================================================
   3. FORMULÁRIOS
   ============================================================ */
#ns-onepage-checkout .form-group label {
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #333;
}

#ns-onepage-checkout input[type="text"],
#ns-onepage-checkout input[type="email"],
#ns-onepage-checkout input[type="password"],
#ns-onepage-checkout input[type="tel"],
#ns-onepage-checkout select {
  border-radius: 10px;
  border: 1px solid #ddd;
  padding: 8px 12px;
  width: 100%;
  font-family: "TestSans", sans-serif;
}

#ns-onepage-checkout input:focus,
#ns-onepage-checkout select:focus {
  border-color: #0043FE;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 67, 254, 0.12);
}

/* ============================================================
   4. BOTÕES
   ============================================================ */
#ns-onepage-checkout .btn {
  min-width: 130px;
  border-radius: 16px;
  font-family: "TestSans", sans-serif;
  font-weight: 300;
  text-transform: capitalize;
  padding: 0 30px;
  height: 40px;
  transition: opacity 0.2s ease;
}

#ns-onepage-checkout .btn-primary {
  color: #fff;
  background: linear-gradient(90deg, #0043FE 0%, #2890FF 100%);
  border: 0;
}

#ns-onepage-checkout .btn-primary:hover {
  opacity: 0.9;
  color: #fff;
}

#ns-onepage-checkout .btn-secondary {
  color: #232323;
  background: #f6f6f6;
  border: 0;
}

/* ============================================================
   5. MORADAS
   ============================================================ */
.address-block {
  border: 1px solid #dee2e6;
  padding: 1rem;
  border-radius: 16px;
  margin-bottom: 1rem;
  background-color: #f9f9f9;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.address-block:hover {
  border-color: #0043FE;
  box-shadow: 0 0 0 2px rgba(0, 67, 254, 0.08);
}

.address-block label {
  display: block;
  cursor: pointer;
}

/* ============================================================
   6. TRANSPORTADORAS
   ============================================================ */
#shipping-section label,
#payment-section label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 16px;
  margin-bottom: 0.5rem;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#shipping-section label:hover,
#payment-section label:hover {
  border-color: #0043FE;
  background-color: #f0f4ff;
}

/* ============================================================
   7. PAGAMENTO
   ============================================================ */
.payment-options-list .payment-option {
  cursor: pointer;
  transition: border-color 0.3s;
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: #f8f9fa;
}

.payment-options-list .payment-option:hover {
  border-color: #0043FE;
}

.payment-option input[type="radio"] {
  margin-right: 0.5rem;
  accent-color: #0043FE;
}

/* ============================================================
   8. CARRINHO
   ============================================================ */
#cart-section .card {
  border: 1px solid #ddd;
  border-radius: 20px;
  box-shadow: 0px 3px 6px #00000029;
}

/* ============================================================
   9. CONDIÇÕES
   ============================================================ */
#conditions-section {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  padding: 1rem;
  border-radius: 16px;
}

/* ============================================================
   10. RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
  #ns-onepage-checkout {
    padding: 0.5rem;
  }
  #ns-onepage-checkout section {
    padding: 1rem;
  }
  #ns-onepage-checkout .btn {
    min-width: 100%;
    padding: 0 15px;
  }
}

/* ============================================================
   11. LOADER (corrigido — só aparece com .active)
   ============================================================ */
#checkout-loader {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

#checkout-loader.active {
  display: flex;
}

#checkout-loader::before {
  content: "";
  width: 3rem;
  height: 3rem;
  border: 4px solid #0043FE;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}