/*
 * Node workspace: node actions opened from the Nodes context menu (setup wizard, topology,
 * credentials, verify tokens, challenge watcher, ingress, subscriptions, readiness) render as a
 * full-height side sheet instead of a centered popup, so long content gets the whole viewport
 * height with a fixed header/footer and a single scrolling body.
 */
.modal.node-workspace {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    overflow: hidden;
    padding: 0 !important;
}

.modal.node-workspace .node-workspace-dialog {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    margin: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    width: min(1180px, calc(100vw - 48px));
    max-width: none;
    height: 100vh;
    height: 100dvh !important;
    display: flex;
    transform: none;
    animation: node-workspace-in 0.22s ease-out;
}

[dir="rtl"] .modal.node-workspace .node-workspace-dialog,
.modal.node-workspace[dir="rtl"] .node-workspace-dialog {
    animation-name: node-workspace-in-rtl;
}

.modal.node-workspace .modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100% !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0;
    border-start-start-radius: 14px;
    border-end-start-radius: 14px;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.modal.node-workspace .modal-header {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 1rem 1.5rem;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--bs-border-color, #e5e7eb);
    align-items: flex-start;
    gap: 1rem;
}

.modal.node-workspace .modal-header .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex-wrap: wrap;
}

.modal.node-workspace .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem !important;
    background: var(--bs-tertiary-bg, #f8fafc);
}

/* Steppers/tab rows stay pinned at the top of the scrolling body. */
.modal.node-workspace .modal-body > .wizard-stepper,
.modal.node-workspace .modal-body > .nav-tabs {
    position: sticky;
    top: -1.5rem;
    z-index: 1;
    margin: -1.5rem -1.5rem 1.25rem;
    padding: 0.75rem 1.5rem !important;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--bs-border-color, #e5e7eb);
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow: visible !important;
}

.modal.node-workspace .modal-body.p-0 > .wizard-stepper {
    top: 0;
    margin: 0;
}

/* The theme makes .modal-body a flex column, which squeezed every card and clipped its content.
   Children keep their natural height; the body scrolls instead. */
.modal.node-workspace .modal-body > * {
    flex-shrink: 0;
}

.modal.node-workspace .modal-body .card {
    border-radius: 10px;
    background: var(--bs-body-bg, #fff);
}

.modal.node-workspace .modal-body .table-responsive {
    max-width: 100%;
}

.modal.node-workspace .modal-body .mono,
.modal.node-workspace .modal-body code {
    overflow-wrap: anywhere;
    direction: ltr;
    unicode-bidi: isolate;
}

.modal.node-workspace .modal-footer {
    flex: 0 0 auto;
    padding: 0.85rem 1.5rem;
    background: var(--bs-body-bg, #fff);
    border-top: 1px solid var(--bs-border-color, #e5e7eb);
    gap: 0.5rem;
}

.node-workspace-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 240px;
    padding: 2rem;
    text-align: center;
    color: var(--bs-secondary-color, #64748b);
}

.node-workspace-empty svg {
    color: var(--bs-warning, #f59e0b);
}

@media (max-width: 768px) {
    .modal.node-workspace .node-workspace-dialog {
        width: 100vw;
    }

    .modal.node-workspace .modal-content {
        border-radius: 0;
    }

    .modal.node-workspace .modal-body {
        padding: 1rem !important;
    }
}

@keyframes node-workspace-in {
    from { transform: translateX(32px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes node-workspace-in-rtl {
    from { transform: translateX(-32px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .modal.node-workspace .node-workspace-dialog { animation: none; }
}
