#deliveryplz-modal {
    --rf-deliveryplz-brand: #ff4900;
    --rf-deliveryplz-brand-soft: rgba(255, 73, 0, 0.08);
    --rf-deliveryplz-border: #ded8d5;
    --rf-deliveryplz-text: #372b27;
    --rf-deliveryplz-muted: #6d6461;
}

#deliveryplz-modal .modal-dialog {
    max-width: 520px;
    margin: 1.5rem auto;
}

#deliveryplz-modal .modal-content {
    border-radius: 28px;
    border: none;
    background: #fff;
    padding: 2.25rem 2rem;
    color: var(--rf-deliveryplz-text);
    box-shadow: 0 25px 50px rgba(55, 43, 39, 0.35);
    position: relative;
}

#deliveryplz-modal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 28px 28px 0 0;
    background: linear-gradient(90deg, var(--rf-deliveryplz-brand), rgba(255, 73, 0, 0.55));
    pointer-events: none;
}

.deliveryplz-modal-body {
    text-align: center;
}

.deliveryplz-section {
    border: none;
    border-radius: 22px;
    padding: 1.5rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    background: rgba(255, 73, 0, 0.02);
}

.deliveryplz-section + .deliveryplz-section {
    margin-top: 1.75rem;
}

.deliveryplz-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.deliveryplz-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    color: rgba(55, 43, 39, 0.72);
    font-weight: 600;
    padding: 0;
    margin: -0.25rem auto 0.75rem;
}

.deliveryplz-back i {
    color: rgba(55, 43, 39, 0.6);
}

.deliveryplz-back:hover {
    color: var(--rf-deliveryplz-text);
    text-decoration: underline;
}

.deliveryplz-back:focus-visible {
    outline: 3px solid rgba(255, 73, 0, 0.35);
    outline-offset: 4px;
    border-radius: 10px;
}

.deliveryplz-toggle,
.deliveryplz-time-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.deliveryplz-time-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.deliveryplz-time-toggle button {
    width: 100%;
}

.deliveryplz-toggle button,
.deliveryplz-time-toggle button {
    border-radius: 14px;
    border: 1px solid var(--rf-deliveryplz-border);
    background: #fff;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--rf-deliveryplz-text);
    transition: all 0.2s ease;
    box-shadow: 0 5px 15px rgba(55, 43, 39, 0.07);
}

.deliveryplz-time-toggle button[data-time-choice="asap"] {
    min-width: 150px;
}

.deliveryplz-time-toggle.deliveryplz-only-later {
    grid-template-columns: 1fr;
}

.deliveryplz-time-toggle.deliveryplz-only-later [data-time-choice="asap"] {
    display: none;
}

.deliveryplz-toggle button small {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--rf-deliveryplz-muted);
}

.deliveryplz-toggle button.is-active,
.deliveryplz-time-toggle button.is-active {
    background: var(--rf-deliveryplz-brand);
    border-color: var(--rf-deliveryplz-brand);
    color: #fff;
    box-shadow: 0 10px 22px rgba(255, 73, 0, 0.35);
}

.deliveryplz-toggle button.is-active small {
    color: #fff;
    opacity: 0.9;
}

.deliveryplz-toggle button:focus-visible,
.deliveryplz-time-toggle button:focus-visible {
    outline: 3px solid rgba(255, 73, 0, 0.35);
    outline-offset: 2px;
}

.deliveryplz-input-group {
    display: flex;
    align-items: stretch;
    border-radius: 18px;
    border: 1px solid var(--rf-deliveryplz-border);
    overflow: hidden;
    margin-top: 0.75rem;
    background: #fff;
}

.deliveryplz-input-group span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    color: var(--rf-deliveryplz-brand);
    background: var(--rf-deliveryplz-brand-soft);
}

.deliveryplz-input-group .form-control {
    border: none;
    font-size: 1.05rem;
    letter-spacing: 0.1em;
    text-align: center;
    font-weight: 600;
    color: var(--rf-deliveryplz-text);
}

.deliveryplz-input-group .form-control:focus {
    box-shadow: none;
}

.deliveryplz-input-group button {
    border: none;
    background: var(--rf-deliveryplz-brand);
    color: #fff;
    padding: 0 1.25rem;
}

.deliveryplz-helper {
    font-size: 0.9rem;
    color: var(--rf-deliveryplz-muted);
    margin-top: 0.6rem;
}

.deliveryplz-planned {
    border: 1px solid var(--rf-deliveryplz-border);
    border-radius: 16px;
    padding: 1rem;
    background: rgba(255, 73, 0, 0.05);
    margin-top: 1rem;
    display: none;
}

.deliveryplz-planned .form-select {
    border-radius: 12px;
    border-color: var(--rf-deliveryplz-border);
}

.deliveryplz-note {
    margin-top: 1.25rem;
    font-size: 0.95rem;
    color: var(--rf-deliveryplz-muted);
}

[data-deliveryplz-timepicker].deliveryplz-timepicker-locked .btn-timepicker {
    pointer-events: none;
    opacity: 0.55;
    cursor: not-allowed;
}

[data-deliveryplz-timepicker].deliveryplz-timepicker-locked::after {
    content: none !important;
    display: none !important;
}

@media (min-width: 576px) {
    #deliveryplz-modal .modal-dialog {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: calc(100% - 3rem);
        margin: 0 auto;
    }

    #deliveryplz-modal .modal-content {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    #deliveryplz-modal {
        --bs-modal-margin: 1.5rem;
    }

    #deliveryplz-modal .modal-dialog {
        /* Hard-center on mobile (robust against Bootstrap/custom overrides) */
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;

        width: calc(100% - 2.5rem) !important;
        max-width: 420px !important;
        margin: 0 !important;

        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
        pointer-events: auto;
    }

    #deliveryplz-modal .modal-dialog.modal-dialog-centered {
        /* Keep centered behavior (we position the dialog itself) */
        min-height: auto !important;
    }

    #deliveryplz-modal .modal-content {
        border-radius: 22px;
        min-height: auto;
    }

    .deliveryplz-toggle button,
    .deliveryplz-time-toggle button {
        min-width: 110px;
    }

    .deliveryplz-time-toggle button[data-time-choice="asap"] {
        min-width: 140px;
    }
}
