/* ==========================================================================
   MODAL COMPONENT - SINGLE SOURCE OF TRUTH
   All base .modal-* class definitions live here.
   Originally in src/Shared.UI/wwwroot/css/modal.css; moved to App.Web so
   the file is served as a plain static asset (css/modal.css) and no longer
   requires the Blazor RCL static-web-asset path.
   Uses design tokens from site.css (loaded before this file).
   ========================================================================== */

/* --------------------------------------------------------------------------
   BACKDROP  (two naming variants used across the codebase)
   • .modal-backdrop  – used by Shared.UI ModalHost and IdsBcfTopicDialog
   • .modal-overlay   – used by IdsTools, Module.Configuration components
   Both centre their child dialog and dim the background.
   -------------------------------------------------------------------------- */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in-out;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: var(--space-20, 20px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Container - centres the dialog (used by Shared.UI ModalHost) */
.modal-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--space-20, 20px);
}

/* --------------------------------------------------------------------------
   DIALOG BOX  (two naming variants)
   • .modal-dialog   – the positioned dialog frame
   • .modal-content  – Bootstrap-compatible inner wrapper used where the
                       structure is: modal-dialog > modal-content > modal-header/body/footer
   -------------------------------------------------------------------------- */

.modal-dialog {
    position: relative;
    background: var(--color-white, #ffffff);
    border-radius: var(--radius-medium, 6px);
    box-shadow: var(--shadow-lg, 0 4px 10px rgba(0,0,0,0.08));
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

.modal-content {
    background: var(--color-white, #ffffff);
    border-radius: var(--radius-medium, 6px);
    box-shadow: var(--shadow-lg, 0 4px 20px rgba(0,0,0,0.2));
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Size variants */
.modal-dialog.modal-sm {
    max-width: 300px;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-dialog.modal-xl {
    max-width: 1140px;
}

/* --------------------------------------------------------------------------
   CLOSE BUTTON  (two naming variants)
   • .modal-close-btn  – used by Shared.UI ModalHost
   • .modal-close      – used by IdsTools components (IdsWorkspacePanel, ModelHistory)
   -------------------------------------------------------------------------- */

.modal-close-btn {
    position: absolute;
    top: var(--space-12, 12px);
    right: var(--space-12, 12px);
    background: transparent;
    border: none;
    color: var(--color-text-muted, rgba(0,0,0,0.55));
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-4, 4px);
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 1;
}

.modal-close-btn:hover {
    color: var(--color-text-primary, #00437b);
}

.modal-close-btn:focus {
    outline: var(--focus-outline, 2px solid #338ed1);
    outline-offset: var(--focus-outline-offset, 2px);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-text-secondary, rgba(0,0,0,0.78));
    cursor: pointer;
    padding: var(--space-4, 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-small, 4px);
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--color-text-primary, #00437b);
    background: var(--color-grey-100, #f3f5f7);
}

/* --------------------------------------------------------------------------
   HEADER / BODY / FOOTER
   -------------------------------------------------------------------------- */

.modal-header {
    padding: var(--space-24, 24px);
    border-bottom: 1px solid var(--color-border-subtle, #d9d9d9);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary, #00437b);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: var(--space-24, 24px);
    overflow-y: auto;
    flex: 1;
    color: var(--color-text-secondary, rgba(0,0,0,0.78));
}

.modal-footer {
    padding: var(--space-24, 24px);
    border-top: 1px solid var(--color-border-subtle, #d9d9d9);
    display: flex;
    gap: var(--space-12, 12px);
    justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   STACKING CONTEXT
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   MODAL FOOTER BUTTONS
   Used by ModalService.ShowConfirmAsync / ShowDeleteConfirmAsync
   -------------------------------------------------------------------------- */

.modal-btn-primary,
.modal-btn-secondary,
.modal-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-6, 6px);
    padding: var(--space-8, 8px) var(--space-16, 16px);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-small, 4px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.modal-btn-primary {
    background-color: var(--color-primary, #00437b);
    color: #fff;
    border-color: var(--color-primary, #00437b);
}

.modal-btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-dark, #00345e);
    border-color: var(--color-primary-dark, #00345e);
}

.modal-btn-secondary {
    background-color: transparent;
    color: var(--color-text-secondary, rgba(0,0,0,0.78));
    border-color: var(--color-border-default, #b3b3b3);
}

.modal-btn-secondary:hover:not(:disabled) {
    background-color: var(--color-grey-100, #f3f5f7);
}

.modal-btn-danger {
    background-color: #c62828;
    color: #fff;
    border-color: #c62828;
}

.modal-btn-danger:hover:not(:disabled) {
    background-color: #b71c1c;
    border-color: #b71c1c;
}

.modal-btn-primary:disabled,
.modal-btn-secondary:disabled,
.modal-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



.modal-backdrop,
.modal-overlay,
.modal-container,
.modal-dialog {
    isolation: isolate;
}
