/*
 * Gift certificate checkout module.
 *
 * Falls back to literal values so the module also looks right on the cart page and on the
 * classic checkout, where the optimized-checkout custom properties are not in scope.
 */
.gp-gift-certificate-form {
    margin: 0 0 1.5rem;
    border: 1px solid var(--gp-checkout-border, #c7ccce);
    border-radius: var(--gp-checkout-radius, .6rem);
    background: #fff;
    overflow: hidden;
}

.gp-gift-cert-heading {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
}

.gp-gift-cert-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    margin: 0;
    padding: 1rem 1.1rem;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.gp-gift-cert-toggle:hover .gp-gift-cert-toggle__label,
.gp-gift-cert-toggle:hover .gp-gift-cert-toggle__icon {
    color: var(--gp-checkout-accent, #61696d);
}
.gp-gift-cert-toggle:focus-visible {
    outline: 2px solid var(--gp-checkout-accent, #61696d);
    outline-offset: -2px;
}
.gp-gift-cert-toggle__label {
    font-size: 1.05em;
    font-weight: 700;
}
.gp-gift-cert-toggle__hint {
    flex: 1 1 auto;
    color: #61696d;
    font-size: .95em;
}
.gp-gift-cert-toggle__icon {
    flex: 0 0 auto;
    width: .55em;
    height: .55em;
    margin-right: .15rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform .15s ease;
}
.gp-gift-cert-toggle[aria-expanded="true"] .gp-gift-cert-toggle__icon {
    transform: rotate(-135deg);
}

.gp-gift-cert-panel {
    padding: 0 1.1rem 1.25rem;
    border-top: 1px solid var(--gp-checkout-border, #c7ccce);
}
.gp-gift-cert-panel[hidden] {
    display: none;
}

.gp-gift-cert-instructions {
    margin: 1rem 0 0;
    font-size: inherit;
    line-height: 1.5;
}

.gp-gift-cert-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
    margin: 1.25rem 0 0;
}
.gp-gift-cert-field {
    display: block;
}
.gp-gift-cert-field--number {
    flex: 1 1 12rem;
    min-width: 10rem;
}
.gp-gift-cert-label {
    display: block;
    margin-bottom: .35rem;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

/* Defined locally rather than relying on the active theme providing it. */
.gp-gift-certificate-form .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.gp-gift-cert-date {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.gp-gift-cert-date__sep {
    color: #8c969a;
}

.gp-gift-cert-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.9rem;
    padding: .45rem .65rem;
    border: 1px solid var(--gp-checkout-border, #c7ccce);
    border-radius: .4rem;
    background: #fff;
    font: inherit;
    line-height: 1.3;
}
.gp-gift-cert-input:focus {
    border-color: var(--gp-checkout-accent, #61696d);
    box-shadow: 0 0 0 3px rgba(97, 105, 109, .16);
    outline: 0;
}
.gp-gift-cert-input--mm,
.gp-gift-cert-input--dd {
    width: 3.6em;
    text-align: center;
}
.gp-gift-cert-input--yyyy {
    width: 5.2em;
    text-align: center;
}

.gp-gift-cert-actions {
    margin: 1.25rem 0 0;
}
#gp-apply-gift-cert {
    border-radius: .45rem;
    font-size: inherit;
}

.gp-gift-cert-messages:not(:empty) {
    margin-top: 1rem;
}
.gp-gift-cert-messages .gp-message {
    margin: 0;
    padding: .7rem .85rem;
    border-radius: .45rem;
    font-size: inherit;
}
.gp-gift-cert-messages .gp-message-success {
    border: 1px solid #c3e6cb;
    background-color: #d4edda;
    color: #155724;
}
.gp-gift-cert-messages .gp-message-error {
    border: 1px solid #f5c6cb;
    background-color: #f8d7da;
    color: #721c24;
}

/* Remove link on gift certificate rows */
.gp-remove-gift-cert {
    margin-left: .5em;
    color: #a00;
    font-size: .85em;
    text-decoration: none;
    cursor: pointer;
}
.gp-remove-gift-cert:hover {
    color: #dc3232;
    text-decoration: underline;
}
.gp-remove-gift-cert.processing {
    opacity: .5;
    pointer-events: none;
}

/* Apply gift certificate button loading animation */
#gp-apply-gift-cert.processing {
    position: relative;
    opacity: .7;
    pointer-events: none;
}
#gp-apply-gift-cert.processing::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    vertical-align: middle;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gp-spin .6s linear infinite;
}

@keyframes gp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 30rem) {
    .gp-gift-cert-field--number {
        flex-basis: 100%;
    }
    .gp-gift-cert-toggle__hint {
        display: none;
    }
}
