/* Shared overlay backdrop */
.dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    padding: var(--page-gutter);
}

/* Dialog card */
.dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.2);
    padding: 1.75rem;
    width: 100%;
    max-width: 30rem;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dialog h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.dialog p {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    margin: 0;
}

.dialog h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0.25rem 0 0;
}

.dialog pre {
    font-size: 0.75rem;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--color-text);
    margin: 0;
}

.dialog ul {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    padding-left: 1.25rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Action buttons (confirm / cancel / close) — scoped to IDs to avoid overriding component buttons */
.dialog #close-dialog,
.dialog #confirm-btn,
.dialog #cancel-btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background 0.15s ease, opacity 0.15s ease;
    align-self: flex-end;
    display: inline-flex;
}

/* Primary / confirm button */
.dialog #close-dialog,
.dialog #confirm-btn {
    background: var(--color-primary);
    color: #fff;
    margin-top: 0.25rem;
}

.dialog #close-dialog:hover,
.dialog #confirm-btn:hover {
    background: var(--color-primary-dark);
}

/* Secondary / cancel button */
.dialog #cancel-btn {
    background: var(--color-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    margin-top: 0.25rem;
    margin-right: 0.5rem;
}

.dialog #cancel-btn:hover {
    background: var(--color-border);
}

/* When both confirm and cancel are present, put them in a row on the right */
.dialog:has(#confirm-btn) .dialog,
.dialog #confirm-btn ~ #cancel-btn {
    order: 1;
}

/* Progress dialog */
.progress-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.circular-progress {
    width: 3rem;
    height: 3rem;
    border: 0.25rem solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
