/* The pickers are radio groups named by their legends, so each fieldset is stripped back to the field it replaced */
#setono-gift-card-information .setono-gift-card-design-fieldset,
#setono-gift-card-information .ssgc-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

#setono-gift-card-information .setono-gift-card-design-fieldset > legend,
#setono-gift-card-information .ssgc-fieldset > legend {
    display: block;
    margin: 0 0 0.28571429rem;
    padding: 0;
    font-size: 0.92857143em;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.87);
}

#setono-gift-card-information [data-js-gift-card-design-picker] {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#setono-gift-card-information .setono-gift-card-design-choice {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px;
}

/* Which design is picked has to be visible on the choice itself; the native radio dot alone is easy to miss */
#setono-gift-card-information .setono-gift-card-design-choice:has(input:checked) {
    border-color: #2185d0;
    background: rgba(33, 133, 208, 0.08);
}

#setono-gift-card-information .setono-gift-card-design-choice:focus-within {
    outline: 2px solid #2185d0;
    outline-offset: 2px;
}

#setono-gift-card-information .setono-gift-card-design-choice input {
    margin-bottom: 4px;
}

#setono-gift-card-information .setono-gift-card-design-choice img {
    max-width: 120px;
    height: auto;
    border-radius: 4px;
}

#setono-gift-card-information .ssgc-message-counter {
    display: block;
    margin-top: 0.35em;
    font-size: 0.85em;
    color: #6c757d;
    text-align: right;
}

/* Live preview: the shared .ssgc-card is a fixed 560x396 box scaled to fit this frame */
#setono-gift-card-information .ssgc-preview {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}

#setono-gift-card-information .ssgc-preview__frame {
    position: relative;
    width: 100%;
    padding-bottom: 70.71%; /* 396 / 560 */
    overflow: hidden;
    border-radius: 14px;
    background: #1c1b18;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

#setono-gift-card-information .ssgc-preview__frame .ssgc-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 560px;
    height: 396px;
    transform-origin: top left;
}

/*
 * The plugin's gift card product page (shop/product/show.html.twig), laid out like Sylius' product page so the shop's
 * theme styles its grid, its header and its button the same way. Its own parts are styled below, through the id the
 * page carries, which also wins over the theme's rules for the children of the product page's second column
 */

/* Next to a long form the preview stays in view while the customer fills it in. Stacked, the column is only as tall
   as the preview, so there is nothing to stick to */
#setono-gift-card-information.ssgc-product .ssgc-preview {
    position: sticky;
    top: 1.5rem;
}

#setono-gift-card-information.ssgc-product .ssgc-product__short-description {
    margin: 0.75em 0 0 !important;
    font-size: 1.1em;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.68);
}

#setono-gift-card-information.ssgc-product .ssgc-product__add-to-cart {
    margin: 1.5rem 0 0 !important;
}

#setono-gift-card-information.ssgc-product .ssgc-fieldset {
    margin-bottom: 1em;
}

/* Each delivery type is a choice the size of a button, with the native radio kept visible and in the tab order */
#setono-gift-card-information .ssgc-delivery__choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.5rem;
}

/* Important, as Sylius' default theme makes every label an inline block without padding (label { ... !important }) */
#setono-gift-card-information .ssgc-delivery__choice {
    display: flex !important;
    align-items: center;
    gap: 0.6em;
    margin: 0;
    padding: 0.85em 1em !important;
    border: 2px solid rgba(34, 36, 38, 0.15);
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.3;
}

/* The same selected and focused states as the design picker */
#setono-gift-card-information .ssgc-delivery__choice:has(input:checked) {
    border-color: #2185d0;
    background: rgba(33, 133, 208, 0.08);
}

#setono-gift-card-information .ssgc-delivery__choice:focus-within {
    outline: 2px solid #2185d0;
    outline-offset: 2px;
}

#setono-gift-card-information .ssgc-delivery__choice input {
    flex: none;
    margin: 0;
}

#setono-gift-card-information .ssgc-delivery__choice .icon {
    flex: none;
    margin: 0;
    height: auto;
    font-size: 1.25em;
    color: rgba(0, 0, 0, 0.6);
}

/* A quantity is a number of a few digits, so its field does not need the column's whole width. As a block it stays
   below its label, which Sylius' default theme makes an inline block */
#setono-gift-card-information.ssgc-product input[name$="[cartItem][quantity]"] {
    display: block;
    max-width: 8em;
}

.ssgc-product__description {
    margin-top: 3rem;
}
