/* Hide the theme's native Add to Cart at first paint.
   Proper fix is swapping the product.info.addtocart template server-side, talk to DS */
.catalog-product-view .box-tocart {
    display: none;
}

.dealer-buy-button {
    /* Shared row height: the tallest entry is the Geissele/self row, whose
       "Add to Cart" label wraps to a second line. Every row and the trigger
       button match it. */
    --dealer-buy-button-row-height: 65px;

    position: relative;
    display: block;
    margin-top: 15px;
    width: 100%;
    max-width: 400px;
}

/* Add margin between the button and the rest of the form */
.form-container.form-state.has-dealer-buy-button {
    margin-top: 20px;
}

.dealer-buy-button__disclaimer {
    display: block;
    margin: 0 0 5px;
    color: #9b9b9b;
    font-size: 11px;
    font-style: italic;
    line-height: 1.3;
}

.dealer-buy-button__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: var(--dealer-buy-button-row-height);
    padding: 12px 16px;
    background: #cd0014;
    border: 1px solid #cd0014;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.dealer-buy-button__trigger:hover,
.dealer-buy-button__trigger:focus {
    background: #a80011;
    border-color: #a80011;
}

.dealer-buy-button__trigger-label {
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 19px;
}

.dealer-buy-button__caret {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fff;
    transition: transform 0.15s ease;
}

.dealer-buy-button__trigger[aria-expanded="true"] .dealer-buy-button__caret {
    transform: rotate(180deg);
}

.dealer-buy-button__list {
    list-style: none;
    margin: -1px 0 0;
    padding: 0;
    width: 100%;
}

.dealer-buy-button__item {
    margin: 0;
    border: 1px solid #d8d8d8;
    border-top: none;
    background: linear-gradient(180deg, #ffffff 0%, #f2f2f2 100%);
}

.dealer-buy-button__link {
    display: grid;
    grid-template-columns: 62px 1fr;
    column-gap: 8px;
    align-items: center;
    position: relative;
    padding: 12px 14px;
    min-height: var(--dealer-buy-button-row-height);
    text-decoration: none;
    transition: background 0.15s ease;
}

.dealer-buy-button__link:hover,
.dealer-buy-button__link:focus {
    background: linear-gradient(180deg, #fafafa 0%, #ececec 100%);
}

.dealer-buy-button__badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.dealer-buy-button__badge-check {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgb(74, 127, 53);
}

.dealer-buy-button__badge-check::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dealer-buy-button__badge-text {
    color: rgb(74, 127, 53);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-align: center;
    white-space: normal;
}

.dealer-buy-button__logo-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-left: 1px solid #e4e4e4;
}

.dealer-buy-button__logo {
    display: block;
    max-width: 100%;
    max-height: 32px;
    width: auto;
    height: auto;
}

.dealer-buy-button__link--text {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.dealer-buy-button__link--self,
.dealer-buy-button__link--self:hover,
.dealer-buy-button__link--self:focus,
.dealer-buy-button__link--self:active {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    font-size: 14px;
}

.dealer-buy-button__link--self:hover,
.dealer-buy-button__link--self:focus {
    background: linear-gradient(180deg, #fafafa 0%, #ececec 100%);
}

.dealer-buy-button__link--self .dealer-buy-button__logo {
    max-height: 27px;
}

/* Cart icon for Geissele */
.dealer-buy-button__badge-icon {
    display: block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a7f35' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dealer-buy-button__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: rgb(74, 127, 53);
    border-radius: 50%;
    animation: dealer-buy-button-spin 0.6s linear infinite;
}

/* While adding, the spinner takes the cart icon's place inline */
.dealer-buy-button__link--self.is-loading {
    cursor: default;
}

.dealer-buy-button__link--self.is-loading .dealer-buy-button__badge-icon {
    display: none;
}

.dealer-buy-button__link--self.is-loading .dealer-buy-button__spinner {
    display: block;
}

@keyframes dealer-buy-button-spin {
    to {
        transform: rotate(360deg);
    }
}
