/* ==========================================================================
   Dispatch Express — Blocks Checkout Styles
   Follows WooCommerce Blocks design conventions.
   ========================================================================== */

/* ---------- Hide native WooCommerce shipping UI ---------- */
.wc-block-components-shipping-rates-control__no-results-notice,
.wc-block-components-shipping-rates-control__no-shipping-address-message,
.wc-block-components-shipping-rates-control__package {
    display: none !important;
}

/* Hide the "Shipping options" heading and description from shipping methods step */
.wp-block-woocommerce-checkout-shipping-methods-block .wc-block-components-checkout-step__heading,
.wp-block-woocommerce-checkout-shipping-methods-block .wc-block-components-checkout-step__description,
[data-block-name="woocommerce/checkout-shipping-methods-block"] .wc-block-components-checkout-step__heading,
[data-block-name="woocommerce/checkout-shipping-methods-block"] .wc-block-components-checkout-step__description {
    display: none !important;
}

/* Note: the Ship/Pickup toggle is controlled by WooCommerce local pickup settings.
   Do NOT hide it — the store may enable pickup at any time. */

/* Delivery instructions: show only in shipping address, hide from billing */
.wc-block-checkout__billing-fields .wc-block-components-address-form__dispatch-express-delivery-instructions {
    display: none !important;
}

/* ---------- Container ---------- */
.dispatch-express-blocks-fulfillment {
    margin: 0 0 1.5em;
    width: 100%;
}

/* Delivery option uses native WC radio-control-accordion-option classes — no custom styles */

/* ---------- Spinner positioned exactly over the radio input ---------- */
.dispatch-express-blocks-radio-pos {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    box-sizing: border-box;
}

/* ---------- Delivery details row (duration left, price right) ---------- */
.dispatch-express-blocks-delivery-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dispatch-express-blocks-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: dispatch-express-blocks-spin 0.7s linear infinite;
    top:16px;
    left:16px;
}

.dispatch-express-blocks-warning {

    top:12px;
    left:16px;
}
.dispatch-express-blocks-error {
    top:12px;
    left:16px;
}

@keyframes dispatch-express-blocks-spin {
    to { transform: rotate(360deg); }
}

/* Error / Warning — only tint the detail text, block size stays the same */
.dispatch-express-blocks-state--error .dispatch-express-blocks-delivery-details {
    color: #991b1b;
}

.dispatch-express-blocks-state--warning .dispatch-express-blocks-delivery-details {
    color: #92400e;
}

/* ---------- Tip Selector ---------- */
.dispatch-express-blocks-tip {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #fafafa;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease-out,
                margin 0.4s ease-out,
                padding 0.4s ease-out,
                border-color 0.3s ease-out;
}

.dispatch-express-blocks-tip--visible {
    max-height: 320px;
    opacity: 1;
    margin-top: 16px;
    padding: 16px;
    border-color: #ddd;
}

.dispatch-express-blocks-tip__header {
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 10px;
}

.dispatch-express-blocks-tip__options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dispatch-express-blocks-tip__btn {
    flex: 1 1 0;
    min-width: 70px;
    padding: 10px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
    text-align: center;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
    line-height: 1.3;
}

.dispatch-express-blocks-tip__btn:hover {
    border-color: #1e1e1e;
}

.dispatch-express-blocks-tip__btn--active {
    border-color: #1e1e1e;
    background: #1e1e1e;
    color: #fff;
}

.dispatch-express-blocks-tip__label {
    display: block;
}

.dispatch-express-blocks-tip__amount {
    display: block;
    font-size: 11px;
    font-weight: 400;
    margin-top: 2px;
    opacity: 0.7;
}

.dispatch-express-blocks-tip__btn--active .dispatch-express-blocks-tip__amount {
    opacity: 0.85;
}

.dispatch-express-blocks-tip__btn--custom {
    flex: 0 0 auto;
    min-width: auto;
    padding: 10px 16px;
}

/* ---------- Custom Tip Input ---------- */
.dispatch-express-blocks-tip__custom-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.dispatch-express-blocks-tip__currency {
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
}

.dispatch-express-blocks-tip__custom-input input[type="number"] {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.dispatch-express-blocks-tip__apply {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #1e1e1e;
    border-radius: 4px;
    background: #1e1e1e;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}

.dispatch-express-blocks-tip__apply:hover {
    opacity: 0.85;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .dispatch-express-blocks-tip__options {
        gap: 6px;
    }

    .dispatch-express-blocks-tip__btn {
        min-width: 60px;
        padding: 8px 6px;
        font-size: 13px;
    }
}
