/* Subtle cool-grey page background (Tailwind gray-50) */
body {
    background-color: #f9fafb;
}

/* Blazor validation integration with Bootstrap */
.valid.modified:not([type=checkbox]) {
    border-color: var(--bs-success);
}

.invalid {
    border-color: var(--bs-danger);
}

/* Remove focus outline on headings (set by FocusOnNavigate for accessibility) */
h1:focus,
h2:focus,
h3:focus,
h4:focus,
h5:focus,
h6:focus {
    outline: none;
}

/* Blazor error boundary styling */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA9?Bu==) no-repeat 1rem/1.8rem, var(--bs-danger);
    padding: 1rem 1rem 1rem 3.7rem;
  color: white;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Auto-expanding textarea */
textarea.auto-expand {
    field-sizing: content;
    min-height: calc(1.5em + 0.5rem + 2px);
    overflow: hidden;
    resize: none;
}

/* Drag-and-drop ghost row */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--bs-primary-bg-subtle);
}

.reorder-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Field grid layout */
.fields-container {
    overflow-x: auto;
}

.field-grid {
    display: grid;
    grid-template-columns: 36px 22% 120px 1fr 100px;
    align-items: center;
    min-width: 650px;
}

.field-grid > div {
    padding: 0.35rem 0.5rem;
    min-width: 0;
}

.field-grid-header {
    font-weight: 600;
    border-bottom: 2px solid var(--bs-border-color);
}

.field-grid-header > div {
    padding: 0.5rem;
}

.field-grid-row {
    border-bottom: 1px solid var(--bs-border-color);
}

.field-grid-error {
    padding: 0.125rem 0.5rem 0.35rem calc(36px + 1rem);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Field striping */
.field-group:nth-child(odd) > .field-grid-row {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Hide columns while dragging fields */
.fields-dragging .column-container {
    display: none !important;
}

/* Column container styling */
.column-container {
    border-left: 3px solid var(--bs-primary);
}

/* Column count pill — tight, muted, overlaps icon */
.column-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    min-width: 12px;
    height: 12px;
    padding: 0 2px;
    border-radius: 6px;
    background-color: #fff;
    color: #6c757d;
    margin-left: -6px;
    position: relative;
    top: 4px;
}

.field-group:nth-child(odd) .column-count-pill {
    background-color: #fafafa;
}

/* Column row hierarchy — subordinate styling */
.column-row {
    background-color: #f0f7ff;
}

.column-row:nth-child(even) {
    background-color: #e4edf8;
}

.column-edit-row {
    background-color: #f0f7ff;
}

.column-row .column-field-name {
    color: #5a7da8;
    font-family: var(--bs-font-monospace);
    font-weight: 400;
    font-size: 0.875rem;
}

.column-row .column-desc {
    color: #6b7f99;
}

.column-row .col-drag-handle i {
    color: #7a94b0 !important;
}

.col-drag-handle {
    cursor: grab;
}

.add-column-row {
    background-color: #e8f0fb;
}

.add-column-row > div {
    padding-bottom: 0.75rem;
}

.add-field-row {
    background-color: rgba(0, 0, 0, 0.075);
    border-bottom: 1px solid var(--bs-border-color);
}

.components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
}

.components-reconnect-modal.components-reconnect-show,
.components-reconnect-modal.components-reconnect-failed,
.components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.components-reconnect-card {
 background: white;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 1.5rem 2rem;
    max-width: 400px;
    width: 90%;
}

.components-reconnect-content {
    display: flex;
    align-items: center;
}

/* Hide all states by default */
.components-reconnect-show,
.components-reconnect-failed,
.components-reconnect-rejected {
    display: none;
}

/* Show appropriate state based on modal class */
.components-reconnect-modal.components-reconnect-show .components-reconnect-show {
    display: flex;
    align-items: center;
}

.components-reconnect-modal.components-reconnect-failed .components-reconnect-failed {
    display: flex;
    align-items: center;
}

.components-reconnect-modal.components-reconnect-rejected .components-reconnect-rejected {
    display: flex;
    align-items: center;
}
