/* --- Modal containment and stacking for credentials/secret modals inside dialogs --- */
.modal {
    position: relative;
    z-index: 1000;
}

#secretsSecretModalBackdrop.modal-backdrop,
#secretsCredentialsModalBackdrop.modal-backdrop {
    position: absolute !important;
    z-index: 1300 !important;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    padding: 0;
    overflow: auto;
}

.secrets-modal {
    z-index: 1302 !important;
    position: relative;
    background: #fff;
    width: min(420px, 90%);
    max-width: 100%;
    max-height: 90%;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    border-radius: 8px;
    margin: auto;
    overflow: auto;
}
/*
 * Copyright © 2026
 * Alvaton Holdings
 * Anthony Liberto
 * File: common.css
 * Project: AlVaTest
 * All rights reserved
 *
 * This source code is proprietary and confidential.
 * Redistribution or modification is prohibited without prior written consent.
 *
 */

:root {
    --tcms-app-font-size: 10pt;
    --tcms-ad-footer-height: 112px;
}

html {
    font-size: var(--tcms-app-font-size, 10pt);
}

body {
    font-family: Arial, sans-serif;
    font-size: 1rem;
    margin: 0;
    padding: 0 2rem 2rem;
}

body.tcms-ad-footer-visible {
    padding-bottom: var(--tcms-ad-footer-height, 112px);
}

button,
input,
textarea,
select {
    font: inherit;
}

h1 {
    margin-bottom: 0.4rem;
}

.hint {
    color: #555;
}

/* Inline ? help tip — CSS-only tooltip */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    border-radius: 50%;
    background: #e0e7ef;
    color: #1a56db;
    font-size: .72rem;
    font-weight: 700;
    cursor: default;
    position: relative;
    vertical-align: middle;
    margin-left: .25em;
    border: none;
    padding: 0;
    flex-shrink: 0;
}

.help-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    left: auto;
    transform: none;
    background: #1e2a3a;
    color: #fff;
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 240px;
    padding: .45rem .6rem;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 999;
    text-align: left;
}

.help-tip:hover::after,
.help-tip:focus::after {
    opacity: 1;
}

.page {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
}

.card {
    border: 1px solid #ddd;
    padding: 1rem;
    border-radius: 4px;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.grid {
    display: grid;
    gap: 0.5rem 1rem;
}

.label {
    font-weight: 600;
}

label {
    display: block;
    margin-top: 0.5rem;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

button {
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}

/* Keep icon-only controls visually consistent across pages. */
button.icon-only-btn,
button.icon-btn {
    width: 2.15rem;
    height: 2.15rem;
    min-width: 2.15rem;
    min-height: 2.15rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 1rem;
    border-radius: 4px;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button.icon-only-btn > i,
button.icon-btn > i {
    margin-right: 0;
    font-size: 1rem;
}

button.icon-only-btn:hover,
button.icon-btn:hover {
    background-color: #e8e8e8;
}

button.icon-only-btn:focus-visible,
button.icon-btn:focus-visible {
    outline: 2px solid #5b9dd9;
    outline-offset: 2px;
}

.secondary {
    background: #f5f5f5;
    border: 1px solid #ccc;
}

button.danger {
    background: #c0392b;
    color: #fff;
    border-color: #a93226;
}

button.danger:hover {
    background: #a93226;
}

/* Standard dropdown menu primitives used across pages/fragments. */
.dropdown-menu {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.15rem;
    background: #f0f0f0;
    border: 1px solid #bcbcbc;
    border-radius: 4px;
    color: #222;
}

.dropdown-trigger:hover {
    background: #e8e8e8;
    border-color: #b0b0b0;
}

.dropdown-trigger:focus-visible {
    outline: 2px solid #5b9dd9;
    outline-offset: 2px;
}

.dropdown-content {
    position: absolute;
    left: 0;
    top: calc(100% + 0.25rem);
    width: 180px;
    max-width: min(92vw, 280px);
    max-height: min(60vh, 20rem);
    overflow-x: hidden;
    overflow-y: auto;
    background: #efefef;
    border: 1px solid #bcbcbc;
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
    padding: 0.25rem;
    z-index: 30;
}

.dropdown-content.open-up {
    top: auto;
    bottom: calc(100% + 0.25rem);
}

.dropdown-content.align-right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    min-height: 2rem;
    border: 1px solid transparent;
    background: #efefef;
    color: #222;
    text-align: left;
    padding: 0.45rem 0.6rem;
    line-height: 1.25;
    white-space: normal;
    cursor: pointer;
    /* <button> defaults to border-box, but <a class="dropdown-item"> (e.g. User Guide)
       defaults to content-box — without this, the anchor's padding/border push its
       100%-width box wider than its <button> siblings, throwing off alignment. */
    box-sizing: border-box;
}

.dropdown-item + .dropdown-item {
    margin-top: 0.2rem;
}

.dropdown-item:hover {
    background: #e2e2e2;
    border-color: #c6c6c6;
}

.dropdown-item:focus-visible {
    outline: 2px solid #5b9dd9;
    outline-offset: 1px;
}

.dropdown-item i {
    margin-right: 0;
    flex: 0 0 auto;
}

.dropdown-item > span {
    flex: 1 1 auto;
    min-width: 0;
}

.dropdown-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dropdown-item:disabled:hover {
    background: transparent;
}

.result {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px solid #ddd;
    white-space: pre-wrap;
    word-break: break-word;
}

.result.visible {
    display: block;
}

.error {
    color: #b00020;
}

.ok {
    color: #0b7a0b;
}

.empty {
    color: #888;
    margin-top: 1rem;
}

.muted {
    color: #666;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

th,
td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
    vertical-align: top;
}

/* Sticky header row: stays visible while a table's rows scroll past it,
   whether the scrolling happens on the window or on a nearer overflow:auto
   ancestor (e.g. .table-container, an admin .card, or a max-height wrap). */
th {
    background: #f5f5f5;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

th.multiline-header {
    white-space: normal;
    width: 7.5rem;
    min-width: 7.5rem;
    line-height: 1.2;
}

/* ── Sortable table headers (see TableUtils.makeSortable) ─────────── */
th.sortable {
    cursor: pointer;
}
th.sortable:hover {
    background: #e8e8e8;
}
th .sort-icon {
    margin-left: 0.3rem;
    opacity: 0.4;
    font-size: 0.8em;
}
th.sort-asc .sort-icon::after {
    content: '▲';
    opacity: 1;
}
th.sort-desc .sort-icon::after {
    content: '▼';
    opacity: 1;
}
th:not(.sort-asc):not(.sort-desc) .sort-icon::after {
    content: '⇅';
}

tbody tr:nth-child(even) {
    background-color: #e3f2fd;
}

/* Explicit stripe classes for tables whose filters hide rows (display:none/[hidden])
   instead of removing them — nth-child(even) above still counts those hidden rows,
   so it mis-stripes whatever stays visible. JS re-tags visible rows with these
   classes by visible position (see TCMSCommon.restripeVisibleRows in common.js);
   !important is needed to win over the nth-child rule's tie-breaking specificity. */
tbody tr.row-stripe-even {
    background-color: #e3f2fd !important;
}
tbody tr.row-stripe-odd {
    background-color: #fff !important;
}

/* ── Shared data-table styles ─────────────────────────────────────── */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.tcms-data-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.tcms-data-table th {
    /* sticky (not just relative) so the header stays visible while the body
       scrolls; still a positioned containing block for .col-resizer's
       absolute positioning. z-index above .col-resizer (1) and
       .row-resizer-h (2) so scrolled-under row handles never paint over it. */
    position: sticky;
    top: 0;
    z-index: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: none;
}

.tcms-data-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

th[data-noresize] {
    white-space: nowrap;
    width: 1px;
    overflow: visible;
}

.tcms-data-table.row-compact  td { height: 26px; padding: 0.15rem 0.4rem; }
.tcms-data-table.row-default  td { height: 38px; padding: 0.3rem  0.5rem; }
.tcms-data-table.row-comfortable td { height: 50px; padding: 0.5rem 0.5rem; }
.tcms-data-table.row-spacious td {
    height: auto;
    white-space: normal;
    word-break: break-word;
    padding: 0.6rem 0.5rem;
}

.col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 1;
}
.col-resizer:hover,
.col-resizer.resizing { background: rgba(58, 74, 191, 0.35); }

/* ── Row resize handle ────────────────────────────────────────────── */
/* position:relative only — deliberately no overflow:visible here anymore.
   The handle sits at bottom:0 fully inside the cell's own box (not below
   it), so it doesn't need overflow:visible to render/be clickable, and
   overflow:visible was overriding .tcms-data-table td's overflow:hidden +
   text-overflow:ellipsis, letting a narrow first column's text bleed
   straight into the next column instead of clipping. */
.tcms-data-table tbody td.row-resize-cell {
    position: relative;
}

.row-resizer-h {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 5px;
    cursor: row-resize;
    user-select: none;
    z-index: 2;
    background: transparent;
}

.row-resizer-h:hover,
.row-resizer-h.resizing { background: rgba(58, 74, 191, 0.35); }

/* Row that the user has manually resized */
.tcms-data-table tbody tr.row-user-height td {
    height: var(--tcms-row-h) !important;
    overflow-y: auto;
    white-space: normal;
    word-break: break-word;
}

.tcms-row-height-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}
.tcms-row-height-bar label {
    font-weight: 600;
    margin: 0;
}
.tcms-row-height-bar select {
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
}

.toolbar,
.session-menu {
    margin: 1rem -2rem;
    width: calc(100% + 4rem);
    box-sizing: border-box;
    padding: 0.5rem 3.5rem;
    display: flex;
    gap: 0.6rem;
    background: linear-gradient(90deg, #000000 0%, #e53935 50%, #1e88e5 100%);
    color: #fff;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(30, 136, 229, 0.08);
    align-items: center;
}

.filters {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.85em;
    margin-top: 0;
}

.filter-group select,
.filter-group input {
    padding: 0.4rem 0.5rem;
    font-size: 0.9em;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    overflow: auto;
    z-index: 1200;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: #fff;
    width: min(560px, 92vw);
    max-width: calc(100vw - 2rem);
    min-width: min(320px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 1rem 1rem 0;
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    overflow: auto;
    resize: both;
    margin: 0 auto;
    box-sizing: border-box;
}

.modal-drag-handle {
    cursor: move;
    user-select: none;
    touch-action: none;
}

.modal.modal-dragging {
    transition: none;
}

@media (max-width: 768px) {
    .modal {
        resize: none;
    }
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
}

.modal .modal-actions,
.modal .section-toolbar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e2e2e2;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
    margin-top: 0.75rem;
    z-index: 1;
}

.modal .section-toolbar {
    margin: 0;
    padding: 0;
    border-top: 0;
    box-shadow: none;
    background: #fff;
}

.secure {
    content : "*"
}

.status-PASSED {
    color: #0b7a0b;
    font-weight: 600;
}

.status-FAILED,
.status-ERROR {
    color: #b00020;
    font-weight: 600;
}

.status-RUNNING {
    color: #1a56db;
    font-weight: 600;
}

.status-QUEUED,
.status-CANCELLED {
    color: #888;
}

/* Ensure secrets-modal overlays are above dialogs */
.secrets-modal {
    z-index: 1300;
    position: relative;
}

/* Ensure credentials/secret modal is above parent dialog */
#secretsSecretModalBackdrop.modal-backdrop,
#secretsCredentialsModalBackdrop.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1301;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    padding: 0;
    overflow: auto;
}

/* Optionally, make sure modal is centered and covers viewport */
#secretsSecretModalBackdrop.modal-backdrop,
#secretsCredentialsModalBackdrop.modal-backdrop {
    align-items: center !important;
    justify-content: center !important;
}

/* --- Modal containment update for dialog popups --- */
/* Make modal-backdrop fill parent (dialog), not viewport */
#secretsSecretModalBackdrop.modal-backdrop,
#secretsCredentialsModalBackdrop.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1300;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    padding: 0;
    overflow: auto;
}

/* The modal itself should not exceed the parent dialog size */
.secrets-modal {
    z-index: 1302;
    position: relative;
    width: min(420px, 90%);
    max-width: 100%;
    max-height: 90%;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    border-radius: 8px;
    background: #fff;
    margin: auto;
    overflow: auto;
}

.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* ── Session menu: fixed-width icon column for consistent alignment ─────── */
.session-menu .dropdown-content .dropdown-item i {
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

/* ── Audit history button: hidden until body.has-audit is set ───────────── */
button.audit-history-btn { display: none; }
body.has-audit button.audit-history-btn { display: inline-flex; }

/* ── Audit history modal ─────────────────────────────────────────────────── */
.audit-history-modal { min-width: 520px; max-width: 700px; max-height: 80vh; display: flex; flex-direction: column; }
.audit-history-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.audit-history-modal-header h2 { margin: 0; }
.audit-history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.audit-history-entry { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--border-color, #e0e0e0); }
.audit-history-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.audit-action { font-weight: 600; font-size: 0.8rem; padding: 0.1rem 0.4rem; border-radius: 4px; text-transform: uppercase; }
.audit-action--created { background: #d4edda; color: #155724; }
.audit-action--updated { background: #cce5ff; color: #004085; }
.audit-action--deleted { background: #f8d7da; color: #721c24; }
.audit-date { font-size: 0.85rem; color: var(--text-muted, #666); }
.audit-actor { font-size: 0.85rem; }
.audit-history-snapshot { margin-top: 1rem; border-top: 1px solid var(--border-color, #e0e0e0); padding-top: 0.75rem; }
.audit-history-snapshot-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.audit-detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0 0 0.75rem; font-size: 0.85rem; }
.audit-detail-grid dt { font-weight: 600; color: var(--text-muted, #555); white-space: nowrap; }
.audit-detail-grid dd { margin: 0; word-break: break-all; }
.audit-s3-content-label { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; }
#auditS3ContentPre { background: var(--code-bg, #f5f5f5); padding: 0.75rem; border-radius: 4px; font-size: 0.78rem; max-height: 250px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* ── Generic toast (TCMSCommon.showToast) ────────────────────────────────── */
.tcms-toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; }
.tcms-toast { background: #2f2f2f; color: #fff; padding: 0.6rem 1rem; border-radius: 6px; font-size: 0.85rem; box-shadow: 0 2px 8px rgba(0,0,0,0.25); opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease; }
.tcms-toast.tcms-toast-visible { opacity: 1; transform: translateY(0); }
.tcms-toast-error { background: #b3261e; }

/* ── "Migrating" badge — TestRail migration-import rows still mid-migration,
   visible only when the "Show Migration Data" toggle is on. Mirrors entity-schedule.css's
   .schedule-badge chip shape. ─────────────────────────────────────────────── */
.migrating-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 0.35em;
    background: rgba(234, 179, 8, 0.15);
    color: #b45309;
}

/* ── Generic progress bar (track/fill/label) — same visual convention as
   agent-download.css's download-progress-bar-*, duplicated here as a sitewide utility so any
   page can show a determinate progress bar without pulling in a page-specific stylesheet. ── */
.progress-bar-track {
    margin-top: 0.5em;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0;
    background: #0d6efd;
    border-radius: 4px;
    transition: width 0.2s ease;
}
.progress-bar-label {
    margin-top: 0.3em;
    font-size: 0.8rem;
    color: var(--text-muted, #6c757d);
}

/* ── Generic "still working" activity indicator (spinning icon + label) — for long-running
   backend operations with no incremental item count to drive a determinate progress-bar-fill
   above (e.g. a migration job's Generate/Prepare/Validate phases). ── */
.activity-indicator {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0.5em 0;
    font-size: 0.95rem;
    color: var(--text-muted, #6c757d);
}
.activity-indicator-icon {
    animation: tcms-spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes tcms-spin {
    to { transform: rotate(360deg); }
}