/* ds-modal.css — Shared modal dialog styles. Use via <DsModal /> component. */

/* Overlay */
.ds-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--ds-color-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--ds-z-modal);
    cursor: pointer;
}

/* Dialog card */
.ds-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 500px;
    max-width: calc(100vw - var(--ds-spacing-2xl));
    max-height: calc(100vh - 64px);
    background: var(--ds-color-bg-card);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-modal);
    overflow: hidden;
    cursor: default;
}

.ds-modal--wide {
    width: 800px;
}

/* Header — grey background variant (text-edit, selection dialogs) */
.ds-modal .ds-modal-header {
    display: flex;
    flex-direction: column;
    padding: var(--ds-spacing-lg) var(--ds-spacing-xl);
    padding-right: 56px;
    background: var(--ds-color-bg-card-hover);
}

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

.ds-modal .ds-modal-header p {
    margin: 0;
    font-size: var(--ds-font-size-sm);
    line-height: 21px;
    color: var(--ds-color-text-secondary);
}

/* Close button — positioned inside modal via DsCloseButton */
.ds-modal .ds-close-btn {
    position: absolute;
    right: var(--ds-spacing-sm);
    top: var(--ds-spacing-sm);
}

/* Header — icon variant (confirmation dialogs) */
.ds-modal .ds-modal-icon-header {
    display: flex;
    flex-direction: row;
    padding: var(--ds-spacing-xl);
    gap: var(--ds-spacing-xl);
}

.ds-modal .ds-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
}

.ds-modal .ds-modal-icon--danger {
    background: var(--ds-color-icon-bg-danger);
    color: var(--ds-color-icon-danger);
}

.ds-modal .ds-modal-icon--warning {
    background: var(--ds-color-bg-warning);
    color: var(--ds-color-icon-warning-bright);
}

.ds-modal .ds-modal-icon-header .ds-modal-icon-text {
    display: flex;
    flex-direction: column;
    gap: var(--ds-spacing-2xs);
    flex: 1;
    align-self: center;
}

.ds-modal .ds-modal-icon-text h3 {
    margin: 0;
    font-size: var(--ds-font-size-subtitle);
    font-weight: var(--ds-font-weight-bold);
    line-height: 27px;
    color: var(--ds-color-text-primary);
}

.ds-modal .ds-modal-icon-text p {
    margin: 0;
    font-size: var(--ds-font-size-body);
    line-height: 24px;
    color: var(--ds-color-text-primary);
}

/* Body — content area */
.ds-modal .ds-modal-body {
    padding: var(--ds-spacing-xl);
    overflow-y: auto;
    flex: 1 1 auto;
}

/* Actions — footer row */
.ds-modal .ds-modal-actions {
    display: flex;
    gap: var(--ds-spacing-md);
    justify-content: flex-end;
    align-items: center;
    padding: var(--ds-spacing-xl);
}

/* When icon-header directly precedes actions (no body), remove top padding */
.ds-modal .ds-modal-icon-header + .ds-modal-actions {
    padding-top: 0;
}

/* Link-styled cancel — only in confirmation dialogs (with ds-modal-icon-header) */
.ds-modal .ds-modal-icon-header ~ .ds-modal-actions .ds-modal-cancel {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: var(--ds-font-size-body);
    line-height: 24px;
    color: var(--ds-color-link);
    text-decoration: underline;
    cursor: pointer;
}

.ds-modal .ds-modal-icon-header ~ .ds-modal-actions .ds-modal-cancel:hover {
    color: var(--ds-color-link-hover);
}

/* Split actions — left button + right-aligned group */
.ds-modal .ds-modal-actions--split {
    justify-content: space-between;
}

/* Eshop modal overlays — pin to the eshop-modal tier.
   The eshop widget CSS loads at runtime from dek.cz with z-index values we don't
   control (branch: 10, under DsModal). The eshop ModalShell Teleports the modal
   layer to <body>, so the overlays are NOT descendants of the bridge mount nodes —
   pins must anchor to `body > .vue-*-modal`. At (0,2,1) they beat the eshop's
   `.vue-*-modal .overlay` (0,2,0) regardless of stylesheet load order. The mount-ID
   selectors are kept as a fallback in case the eshop drops the Teleport. */
body > .vue-branch-modal > .overlay,
body > .vue-login-modal > .overlay,
#branch-modal-app .overlay,
#vue-login-modal .overlay {
    z-index: var(--ds-z-eshop-modal);
}
