/* === Variáveis Globais === */
:root {
  --primary-color: #ffbc4e;
  --primary-color-hover: #f6b244;
  --background: #f9f5f0;
  --dark-gray: #343a40;
  --border-color: #ced4da;
  --light-gray: #999;
  --disabled-bg: #e9ecef;
  --error-color: #dc3545;
}

/* === Estilos Gerais === */
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--background);
  color: var(--dark-gray);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
}

/* === Estrutura Principal === */
.form-container {
  background-color: #ffffff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
  transition: all 0.3s ease-in-out;
}

.form-logo {
  display: block;
  max-width: 180px;
  height: auto;
  margin: 0 auto 30px;
}

/* === Tipografia === */
h1 {
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 1.8rem;
}

h2 {
  text-align: center;
  font-weight: 400;
  font-size: 1rem;
  color: #6c757d;
  margin-top: 0;
  margin-bottom: 30px;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
  margin-top: 40px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}

/* === Layout do Formulário === */
.form-group, .form-row {
  margin-bottom: 20px;
}

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

.form-row .form-group {
  margin-bottom: 0;
}

.quantity-group {
  max-width: 220px;
}

.form-row .quantity-group {
  flex: 1 1 0;
  max-width: none;
}

/* === Estilos dos Campos === */
input[type="text"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
  background-color: #fff;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 188, 78, 0.35);
}

input::placeholder,
textarea::placeholder {
  color: #aaa;
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
  background-color: var(--disabled-bg);
  cursor: not-allowed;
}

.optional-text {
  color: var(--light-gray);
  font-weight: 400;
}

/* === Caixa de Aviso Amarela === */
.form-warning-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  margin-top: 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #664d03;
  background-color: #fff3cd;
  border: 1px solid #ffecb5;
}

.warning-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
}

/* === Validação de Erro === */
.input-error {
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

.error-message {
  color: var(--error-color);
  font-size: 13px;
  margin-top: 5px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin-top 0.3s ease-out;
}

.error-message.active {
  max-height: 20px;
  opacity: 1;
}

/* === Componentes Específicos === */
.info-tooltip {
  position: relative;
  display: inline-block;
  margin-left: 10px;
  top: -2px;
}

.info-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background-color: var(--border-color);
  color: var(--dark-gray);
  font-weight: bold;
  font-size: 14px;
  cursor: help;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: 240px;
  background-color: var(--dark-gray);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 1;
  bottom: 150%;
  left: 50%;
  margin-left: -120px;
  font-size: 13px;
  line-height: 1.4;
  transition: opacity 0.3s;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--dark-gray) transparent transparent transparent;
}

.info-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 15px;
  font-size: 16px;
  font-weight: 600;
  color: var(--light-gray);
}

.input-with-icon input {
  padding-left: 40px; 
}

.iti {
  width: 100%;
}
.iti__country-list {
  font-family: 'Poppins', sans-serif;
}
.iti--allow-dropdown {
  border: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
}
.iti__selected-flag {
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.iti__input-container {
  margin-left: 10px;
}
.iti--container {
  z-index: 9999;
}

/* === Seletor de Tipo de Entrega === */
.hidden {
  display: none !important;
}

.delivery-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.delivery-fieldset legend {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 0;
}

.delivery-toggle-group {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.delivery-toggle-input {
  display: none;
}

.delivery-toggle-label {
  flex: 1;
  text-align: center;
  padding: 12px 15px;
  cursor: pointer;
  background-color: #f8f9fa;
  color: var(--dark-gray);
  transition: background-color 0.3s, color 0.3s;
  margin-bottom: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* CORREÇÃO APLICADA AQUI */
.delivery-toggle-label + .delivery-toggle-label {
  border-left: 1px solid var(--border-color);
}

.delivery-toggle-input:checked + .delivery-toggle-label {
  background-color: var(--primary-color);
  color: var(--dark-gray);
  font-weight: 600;
}

.delivery-toggle-label:hover {
  background-color: #e9ecef;
}

.delivery-toggle-input:checked + .delivery-toggle-label:hover {
  background-color: var(--primary-color-hover);
}

.toggle-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* === Modal de Confirmação === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 500px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: left;
}

.modal-content p {
  font-size: 15px;
  line-height: 1.6;
  color: #6c757d;
  margin-bottom: 25px;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  margin-bottom: 30px;
}

.checkbox-group input[type="checkbox"] {
  -webkit-appearance: auto;
  -moz-appearance: auto;
  appearance: auto;
  margin-top: 4px;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: 14px;
  font-weight: 400;
  margin-left: 10px;
  cursor: pointer;
}

/* === Estilos dos Botões === */
button {
  padding: 12px 25px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s, border-color 0.3s;
  border: 1px solid transparent;
}

#open-modal-btn {
  width: 100%;
  padding: 15px;
  color: var(--dark-gray);
  background-color: var(--primary-color);
  border: none;
  margin-top: 20px;
}

#open-modal-btn:hover {
  background-color: var(--primary-color-hover);
  transform: translateY(-2px);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

.modal-actions button {
  width: auto;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--dark-gray);
  border: none;
}
.btn-primary:hover {
  background-color: var(--primary-color-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #fff;
  color: var(--dark-gray);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #f8f9fa;
  border-color: #adb5bd;
}

button:disabled {
  background-color: var(--disabled-bg) !important;
  border-color: var(--disabled-bg) !important;
  color: var(--light-gray) !important;
  cursor: not-allowed;
  transform: none;
}

/* === Estilos da Tela de Sucesso Dinâmica === */
.success-content {
  text-align: center;
}
.success-content p {
  font-size: 1.1rem;
  color: #6c757d;
  margin-bottom: 30px;
  margin-top: 10px; 
}
.success-content a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}
  .success-content a:hover {
  text-decoration: underline;
}
.success-content .form-logo {
   margin: 0 auto 30px;
}


/* === Responsividade === */
@media (min-width: 768px) {
  .form-row {
    flex-direction: row;
  }
  
  .form-row .form-group {
    flex: 1 1 0; 
  }

  .form-row .cep-group {
    flex: 0 1 160px;
  }
}

@media (max-width: 480px) {
  .tooltip-text {
    width: auto;
    max-width: calc(100vw - 30px);
    left: auto;
    right: 0;
    margin-left: 0;
    transform: none;
  }
  .tooltip-text::after {
    left: auto;
    right: 8px;
    margin-left: 0;
  }
}