Skip to content

Home Information - Your home, your data, organized.

Python
48.6 KB
Raw Blame
/* Attribute V2 System Styles */

/* Container Structure */
.attr-v2-container {
    /* Remove default form margins for better layout control */
    margin: 0;
}

/* Sticky Panel (Entity Info + Action Bar - Always Visible) */
.attr-v2-sticky-panel {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--white);
    border-bottom: 1px solid var(--line-color);
    padding-bottom: 0.75rem;
}

/* Entity Info Section (Minimal - Name/Type) */
.attr-v2-entity-info {
    padding: 0.5rem 0 0.25rem 0;
}

/* Action Bar */
.attr-v2-action-bar {
    padding: 0.25rem 0;
    background-color: var(--white);
}

.attr-v2-action-bar-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Left group: button and messages */
.attr-v2-action-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1; /* Take available space */
}

/* Message stack */
.attr-v2-message-stack {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attr-v2-update-btn {
    min-height: 44px; /* Touch-friendly primary action */
    min-width: 80px;
    padding: 0.75rem 1.5rem;
    flex-shrink: 0; /* Don't shrink button */
}

/* Right group: action buttons */
.attr-v2-action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0; /* Don't shrink buttons */
    margin-left: auto; /* Push to right */
}

.attr-v2-action-buttons button,
.attr-v2-action-buttons a.btn {
    min-height: 44px; /* Touch-friendly minimum */
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* <a class="btn"> doesn't vertically center its content the way
   <button> does; force-center so anchor-styled buttons line up
   with their button-element siblings in the action bar. */
.attr-v2-action-buttons a.btn {
    display: inline-flex;
    align-items: center;
}

.attr-v2-status-message {
    font-size: 0.875rem;
    color: var(--secondary-text-color);
    font-style: italic;
}

/* Status message variants */
.attr-v2-status-message.success {
    color: var(--success-color, #28a745);
    background-color: var(--success-bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-style: normal;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.attr-v2-status-message.success::before {
    content: '✓';
    font-weight: bold;
    color: var(--success-color, #28a745);
}

/* Scrollable Content Area (Natural Scrolling) */
.attr-v2-scrollable-content {
    padding: 1rem 0;
    /* Natural scrolling - no height restrictions or overflow settings */
}

/* Touch-friendly Form Controls - Consistent heights */
.attr-v2-container input,
.attr-v2-container select,
.attr-v2-container textarea {
    min-height: 44px; /* Touch-friendly minimum for form inputs */
    padding: 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

.attr-v2-container input[type="text"],
.attr-v2-container input[type="email"],
.attr-v2-container input[type="url"],
.attr-v2-container select {
    height: 44px; /* Exact height for single-line inputs */
}

.attr-v2-container textarea {
    min-height: 44px;
    resize: vertical;
}

/* Section Titles */
.attr-v2-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--line-color);
}

/* File Grid Layout */
.attr-v2-file-section {
    margin-bottom: 2rem;
}

/* Collapse the file section when it has no cards. The wrapper
   stays in the DOM (file_grid_html_id is the target for "Add
   File" insertions) but takes zero vertical space. */
.attr-v2-file-section:not(:has(.attr-v2-file-card)) {
    margin-bottom: 0;
}
.attr-v2-file-section:not(:has(.attr-v2-file-card)) .attr-v2-file-grid {
    margin-top: 0;
}

/* External-reference card: integration logo inside the open-link
   action button. Sized 24px so it reads as an icon at typical
   button height. */
.hi-ext-ref-integration-logo {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* Action buttons in any file-card actions row (native attribute
   file cards and the external-reference card both use
   ``attr-v2-file-actions``). inline-flex centers tall children
   (24px icons / integration logos) inside btn-sm's padded box;
   without this an img > line-height defaults to baseline-ish
   vertical alignment and visually sits high in the button. */
.attr-v2-file-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.attr-v2-file-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.75rem;
}

.attr-v2-file-card {
    /* No border or padding on main card - components handle their own styling */
    border-radius: 0.375rem;
    background: transparent;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Maintain rounded corners */
}

.attr-v2-file-thumbnail {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1rem;
    /* Diagonal hatch pattern background */
    background: repeating-linear-gradient(
        45deg,
        #f8f9fa,
        #f8f9fa 10px,
        #e9ecef 10px,
        #e9ecef 20px
    );
    border-radius: 0.375rem 0.375rem 0 0; /* Rounded top corners only */
    cursor: pointer;
}

.attr-v2-file-thumbnail.is-document {
    min-height: 140px;
}

.attr-v2-file-thumbnail.has-thumbnail {
    padding: 0;
    align-items: stretch;
    background: #1f2328;
    overflow: hidden;
    height: 180px;
}

.attr-v2-file-thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.attr-v2-file-type-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.attr-v2-file-info {
    flex-grow: 1;
    background: var(--white);
    border: 1px solid var(--line-color);
    border-top: none; /* No border on top - seamless with thumbnail */
    border-radius: 0 0 0.375rem 0.375rem; /* Rounded bottom corners only */
    padding: 0.75rem;
}

.attr-v2-file-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

/* File title input - styled to appear like text initially */
.attr-v2-file-title-input {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    word-break: break-word;
    
    /* Minimal styling - appears like text */
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    border-radius: 3px;
    width: 100%;
    transition: all 0.2s ease;
    
    /* Inherit text color and font */
    color: inherit;
    font-family: inherit;
    line-height: inherit;
}

/* Focused and activated state - stronger input appearance */
.attr-v2-file-title-input:focus,
.attr-v2-file-title-input.activated {
    border-color: var(--primary-color, #007bff);
    background: var(--white, #ffffff);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Hover state - subtle indication it's interactive */
.attr-v2-file-title-input:hover:not(:focus) {
    border-color: var(--line-color, #dee2e6);
    background: rgba(0, 0, 0, 0.02);
}

/* Attribute title input - styled to appear like text initially */
.attr-v2-title-input {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    word-break: break-word;
    letter-spacing: 0.5px;
    
    /* Minimal styling - appears like text */
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 4px;
    border-radius: 3px;
    width: 100%;
    transition: all 0.2s ease;
    
    /* Inherit text color and font */
    color: inherit;
    font-family: inherit;
    line-height: inherit;
}
/* Focused and activated state - stronger input appearance */
.attr-v2-title-input:focus,
.attr-v2-title-input.activated {
    border-color: var(--primary-color, #007bff);
    background: var(--white, #ffffff);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}
/* Hover state - subtle indication it's interactive */
.attr-v2-title-input:hover:not(:focus) {
    border-color: var(--line-color, #dee2e6);
    background: rgba(0, 0, 0, 0.02);
}

/* URL-aware read/edit text mode */
.attr-v2-text-read-content {
    position: relative;
    border: 1px solid var(--line-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    background-color: var(--white, #ffffff);
    line-height: 1.4;
    word-break: break-word;
}

.attr-v2-text-read-content a {
    word-break: break-all;
}

.attr-v2-text-read-content.is-collapsed {
    max-height: calc((1.4em * 4) + 1.5rem);
    overflow: hidden;
}

.attr-v2-text-read-content.is-collapsed::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.75rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--white, #ffffff));
    pointer-events: none;
}

.attr-v2-text-edit-mode {
    margin-top: 0.5rem;
}

.attr-v2-text-edit-actions {
    margin-top: 0.25rem;
    display: flex;
    justify-content: flex-end;
}

.attr-v2-text-cancel-btn {
    border: 0;
    background: transparent;
    color: var(--primary-color, #177072);
}

.attr-v2-text-cancel-btn:hover {
    border: 0;
    color: var(--primary-color-dark, #11595b);
    background-color: rgba(23, 112, 114, 0.08);
}

.attr-v2-text-cancel-btn:focus {
    border: 0;
    color: var(--primary-color, #177072);
    background-color: rgba(23, 112, 114, 0.08);
    box-shadow: 0 0 0 0.2rem rgba(23, 112, 114, 0.25);
}

/* Truncated textarea styling - indicate it's clickable */
.attr-v2-textarea.truncated[readonly] {
    cursor: pointer;
}
.attr-v2-textarea.truncated[readonly]:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.attr-v2-file-filename {
    font-size: 0.75rem;
    color: var(--muted-color);
    word-break: break-word;
}

.attr-v2-file-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line-color);
}

.attr-v2-file-actions button {
    min-height: 44px; /* Touch-friendly minimum */
    min-width: 44px;
    padding: 0.375rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* Hide the "previous" reorder chevron on the first card and the
   "next" chevron on the last card. ``visibility: hidden`` (not
   ``display: none``) preserves the grid slot so the action row's
   ``mr-auto`` / ``ml-auto`` spacing for the middle cluster stays
   consistent across first / middle / last cards. The DOM-swap
   reorder path (``insertBefore``) retriggers ``:first-child`` /
   ``:last-child`` automatically -- no JS state to maintain. */
.attr-v2-file-grid > .attr-v2-file-card:first-child [data-reorder-action="left"],
.attr-v2-file-grid > .hi-ext-ref-card:first-child .hi-ext-ref-reorder-left {
    visibility: hidden;
}
.attr-v2-file-grid > .attr-v2-file-card:last-child [data-reorder-action="right"],
.attr-v2-file-grid > .hi-ext-ref-card:last-child .hi-ext-ref-reorder-right {
    visibility: hidden;
}

/* Reorder Controls - Overlay in upper right of thumbnail */
.attr-v2-reorder-controls {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    flex-direction: row;
    gap: 1px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0.25rem;
    padding: 2px;
    z-index: 1;
}

/* Disable thumbnail hover when hovering over reorder controls */
.attr-v2-file-thumbnail:hover:has(.attr-v2-reorder-controls:hover) {
    background-color: var(--background-color) !important;
    transform: none !important;
}

/* Enhance reorder controls hover state */
.attr-v2-reorder-controls:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Ensure buttons within controls maintain their hover states */
.attr-v2-reorder-controls button:hover {
    background-color: var(--background-color);
    border-color: var(--line-color);
}

/* JavaScript-based hover state override */
.attr-v2-file-thumbnail.reorder-hover:hover {
    background-color: var(--background-color) !important;
    transform: none !important;
}

/* Fallback for browsers that don't support :has() - JavaScript handles it */
@supports not selector(:has(*)) {
    .attr-v2-file-thumbnail:hover:has(.attr-v2-reorder-controls:hover) {
        /* This won't work in unsupported browsers, JS handles it instead */
    }
}

.attr-v2-reorder-controls button {
    /* Touch-friendly size with small visual appearance */
    min-width: 24px;
    min-height: 24px;
    padding: 6px;
    font-size: 10px;
    line-height: 1;
    border-radius: 0.25rem;
    position: relative;
    /* Center the small chevron icon within the larger touch area */
    display: flex;
    align-items: center;
    justify-content: center;
}

.attr-v2-reorder-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: var(--background-color);
    border-color: var(--line-color);
    color: var(--muted-color);
}

.attr-v2-reorder-controls button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Attribute List Layout */
.attr-v2-attribute-section {
    margin-bottom: 2rem;
}

/* Collapse the attribute section when no saved-instance cards are
   present (only Django formset extras would render an
   ``attr-v2-new-attribute`` card; that card stays hidden until
   "Add Info" reveals it). The wrapper stays in the DOM so the
   formset's management form remains intact and "Add Info"'s
   reveal still finds its target. */
.attr-v2-attribute-section:not(:has(.attr-v2-attribute-card:not(.attr-v2-new-attribute))) {
    margin-bottom: 0;
}

.attr-v2-attribute-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attr-v2-attribute-card {
    border: 1px solid var(--line-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    background: var(--white);
    transition: all 0.2s ease;
}

.attr-v2-attribute-card[is_editable="false"] {
    background-color: #e0e0e0;
}
                                              
.attr-v2-attribute-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.attr-v2-attribute-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto; /* Allow to grow and shrink as needed */
    max-width: 70%; /* But don't take more than 70% to leave room for actions */
    min-width: 200px; /* Ensure minimum usable width */
}

.attr-v2-attribute-actions {
    display: flex;
    gap: 0.25rem;
}

.attr-v2-attribute-actions button {
    padding: 0.375rem;
    min-width: 44px; /* Touch-friendly minimum */
    min-height: 44px; /* Touch-friendly minimum */
    border: none;
    background: transparent;
    color: var(--secondary-text-color);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.attr-v2-attribute-actions button:hover {
    background: var(--background-color);
    color: var(--text-color);
}

.attr-v2-attribute-value {
    margin-top: 0.5rem;
}

/* Comprehensive Visual State System */


/* Error State (validation failures) */
.attr-v2-file-card.error,
.attr-v2-attribute-card.error {
    border-left: 3px solid var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

.attr-v2-error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Loading State (during operations) */
.attr-v2-file-card.loading,
.attr-v2-attribute-card.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.attr-v2-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.attr-v2-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--line-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success State (after successful operations) */
.attr-v2-file-card.success,
.attr-v2-attribute-card.success {
    border-left: 3px solid var(--success-color);
    background-color: var(--success-bg-light);
    transition: all 0.3s ease;
}

.attr-v2-success-message {
    color: var(--success-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}


.attr-v2-undo-delete {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 0.25rem;
}

.attr-v2-undo-delete button {
    min-height: 32px;
    padding: 0.25rem 0.75rem;
}

/* Animation Keyframes */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Smooth Transitions for All Interactive Elements */

/* Card State Transitions */
.attr-v2-file-card,
.attr-v2-attribute-card {
    transition: all 0.2s ease-in-out;
}

.attr-v2-file-card:hover,
.attr-v2-attribute-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Button Transitions */
.attr-v2-action-buttons button,
.attr-v2-action-buttons a.btn,
.attr-v2-file-actions button,
.attr-v2-attribute-actions button,
.attr-v2-reorder-controls button,
.attr-v2-update-btn {
    transition: all 0.15s ease;
}

.attr-v2-action-buttons button:hover,
.attr-v2-action-buttons a.btn:hover,
.attr-v2-file-actions button:hover,
.attr-v2-attribute-actions button:hover,
.attr-v2-reorder-controls button:hover:not(:disabled),
.attr-v2-update-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form Element Transitions */
.attr-v2-container input,
.attr-v2-container select,
.attr-v2-container textarea {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.attr-v2-container input:focus,
.attr-v2-container select:focus,
.attr-v2-container textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(23, 112, 114, 0.25);
    outline: none;
}

/* Enhanced focus states for buttons and interactive elements */
.attr-v2-action-buttons button:focus,
.attr-v2-action-buttons a.btn:focus,
.attr-v2-file-actions button:focus,
.attr-v2-attribute-actions button:focus,
.attr-v2-reorder-controls button:focus,
.attr-v2-update-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem rgba(23, 112, 114, 0.25);
}

/* Update button prominence changes based on dirty state */
.attr-v2-update-btn.form-dirty {
    background-color: var(--primary-color, #007bff) !important;
    border-color: var(--primary-color, #007bff) !important;
    color: white !important;
}

.attr-v2-update-btn.form-dirty:hover {
    background-color: var(--primary-color-dark, #0056b3) !important;
    border-color: var(--primary-color-dark, #0056b3) !important;
    color: white !important;
}

.attr-v2-update-btn.form-dirty:focus {
    background-color: var(--primary-color, #007bff) !important;
    border-color: var(--primary-color, #007bff) !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(23, 112, 114, 0.25) !important;
}

.attr-v2-reorder-controls button:focus:disabled {
    outline-color: var(--muted-color);
    box-shadow: 0 0 0 0.2rem rgba(126, 126, 129, 0.25);
}

/* Card focus states for keyboard navigation */
.attr-v2-file-card:focus-within,
.attr-v2-attribute-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Add form focus enhancement */
.attr-v2-add-form:focus-within {
    box-shadow: 0 4px 12px rgba(23, 112, 114, 0.15);
}

/* Add Form Animation */
.attr-v2-add-form {
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease when visible;
}

.attr-v2-add-form.collapsed {
    display: none;
}

.attr-v2-add-form:not(.collapsed) {
    animation: fadeIn 0.3s ease;
}

/* Status Message Transitions */
.attr-v2-status-message {
    transition: opacity 0.25s ease, color 0.25s ease;
}

/* Thumbnail Hover Effect */
.attr-v2-file-thumbnail {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.attr-v2-file-thumbnail:hover {
    background-color: var(--primary-color-light, #e7f3ff);
    transform: scale(1.02);
}

/* Responsive Design - Mobile First with Tablet Primary */

/* Small screens - 2 columns for very narrow widths */
@media (max-width: 575px) {
    /* Adjust modal for very small screens */
    .hi-modal-dialog-700 {
        max-width: 95%;
        margin: 0.5rem;
    }
    
    /* File grid: 2 columns on very small screens */
    .attr-v2-file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Mobile Landscape (576px to 1023px) - Keep 3 columns */
@media (min-width: 576px) and (max-width: 1023px) {
    /* File grid maintains 3 columns */
    .attr-v2-file-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.875rem;
    }
    
    /* Action bar may stack buttons vertically on very small landscape */
    .attr-v2-action-bar-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .attr-v2-action-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Attribute actions stack vertically */
    .attr-v2-attribute-actions {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-end;
    }
}

/* Tablet Landscape (1024px+) - PRIMARY TARGET */
@media (min-width: 1024px) {
    /* Optimal layout - all features at full capacity */
    .hi-modal-dialog-700 {
        max-width: 700px;
    }
    
    /* File grid: 3 columns optimal */
    .attr-v2-file-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    /* Action bar horizontal layout */
    .attr-v2-action-bar-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Enhanced hover effects for mouse/trackpad */
    .attr-v2-file-card:hover,
    .attr-v2-attribute-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* Better button spacing */
    .attr-v2-attribute-actions {
        flex-direction: row;
        gap: 0.25rem;
    }
}

/* Desktop (1200px+) - SECONDARY TARGET */
@media (min-width: 1200px) {
    /* Enhanced layout with more space - maintain 3 columns */
    .attr-v2-file-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    /* More generous spacing */
    .attr-v2-scrollable-content {
        padding: 1.5rem 0;
    }
    
    .attr-v2-attribute-list {
        gap: 1rem;
    }
    
    /* Enhanced hover effects */
    .attr-v2-file-card:hover,
    .attr-v2-attribute-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }
    
    /* Larger touch targets can be more refined */
    .attr-v2-reorder-controls button,
    .attr-v2-attribute-actions button {
        min-width: 32px;
        min-height: 32px;
        padding: 8px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .attr-v2-file-card,
    .attr-v2-attribute-card {
        border-width: 0.5px;
    }
    
    .attr-v2-sticky-panel {
        border-bottom-width: 0.5px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch-only devices: remove hover effects, ensure touch targets */
    .attr-v2-file-card:hover,
    .attr-v2-attribute-card:hover,
    .attr-v2-file-thumbnail:hover,
    .attr-v2-action-buttons button:hover,
    .attr-v2-action-buttons a.btn:hover,
    .attr-v2-file-actions button:hover,
    .attr-v2-attribute-actions button:hover {
        transform: none;
        box-shadow: none;
        background-color: initial;
    }
    
    /* Ensure all touch targets are adequate */
    .attr-v2-attribute-actions button,
    .attr-v2-file-actions button,
    .attr-v2-reorder-controls button {
        min-height: 44px; /* Touch-friendly standard */
        min-width: 44px;
        padding: 10px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    /* Disable animations for users who prefer reduced motion */
    .attr-v2-file-card,
    .attr-v2-attribute-card,
    .attr-v2-action-buttons button,
    .attr-v2-action-buttons a.btn,
    .attr-v2-file-actions button,
    .attr-v2-attribute-actions button,
    .attr-v2-reorder-controls button,
    .attr-v2-container input,
    .attr-v2-container select,
    .attr-v2-container textarea,
    .attr-v2-add-form,
    .attr-v2-file-thumbnail {
        animation: none;
        transition: none;
    }
    
    
    .attr-v2-loading-spinner {
        animation: spin 0.1s linear infinite;
    }
}

/* Add Attribute Form */
.attr-v2-add-form {
    border: 1px solid var(--line-color);
    border-radius: 0.375rem;
    background: var(--white);
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

.attr-v2-add-form.collapsed {
    display: none;
}

.attr-v2-add-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line-color);
    background: var(--background-color);
}

.attr-v2-add-form-header h6 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
}

.attr-v2-add-form-content {
    padding: 1rem;
}

.attr-v2-add-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-color);
}

/* Add form field layout improvements */
.attr-v2-add-form-content .row {
    align-items: end;
}

.attr-v2-add-form-content .custom-control {
    padding-top: 0.5rem;
}

/* Enhanced icon alignment for V2 components */
.attr-v2-action-buttons .hi-icon-left,
.attr-v2-file-actions .hi-icon,
.attr-v2-attribute-actions .hi-icon {
    vertical-align: middle;
}

.attr-v2-action-buttons button .hi-icon-left,
.attr-v2-action-buttons a.btn .hi-icon-left {
    margin-right: 0.5rem;
}

/* ====================================================================== */
/* SECRET FIELD STYLING                                                  */
/* ====================================================================== */

.attr-v2-secret-field {
    position: relative;
}

.attr-v2-secret-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.attr-v2-secret-input-wrapper input,
.attr-v2-secret-input-wrapper textarea {
    flex: 1;
    padding-right: 44px; /* Space for toggle button */
}

.attr-v2-secret-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    min-width: 36px;
    height: 36px;
    border: 1px solid #ced4da;
    background: var(--background-color);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attr-v2-secret-toggle:hover {
    background: var(--hover-background-color);
    border-color: #adb5bd;
}

.attr-v2-secret-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

/* Secret field in hidden state */
.attr-v2-secret-field.hidden input,
.attr-v2-secret-field.hidden textarea {
    -webkit-text-security: disc;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

/* Fallback for browsers that don't support text-security */
.attr-v2-secret-field.hidden input:not([type="password"]),
.attr-v2-secret-field.hidden textarea {
    color: transparent;
    text-shadow: 0 0 0 #495057;
}

/* Touch device optimizations */
@media (max-width: 768px) {
    .attr-v2-secret-toggle {
        min-width: 44px;
        height: 44px;
    }
}

/* Secret field readonly visual indicators */
.attr-v2-secret-input[readonly] {
    background-color: #f8f9fa;
    cursor: default;
    border-color: #dee2e6;
}

.attr-v2-secret-input[readonly]:focus {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    box-shadow: none;
}

/* When secret field is editable (shown), give it normal input styling */
.attr-v2-secret-input[type="text"]:not([readonly]) {
    background-color: #ffffff;
    cursor: text;
}

.attr-v2-secret-input[type="text"]:not([readonly]):focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(23, 112, 114, 0.25);
}

/* Secret checkbox positioning and alignment */
.attr-v2-secret-checkbox {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}

.attr-v2-secret-checkbox .custom-control {
    display: flex;
    align-items: center;
}

.attr-v2-secret-checkbox .custom-control-label {
    line-height: 1;
    padding-top: 0;
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* ====================================================================== */
/* V2 DIRTY STATE TRACKING STYLING                                       */
/* ====================================================================== */

/* Dirty message area in sticky panel */
.attr-v2-dirty-message {
    font-size: 0.875rem;
    color: transparent;
    transition: all 0.2s ease-in-out;
    min-width: 120px;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.attr-v2-dirty-message.active {
    color: #8B4513; /* Darker brown text for better contrast */
    background-color: #FFF3CD; /* Light warning background */
    border-left: 3px solid var(--warning-color);
    font-weight: 500;
}

/* Field-level dirty indicators */
.attr-v2-field-dirty {
    border-left: 3px solid var(--warning-color) !important;
    background-color: rgba(255, 193, 7, 0.05) !important;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.attr-v2-field-dirty:focus {
    border-left-color: var(--primary-color) !important;
    box-shadow: -3px 0 0 0 var(--primary-color), 0 0 0 0.2rem rgba(23, 112, 114, 0.25);
}

/* Dirty indicator dot */
.attr-v2-dirty-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    color: var(--warning-color);
    font-size: 0.75rem;
    font-weight: bold;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

/* Attribute name dirty styling - fallback approach for broader browser support */
.attr-v2-attribute-name.has-dirty-indicator {
    font-weight: 600;
    color: var(--warning-color);
}

/* Entity name dirty styling - fallback approach */
.form-group.has-dirty-field small {
    color: var(--warning-color);
    font-weight: 500;
}

/* Modern browser support with :has() */
@supports selector(:has(*)) {
    .attr-v2-attribute-name:has(.attr-v2-dirty-indicator) {
        font-weight: 600;
        color: var(--warning-color);
    }
    
    .form-group:has(.attr-v2-field-dirty) small {
        color: var(--warning-color);
        font-weight: 500;
    }
    
    .attr-v2-new-attribute .attr-v2-attribute-name:has(.attr-v2-dirty-indicator) {
        color: var(--primary-color);
    }
}

/* New attribute form dirty state - different styling */
.attr-v2-new-attribute .attr-v2-field-dirty {
    border-left-color: var(--primary-color) !important;
    background-color: rgba(23, 112, 114, 0.08) !important;
}

.attr-v2-new-attribute .attr-v2-dirty-indicator {
    color: var(--primary-color);
}

.attr-v2-new-attribute .attr-v2-attribute-name.has-dirty-indicator {
    color: var(--primary-color);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .attr-v2-dirty-indicator {
        animation: none;
        opacity: 1;
    }
    
    .attr-v2-field-dirty,
    .attr-v2-dirty-message {
        transition: none;
    }
}

/* ====================================================================== */
/* ADD ATTRIBUTE FORM STYLING                                             */
/* ====================================================================== */

.attr-v2-add-form {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: var(--background-color);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.attr-v2-add-form.collapsed {
    display: none;
}

.attr-v2-add-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--highlight-background-color);
    border-bottom: 1px solid #dee2e6;
}

.attr-v2-add-form-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--text-color);
}

.attr-v2-add-form-content {
    padding: 1rem;
}

.attr-v2-add-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* ====================================================================== */
/* COMPACT BASIC INFO HEADER                                              */
/* ====================================================================== */

.attr-v2-basic-info {
    background: var(--white);
    border: 1px solid var(--line-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.attr-v2-basic-info .row {
    margin-left: -0.375rem;
    margin-right: -0.375rem;
}

.attr-v2-basic-info [class*="col-"] {
    padding-left: 0.375rem;
    padding-right: 0.375rem;
}

/* Force block layout for labels - very specific selector */
.attr-v2-basic-info .form-group small,
.attr-v2-basic-info .form-group .text-muted,
.attr-v2-basic-info small,
.attr-v2-basic-info .text-muted {
    display: block !important;
    font-size: 0.75rem !important;
    color: var(--muted-color) !important;
    margin-bottom: 0.25rem !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    width: 100% !important;
    line-height: 1 !important;
    clear: both !important;
}

.attr-v2-basic-info .form-control-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
    height: calc(1.5em + 0.75rem + 2px);
    width: 100%; /* Ensure full width */
}

.attr-v2-basic-info .form-control {
    width: 100%; /* Ensure full width for all form controls */
}

.attr-v2-basic-info select.form-control-sm {
    padding-right: 1.75rem;
    background-position: right 0.375rem center;
    background-size: 16px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure columns don't break layout */
.attr-v2-basic-info .col-md-8,
.attr-v2-basic-info .col-md-4,
.attr-v2-basic-info .col-sm-6 {
    min-width: 0; /* Allow flex shrinking */
}

/* Remove bottom margin from form groups in header */
.attr-v2-basic-info .form-group {
    margin-bottom: 0;
}

/* Error state styling */
.attr-v2-basic-info .form-control.is-invalid,
.attr-v2-basic-info .form-control:invalid {
    border-color: var(--danger-color);
}

.attr-v2-basic-info .invalid-feedback {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ====================================================================== */
/* ERROR MESSAGE STYLING                                                  */
/* ====================================================================== */

/* Non-field errors container - page level (owner form) */
.attr-v2-sticky-panel .attr-v2-non-field-errors {
    border-left: 3px solid #dc2626;
    padding-left: 1rem;
    margin: 0.5rem 0;
}

.attr-v2-sticky-panel .attr-v2-non-field-errors .attr-v2-error-item {
    color: #dc2626;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.attr-v2-sticky-panel .attr-v2-non-field-errors .attr-v2-error-item:before {
    content: "•";
    color: #dc2626;
    font-weight: bold;
    flex-shrink: 0;
}

/* Formset non-form errors (same style as owner non-field errors) */
.attr-v2-formset-errors {
    border-left: 3px solid #dc2626;
    padding-left: 1rem;
    margin: 0.5rem 0;
}

.attr-v2-formset-errors .attr-v2-error-item {
    color: #dc2626;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.attr-v2-formset-errors .attr-v2-error-item:before {
    content: "•";
    color: #dc2626;
    font-weight: bold;
    flex-shrink: 0;
}

/* Non-field errors - individual attribute card level (most subtle) */
.attr-v2-attribute-card .attr-v2-non-field-errors {
    margin: 0.5rem 0 0 0;
    padding: 0;
}

.attr-v2-attribute-card .attr-v2-non-field-errors .attr-v2-error-item {
    color: #dc2626;
    font-size: 0.8125rem;
    margin: 0.25rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
}

.attr-v2-attribute-card .attr-v2-non-field-errors .attr-v2-error-item:before {
    content: "•";
    color: #dc2626;
    font-weight: bold;
    flex-shrink: 0;
}

/* Field-level errors */
.attr-v2-field-errors {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.attr-v2-field-errors .attr-v2-error-text {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
}

.attr-v2-field-errors .attr-v2-error-text:before {
    content: "•";
    color: #dc2626;
    font-weight: bold;
    flex-shrink: 0;
}

/* Invalid form controls */
.attr-v2-attribute-card .form-control.is-invalid,
.attr-v2-basic-info .form-control.is-invalid {
    border-color: #dc2626;
    background-image: none;
}

.attr-v2-attribute-card .form-control.is-invalid:focus,
.attr-v2-basic-info .form-control.is-invalid:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

/* ====================================================================== */
/* INLINE HISTORY STYLING                                                */
/* ====================================================================== */

.attr-v2-inline-history {
    margin-top: 0.75rem;
}

.attr-v2-history-inline-content {
    background: var(--highlight-background-color);
    border: 1px solid var(--line-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 0.875rem;
}

.attr-v2-history-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.attr-v2-history-close {
    color: var(--danger-color);
    text-decoration: none;
}

.attr-v2-history-close:hover {
    color: var(--danger-color);
    text-decoration: none;
}

.attr-v2-history-current {
    font-size: 0.8125rem;
}

.attr-v2-history-current .badge-primary {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.attr-v2-history-toggle .btn-link {
    color: var(--text-color);
    text-decoration: none;
}

.attr-v2-history-toggle .btn-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.attr-v2-history-record {
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.attr-v2-history-record:last-child {
    border-bottom: none;
}

.attr-v2-history-record .badge {
    font-size: 0.75rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
}

.attr-v2-history-current .badge {
    font-size: 0.75rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
}

.attr-v2-history-record .btn-xs {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    line-height: 1.2;
}

.attr-v2-history-toggle {
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.attr-v2-history-empty {
    text-align: center;
    padding: 1rem 0;
    color: var(--muted-color);
}

/* ====================================================================== */
/* DELETION STATES WITH WATERMARKS                                       */
/* ====================================================================== */

/* File Card Deletion Styling */
.attr-v2-file-card.marked-for-deletion {
    opacity: 0.9;
    transition: all 0.3s ease;
}

.attr-v2-file-card.marked-for-deletion .attr-v2-file-thumbnail {
    position: relative;
    background: linear-gradient(rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.1)), 
                repeating-linear-gradient(45deg, #f8f9fa, #f8f9fa 10px, #e9ecef 10px, #e9ecef 20px);
}

.attr-v2-file-card.marked-for-deletion .attr-v2-file-thumbnail::after {
    content: "PENDING DELETION";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--danger-color);
    opacity: 0.3;
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.attr-v2-file-card.marked-for-deletion .attr-v2-file-info {
    border-color: var(--danger-color);
    background: rgba(220, 53, 69, 0.05);
}

/* Attribute Card Deletion Styling */
.attr-v2-attribute-card.marked-for-deletion {
    position: relative;
    background: rgba(220, 53, 69, 0.05);
    border-left: 4px solid var(--danger-color);
    overflow: hidden;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.attr-v2-attribute-card.marked-for-deletion::after {
    content: "PENDING DELETION";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger-color);
    opacity: 0.1;
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

/* Keep inputs interactive but let watermark show through */
.attr-v2-attribute-card.marked-for-deletion .form-control,
.attr-v2-attribute-card.marked-for-deletion textarea,
.attr-v2-attribute-card.marked-for-deletion input {
    position: relative;
    background-color: rgba(255, 255, 255, 0.9);
}

/* Undo button visibility when marked for deletion */
.marked-for-deletion .attr-v2-delete-btn {
    display: none !important;
}

.marked-for-deletion .attr-v2-undo-btn {
    display: inline-flex !important;
}

/* ====================================================================== */
/* ENTITY EDIT MODAL V2 STYLING                                          */
/* ====================================================================== */

/* Delete icon colors standardized to red */
.attr-v2-attribute-actions .attr-v2-delete-btn {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.attr-v2-attribute-actions .attr-v2-delete-btn:hover {
    background-color: #dc3545 !important;
    color: white !important;
}

/* "Add New Attribute" form -- visual distinction */
.attr-v2-new-attribute {
    background-color: rgba(23, 112, 114, 0.05) !important;
    border: 2px dashed rgba(23, 112, 114, 0.3) !important;
    border-radius: 8px;
}

.attr-v2-new-attribute .attr-v2-attribute-header h6 {
    color: var(--primary-color);
    font-weight: 600;
    font-style: italic;
}


/* Add File and Add Attribute buttons -- consistent size */
.attr-v2-action-buttons label.btn {
    min-height: 44px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    cursor: pointer;
}

/* Attribute names/labels -- more prominent than values */
.attr-v2-attribute-name {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: var(--primary-text-color) !important;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

/* Touch device optimizations */
@media (max-width: 768px) {

    .attr-v2-add-form-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
}

/* External-data view (attr-ext-*) */

.attr-ext-header {
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: var(--info-bg-light);
    border-left: 3px solid var(--secondary-color);
    border-radius: 0.375rem;
}

.attr-ext-header__brand {
    gap: 0.5rem;
}

.attr-ext-header__logo {
    height: 16px;
    width: auto;
}

.attr-ext-attachments {
    margin-bottom: 1.5rem;
}

.attr-ext-attachment__link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.attr-ext-attachment__link:hover,
.attr-ext-attachment__link:focus {
    color: inherit;
    text-decoration: none;
}

.attr-ext-attribute-list {
    margin-top: 0.5rem;
}

.attr-ext-attribute-card:hover,
.attr-ext-attribute-card:focus-within {
    border-color: var(--line-color);
    box-shadow: none;
}

.attr-ext-value {
    font-size: 0.9rem;
    color: var(--primary-text-color);
    white-space: pre-wrap;
    word-break: break-word;
}

.attr-ext-value--clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.attr-ext-more {
    padding-left: 0;
}

/* ====================================================================== */
/* ATTRIBUTE_REFERENCE picker                                             */
/* ====================================================================== */

/* Bootstrap's modal-dialog-scrollable shrinks the flex children of
   modal-content to fit the constrained height. The default Bootstrap
   markup has .modal-header / .modal-footer with flex-shrink:0 so only
   .modal-body shrinks; this project uses .modal-title in place of
   .modal-header, so we re-establish the contract here for any modal
   that opts into scrollable behavior. */
.modal-dialog-scrollable .modal-title,
.modal-dialog-scrollable .modal-footer {
    flex-shrink: 0;
}

/* The picker modal opts into Bootstrap's modal-dialog-scrollable so the
   modal-body is the scroll container while the header and footer stay
   anchored. Pin the search controls to the top edge of the body so the
   operator can refine their query at any scroll position without
   scrolling back up to find the search row. */
.hi-ref-picker-search-form {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--background-color, #fff);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Zero the modal-body's top padding so the sticky search form is flush
   against the title -- otherwise modal-body's default padding-top shows
   scrolling content through the gap above the sticky element. The
   search form supplies its own padding-top for breathing room. */
.hi-ref-picker .modal-body {
    padding-top: 0;
}

/* Source banner -- always rendered. With one source the button is
   disabled (no caret, no hover affordance) so the visual matches
   the multi-source case structurally but doesn't invite a click
   that does nothing useful. The button face shows the source's
   logo on a light background; native logos meant for white render
   correctly here. */
.hi-ref-picker-source-banner {
    background-color: #fff;
    border: 1px solid var(--line-color, #dee2e6);
    padding: 0.5rem 0.75rem;
}
.hi-ref-picker-source-banner-logo {
    max-height: 24px;
    width: auto;
}
.hi-ref-picker-source-banner-label {
    font-weight: 500;
}
.hi-ref-picker-source-banner-single .dropdown-toggle::after {
    display: none;
}
.hi-ref-picker-source-banner-single .dropdown-toggle:disabled {
    opacity: 1;
    cursor: default;
}
.hi-ref-picker-source-option img {
    max-height: 20px;
    width: auto;
}

/* Hover-zoom for picker result thumbnails. Pure CSS: the wrapper
   carries a hidden native-size sibling image; ``:hover`` reveals
   it. ``pointer-events: none`` keeps the zoom from intercepting
   clicks on the row text it overlaps. ``z-index`` puts it above
   sibling rows but stays inside the modal body's scroll area;
   tall rows near the bottom can clip. */
.hi-ref-picker-thumb {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.hi-ref-picker-thumb-small {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
}
.hi-ref-picker-thumb-zoom {
    display: none;
    position: absolute;
    left: 64px;
    top: 0;
    max-width: 320px;
    max-height: 320px;
    background: #fff;
    border: 1px solid #6c757d;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
    z-index: 10;
    pointer-events: none;
}
.hi-ref-picker-thumb:hover .hi-ref-picker-thumb-zoom {
    display: block;
}

/* Second hover trigger: the source-URL link in the row's text area
   also reveals the same zoom. ``:has()`` lets a sibling-of-thumb
   trigger (the link is in a deeper subtree) bubble back up and
   match the row, so a single zoom element serves both triggers. */
.hi-ref-picker-row:has(.hi-ref-picker-source-link:hover)
        .hi-ref-picker-thumb-zoom {
    display: block;
}