/**
 * DH Suite — shared overlays.
 *
 * Split out of components.css, which had grown to 1,073 lines
 * across eleven unrelated families. Same layer, same order: these are
 * linked in the sequence they were concatenated, because within a layer
 * later source wins.
 */

@layer components {

/* ==========================================================================
   Modals
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-4);
}

/* A modal without its own backdrop element still dims the page behind it
   (Rally's dialogs had none) */
.modal:not(:has(> .modal-backdrop)) {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--color-gray-200);
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: var(--font-size-2xl);
    color: var(--color-gray-500);
    cursor: pointer;
    padding: var(--spacing-2);
    line-height: 1;
    border-radius: var(--radius-md);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--color-gray-700);
    background-color: var(--color-gray-100);
}

.modal-close:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.modal-body {
    flex: 1;
    padding: var(--spacing-4);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-3);
    padding: var(--spacing-4);
    border-top: 1px solid var(--color-gray-200);
}

/* ==========================================================================
   Confirm dialog (shared/static/js/confirm-dialog.js), in place
   of the browser's confirm().
   ========================================================================== */

.confirm-dialog {
    width: min(28rem, calc(100vw - 2 * var(--spacing-4)));
    padding: var(--spacing-6);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    background: var(--color-surface);
}

.confirm-dialog::backdrop {
    background: rgba(17, 24, 39, 0.5);
}

.confirm-dialog-title {
    margin: 0 0 var(--spacing-2);
    font-size: var(--font-size-lg);
}

.confirm-dialog-message {
    margin: 0 0 var(--spacing-5);
    color: var(--color-text-secondary);
}

/* The lines a confirmation names ("These roles will be removed"); a long
   list scrolls inside the dialog */
.confirm-dialog-list {
    max-height: 14rem;
    overflow-y: auto;
    margin: calc(-1 * var(--spacing-3)) 0 var(--spacing-5);
    padding-left: var(--spacing-5);
}

.confirm-dialog-list[hidden] {
    display: none;
}

.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-2);
    flex-wrap: wrap;
}

}

/* ==========================================================================
   Beta feedback dialog (components/feedback_dialog.html,
   shared/static/js/feedback-dialog.js)
   ========================================================================== */

.feedback-dialog {
    width: min(34rem, calc(100vw - 2 * var(--spacing-4)));
    max-height: calc(100vh - 2 * var(--spacing-4));
    overflow-y: auto;
    padding: var(--spacing-6);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    background: var(--color-surface);
}

.feedback-dialog::backdrop {
    background: rgba(17, 24, 39, 0.5);
}

.feedback-title {
    margin: 0 0 var(--spacing-2);
    font-size: var(--font-size-lg);
}

.feedback-intro {
    margin: 0 0 var(--spacing-4);
    color: var(--color-text-secondary);
}

.feedback-error {
    margin: 0 0 var(--spacing-3);
    color: var(--color-danger-text);
}

/* The pictures chosen to send: a preview, the name and a Remove button */
.feedback-pictures {
    margin: var(--spacing-2) 0 0;
    padding: 0;
    list-style: none;
}

.feedback-picture-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-1) 0;
}

.feedback-picture-thumb {
    flex: none;
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
}

.feedback-picture-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.feedback-pictures[hidden],
.feedback-picture-thumb[hidden],
.feedback-error[hidden],
.feedback-done[hidden],
.feedback-form[hidden] {
    display: none;
}

.feedback-thanks {
    margin: 0 0 var(--spacing-5);
    font-size: var(--font-size-lg);
}

.feedback-thanks:focus {
    outline: none;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-2);
    flex-wrap: wrap;
}

/* The header's Send feedback button, on every screen */
.header-feedback {
    margin-right: var(--spacing-2);
}
