/* =============================================================================
   Unified Modal Shell
   Single source for the shared .modal lifecycle host used by all customer
   modals (prepare-to-ship, increase-bid, address, confirm). Content-specific
   rules live with their own feature CSS; only the generic shell + size
   variants belong here.
   ============================================================================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background-color: rgba(6, 8, 15, 0.85);
    padding: 0 calc(1.5 * var(--space));
    overflow-y: auto;
}

.modal .modal-content {
    width: min(520px, calc(100vw - 4 * var(--space)));
    max-height: calc(100vh - 4 * var(--space));
    /* dvh tracks the iOS Safari toolbar; vh line above is the fallback */
    max-height: calc(100dvh - 4 * var(--space));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--color-border-light);
    background: var(--color-bg-main);
    color: var(--color-text-primary);
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.85);
}

.modal .modal-header {
    padding: calc(1.25 * var(--space)) 1.25rem;
    background: var(--gradient-cat-card);
    border-bottom: 1px solid var(--color-border-lighter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
}

.modal .modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: var(--space);
    scroll-behavior: smooth;
}

.modal-close {
    font-size: 30px;
    line-height: 1;
    color: var(--color-text-primary);
    cursor: pointer;
    /* reset UA/theme <button> chrome so a <button> close matches a <span> one */
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
}

.modal-close:hover {
    color: var(--color-accent);
    background: transparent;
}

.modal-close:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space);
    padding: calc(1.25 * var(--space)) calc(1.25 * var(--space));
    border-top: 1px solid var(--color-border-lighter);
    margin-top: 0;
}

[data-theme="dark"] .modal .modal-actions {
    border-color: var(--color-border-dark);
}

/* -----------------------------------------------------------------------------
   Size variants
   ----------------------------------------------------------------------------- */

/* Prepare-to-Ship: wide, top-aligned (tall customs form). */
.modal.modal--pts {
    align-items: flex-start;
    padding-top: calc(2 * var(--space));
}

.modal.modal--pts .modal-content {
    width: min(920px, calc(100vw - 4 * var(--space)));
}

/* Confirm: compact centered dialog. */
.modal.modal--confirm .modal-content {
    width: min(440px, calc(100vw - 4 * var(--space)));
}

.modal.modal--confirm .modal-body.confirm-dialog {
    padding: calc(1.5 * var(--space)) 1.25rem;
    font-size: var(--font-size-md);
    line-height: 1.5;
}
