.atop-carriers-wrap {
  margin: 0 0 18px 0;
  /* padding: 14px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px; */
}

.atop-carriers-title {
  margin: 0 0 12px 0;
}

/* Carrier radios exist but are invisible */
.atop-carrier-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Carriers as responsive flex boxes */
.atop-carriers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

/* Carrier card layout: vertical */
.atop-carrier-card {
  flex: 1 1 180px;
  min-width: 180px;

  display: flex;
  flex-direction: column;      /* name on top, logo below */
  align-items: center;
  gap: 8px;

  padding: 6px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  height: 100%;
  text-align: center;
  justify-content: space-between;
}

/* Carrier name on top */
.atop-carrier-name {
  font-family: "Comfortaa", sans-serif;
  font-weight: 900;
  line-height: 1.2;
}

/* Rectangular carrier logo below the name */
.atop-carrier-logo {
  width: 100%;                 /* full card width */
  max-width: 160px;
  height: 32px;                /* rectangular shape */
  border-radius: 6px;          /* softer rectangle */
}
.atop-carrier-logo img {
  height: 100%!important;
  width: auto!important;
}

.atop-delivery-options {
  margin-top: 14px;
}

.atop-delivery-options__group {
  flex-direction: column;
  gap: 10px;
}

.atop-delivery-options__title {
  margin: 0 0 10px 0;
  font-weight: 600;
}

.atop-option-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.atop-option-label {
  display: block;
  padding: 12px;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  cursor: pointer;
}

.atop-option-radio:checked + .atop-option-label {
  border: none;
  outline: 2px solid rgba(109,171,60, .8);
  box-shadow: inset 0 0 7px rgba(109,171,60, .2);
  transform: scale(1.01);
  color: #D60057;
}

/* You asked for :selected - note: :selected applies to <option> elements, not radios */
.atop-carriers-wrap input:selected + label {
  outline: 2px solid rgba(0,0,0,.2);
}

.atop-sz-wrap {
  margin-top: 12px;
}

.atop-sz-wrap .selectize-control {
  width: 100%;
}

/* OPTION C layout support:
   - Desktop stays identical: options appear under the whole grid (forced to bottom via order)
   - Mobile: options appear directly under the carrier card (natural document order)
*/

/* Desktop/default: push any visible delivery group to the end of the flex grid */
.atop-carriers-grid .atop-delivery-options__group {
  flex: 1 1 100%;
  order: 9999;
  margin-top: 10px;
  max-width: 100%!important;
}

/* Selectize styling */
.selectize-input {
  padding: 12px!important;
  border: 1px solid #d4d4d4!important;
  border-radius: 5px!important;
  background-color: transparent!important;
}
.selectize-dropdown-content .option {
  padding: 6px!important;
  cursor: pointer!important;
}
.selectize-dropdown-content .option.active {
  color: #ffffff!important;
  background-color: rgba(214,59,116, 1)!important;
}
.selectize-dropdown-content .option.selected .highlight, .selectize-dropdown-content .option.active .highlight {
  color: #ffffff!important;
  font-weight: bold!important;
  background-color: #6dab3c!important;
  outline: 1px solid rgba(255,255,255, .5)!important;
  padding: 2px!important;
  border-radius: 5px!important
}
.selectize-dropdown-content .option .highlight {
  background-color: #6dab3c!important;
  outline: 1px solid rgba(255,255,255, .5)!important;
  font-weight: bold!important;
  color: #ffffff!important;
  padding: 2px!important;
  border-radius: 5px!important;
}
.atop-sz-select .required {
  color: #000000!important;
  font-weight: normal!important;
  border: 1px solid #d4d4d4!important;
}

/* BEGIN Dropdown & Selectize hacks */

.checkout .atop-carriers-wrap .atop-delivery-options__group .atop-option .atop-sz-select .required {
  border: 1px solid #d4d4d4!important;
  background-color: #ffffff!important;
}

.checkout #customer_details #billing_city_field .selectize-input.not-full {
  padding: 0!important;
}
.checkout #customer_details #billing_city_field .selectize-input.full {
  padding: 12px!important;
}

.checkout #customer_details #billing_state_field .select2-container .select2-selection--single {
  height: auto!important;
  padding: 8px!important;
  background-color: #ffffff!important;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
  border: 1px solid #d4d4d4;
}
.checkout #customer_details #billing_state_field .select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 8px;
  right: 8px;
}
.checkout #customer_details #billing_state_field .select2-container--default .select2-search--dropdown .select2-search__field, .checkout #customer_details #billing_state_field .select2-container .select2-selection--single input[type="text"] {
  background-color: #ffffff!important;
}
.checkout #customer_details .selectize-input {
  overflow: inherit!important;
}
/* END Dropdown & Selectize hacks */

/* BEGIN form design */
.woocommerce form.checkout input[type=text], .woocommerce form.checkout input[type=email], .woocommerce form.checkout textarea  {
  padding: 12px!important;
  border: 1px solid #d4d4d4!important;
  border-radius: 5px!important;
  background-color: #ffffff!important;
}
.woocommerce form.checkout input[type=tel]  {
  padding: 12px 12px 12px 52px!important;
  border: 1px solid #d4d4d4!important;
  border-radius: 5px!important;
  background-color: #ffffff!important;
}
.woocommerce form.checkout .selectize-control .selectize-input input[type=text]  {
  padding: 0!important;
  border: none!important;
  border-radius: none!important;
  background-color: transparent!important;
  margin-left: 12px!important
}
.woocommerce form .form-row .input-text {
  background-color: #ffffff;
}
/* END form design */

/* BEGIN Shipping prices */

.atop-option-label {
  position: relative;
  padding-right: 110px; /* reserve room for icon + rate badge */
}

.atop-option-rate-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.9;
}

.atop-option-icon {
  right: 10px; /* keep icon in the far-right corner */
}

/* END Shipping prices */

/* Mobile */
@media (max-width: 520px) {
  .atop-carrier-card {
    min-width: 100%;
    flex-basis: 100%;
  }
  /* Mobile: show group under its carrier card (remove the forced ordering) */
  .atop-carriers-grid .atop-delivery-options__group {
    order: 0;
    margin-top: 10px;
  }
}