/* Gallery New Page Specific Styles */
:root {
    --sidebar-width: 280px;
    --gallery-gap: 16px;
    --gallery-primary: var(--primary, #667eea);
    --gallery-secondary: var(--primary-2, #764ba2);
    --gallery-surface: var(--bg-card, #ffffff);
    --gallery-surface-alt: var(--bg-body, #f8fafc);
    --gallery-border: var(--border-color, #e2e8f0);
    --gallery-text: var(--text-primary, #1e293b);
    --gallery-text-muted: var(--text-secondary, #64748b);
    --gallery-shadow: var(--shadow-md, 0 10px 20px rgba(0,0,0,0.12));
    --gallery-shadow-lg: var(--shadow-lg, 0 20px 40px rgba(0,0,0,0.18));
    --gallery-border-radius: var(--radius-md, 12px);
    --gallery-border-radius-lg: var(--radius-lg, 20px);
}

html[data-theme='dark'] {
    --gallery-surface: var(--bg-card, #1e293b);
    --gallery-surface-alt: var(--bg-body, #0f172a);
    --gallery-border: var(--border-color, #334155);
    --gallery-text: var(--text-primary, #f1f5f9);
    --gallery-text-muted: var(--text-secondary, #94a3b8);
}

/* Main Layout with Sidebar */
.gallery-layout {
    display: flex;
    gap: var(--space-lg, 1.5rem);
    min-height: calc(100vh - 200px);
    position: relative;
}

/* Sidebar Styles */
.gallery-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--gallery-surface);
    border-radius: var(--gallery-border-radius-lg);
    box-shadow: var(--gallery-shadow);
    border: 1px solid var(--gallery-border);
    padding: var(--space-lg, 1.5rem);
    position: sticky;
    top: var(--space-lg, 1.5rem);
    overflow-y: auto;
    /* Full height minus top margin and some padding */
    height: calc(100vh - var(--space-xl, 2rem) - 100px);
    max-height: calc(100vh - var(--space-xl, 2rem));
}

.sidebar-section {
    margin-bottom: var(--space-xl, 2rem);
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: var(--font-md, 1rem);
    font-weight: 600;
    color: var(--gallery-text);
    margin-bottom: var(--space-md, 1rem);
    display: flex;
    align-items: center;
    gap: var(--space-sm, 0.5rem);
}

.sidebar-title i {
    color: var(--gallery-primary);
}

.filter-item {
    display: flex;
    align-items: center;
    padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: var(--space-xs, 0.25rem);
    border: 1px solid transparent;
    color: var(--gallery-text);
    font-size: var(--font-sm, 0.875rem);
}

.filter-item:hover {
    background: var(--gallery-surface-alt);
    border-color: var(--gallery-border);
}

.filter-item.active {
    background: linear-gradient(135deg, var(--gallery-primary) 0%, var(--gallery-secondary) 100%);
    color: white;
    border-color: var(--gallery-primary);
    font-weight: 500;
}

.filter-item i {
    margin-right: var(--space-sm, 0.5rem);
    width: 20px;
    text-align: center;
}

.page-header-actions {
    position: absolute;
    right: var(--space-6, 1.5rem);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 10;
    pointer-events: auto;
}

@media (max-width: 992px) {
    .page-header-actions {
        position: static;
        transform: none;
        justify-content: center;
        margin-bottom: var(--space-sm, 0.5rem);
    }
}

/* Badge per conteggi nei filtri */
.filter-badge {
    margin-left: auto;
    background: var(--gallery-surface-alt);
    color: var(--gallery-text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.filter-item.active .filter-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.category-readonly-note {
    display: flex;
    align-items: center;
    gap: var(--space-xs, 0.25rem);
    margin-bottom: var(--space-sm, 0.5rem);
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--gallery-border);
    border-radius: var(--radius-sm, 4px);
    background: var(--gallery-surface-alt);
    color: var(--gallery-text-muted);
    font-size: var(--font-xs, 0.75rem);
}

.filter-item.category-readonly {
    cursor: pointer;
}

.filter-item.category-readonly::after {
    content: '🔒';
    margin-left: auto;
    opacity: 0.85;
    font-size: 0.72rem;
}

.filter-select {
    width: 100%;
    padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
    border: 1px solid var(--gallery-border);
    background: var(--gallery-surface-alt);
    color: var(--gallery-text);
    border-radius: var(--radius-sm, 4px);
    font-size: var(--font-sm, 0.875rem);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--space-sm, 0.5rem);
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--gallery-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
/* 🆕 Drag & Drop Category Zones */
.drag-drop-hint {
    font-size: var(--font-xs, 0.75rem);
    color: var(--gallery-text-muted);
    margin-bottom: var(--space-md, 1rem);
    font-style: italic;
    text-align: center;
}

.category-drop-zones {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm, 0.5rem);
}

.category-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs, 0.25rem);
    padding: var(--space-lg, 1.5rem);
    border: 2px dashed var(--gallery-border);
    border-radius: var(--radius-sm, 4px);
    background: var(--gallery-surface-alt);
    cursor: grab;
    transition: all 0.3s ease;
    min-height: 80px;
    font-size: var(--font-sm, 0.875rem);
    font-weight: 500;
    color: var(--gallery-text-muted);
    user-select: none;
}

.category-drop-zone:hover {
    border-color: var(--gallery-primary);
    background: rgba(102, 126, 234, 0.05);
    color: var(--gallery-primary);
    transform: scale(1.02);
}

.category-drop-zone.drag-over {
    border-color: var(--gallery-primary) !important;
    background: rgba(102, 126, 234, 0.15) !important;
    color: var(--gallery-primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2) !important;
    transform: scale(1.05) !important;
}

.category-drop-zone i {
    font-size: 1.5rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.category-drop-zone:hover i,
.category-drop-zone.drag-over i {
    opacity: 1;
}
/* Stats Bar in Sidebar */
.sidebar-stats {
    padding: var(--space-md, 1rem);
    background: var(--gallery-surface-alt);
    border-radius: var(--radius-sm, 4px);
    border: 1px solid var(--gallery-border);
    font-size: var(--font-xs, 0.75rem);
    color: var(--gallery-text-muted);
    line-height: 1.6;
}

.sidebar-stats strong {
    color: var(--gallery-text);
    font-weight: 600;
}

/* Hint sotto la griglia: altri elementi caricati con lo scroll (batch itemsPerPage) */
.gallery-scroll-hint {
    text-align: center;
    font-size: var(--font-xs, 0.8125rem);
    color: var(--gallery-text-muted);
    padding: 0.35rem 1rem 0.75rem;
    max-width: 40rem;
    margin: 0 auto;
    line-height: 1.45;
}

.gallery-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 0.5rem 1rem 1rem;
}

.gallery-load-more-wrap[hidden] {
    display: none !important;
}

/* Action Buttons in Sidebar */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 0.5rem);
}

.sidebar-btn {
    width: 100%;
    padding: var(--space-sm, 0.5rem) var(--space-md, 1rem);
    border: 1px solid var(--gallery-border);
    background: var(--gallery-surface);
    color: var(--gallery-text);
    border-radius: var(--radius-sm, 4px);
    font-size: var(--font-sm, 0.875rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs, 0.25rem);
}

.sidebar-btn:hover {
    background: var(--gallery-primary);
    color: white;
    border-color: var(--gallery-primary);
}

/* Gallery Main Content */
.gallery-main {
    flex: 1;
    min-width: 0;
}

/* Masonry Grid Layout */
.masonry-container {
    position: relative;
    min-height: 600px;
}

.masonry-grid {
    column-count: 4;
    column-gap: var(--gallery-gap);
    padding: var(--space-md, 1rem);
}

@media (max-width: 1400px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (max-width: 992px) {
    .masonry-grid {
        column-count: 2;
    }

    .gallery-layout {
        flex-direction: column;
    }

    .gallery-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 576px) {
    .masonry-grid {
        column-count: 1;
    }
}

/* Image Size Variants */
/* Extra-small: più colonne del preset "small" (~−40% larghezza vs standard) */
.masonry-grid.size-xsmall {
    column-count: 7;
}

.masonry-grid.size-small {
    column-count: 5; /* +1 column for smaller images */
}

.masonry-grid.size-large {
    column-count: 3; /* -1 column for larger images */
}

@media (max-width: 1400px) {
    .masonry-grid.size-xsmall {
        column-count: 6;
    }
    .masonry-grid.size-small {
        column-count: 4;
    }
    .masonry-grid.size-large {
        column-count: 2;
    }
}

@media (max-width: 992px) {
    .masonry-grid.size-xsmall {
        column-count: 4;
    }
    .masonry-grid.size-small {
        column-count: 3;
    }
    .masonry-grid.size-large {
        column-count: 1;
    }
}

@media (max-width: 576px) {
    .masonry-grid.size-xsmall,
    .masonry-grid.size-small,
    .masonry-grid.size-large {
        column-count: 1;
    }
}

/* Masonry Item */
.masonry-item {
    break-inside: avoid;
    margin-bottom: var(--gallery-gap);
    position: relative;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    background: var(--gallery-surface);
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.1));
    border: 1px solid var(--gallery-border);
    transition: all 0.3s ease;
    cursor: grab;
    user-select: none;
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--gallery-shadow-lg);
}

/* 🆕 Dragging state */
.masonry-item[draggable="true"] {
    cursor: grab;
}

.masonry-item[draggable="true"]:active {
    cursor: grabbing;
}

.masonry-item.dragging {
    opacity: 0.5;
    box-shadow: 0 0 0 2px var(--gallery-primary);
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

/* Item Info Overlay - solo metadata badges */
.masonry-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #764ba2 0%, rgba(241, 236, 242, 0.7) 50%, transparent 100%);
    color: white;
    padding: var(--space-lg, 0.15rem) var(--space-md, 0.5rem) var(--space-md, 0.5rem);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.masonry-item:hover .masonry-item-info {
    opacity: 1;
}

.item-metadata {
    font-size: var(--font-xs, 0.75rem);
    opacity: 0.95;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs, 0.25rem);
}

.meta-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm, 4px);
    font-weight: 500;
    white-space: nowrap;
}

.meta-provider {
    background: var(--gallery-primary);
}

.meta-size {
    background: var(--success, #10b981);
}

.meta-date {
    background: var(--info, #3b82f6);
}

/* Action Buttons on Items */
.item-actions {
    position: static;
    display: flex;
    gap: var(--space-xs, 0.25rem);
    margin-top: var(--space-sm, 0.25rem);
    z-index: 10;
}

.item-action-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--font-sm, 0.875rem);
}

.item-action-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md, 0 4px 8px rgba(0,0,0,0.2));
}

.btn-delete {
    color: var(--danger, #ef4444);
}

.btn-archive {
    color: var(--text-secondary, #6b7280);
}

.btn-info {
    color: var(--info, #3b82f6);
}

.btn-clone {
    color: var(--success, #10b981);
}

/* Loading States */
.gallery-loading {
    text-align: center;
    padding: var(--space-xl, 2rem);
    color: var(--gallery-text-muted);
    font-size: var(--font-md, 1rem);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--gallery-border);
    border-top-color: var(--gallery-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--space-lg, 1.5rem) auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal documenti: altezza piena */
.modal-dialog-document .modal-body {
    min-height: 75vh;
    display: flex;
    flex-direction: column;
}

.modal-dialog-document .modal-body .row {
    flex: 1;
    min-height: 0;
}

.modal-dialog-document .col-md-9 {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-dialog-document .content-preview-container {
    flex: 1;
    min-height: 0;
}

/* Enhanced Modal */
.modal-content {
    background: var(--gallery-surface);
    border: 1px solid var(--gallery-border);
    border-radius: var(--gallery-border-radius-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--gallery-primary) 0%, var(--gallery-secondary) 100%);
    color: white;
    border-bottom: none;
    border-radius: var(--gallery-border-radius-lg) var(--gallery-border-radius-lg) 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.content-preview-container {
    background: var(--gallery-surface-alt);
    min-height: 70vh;
    max-height: 85vh;
    height: 100%;
    display: flex;
    align-items: flex-start;
    vertical-align: top;
    justify-content: center;
    position: relative;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

/* Sfondo bianco/grigio chiarissimo per diagrammi (PNG/SVG trasparenti visibili) - override tema scuro */
#contentDetailModal.modal--diagram .col-md-9,
#contentDetailModal.modal--diagram .content-preview-container,
#contentDetailModal.modal--diagram .content-preview {
    background-color: #fafafa !important;
    background-image: none !important;
}

.content-preview {
    width: 100%;
    min-height: 70vh;
    max-height: 85vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
}

.content-preview img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--gallery-shadow-lg);
}

#modal-content-preview .modal-zoom-target {
    will-change: transform;
}

.content-preview-container--pannable {
    cursor: grab;
}

.content-preview-container--pannable .modal-zoom-target {
    cursor: inherit;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.content-preview-container--panning {
    cursor: grabbing;
}

.modal-zoom-controls {
    position: absolute;
    right: var(--space-md, 1rem);
    bottom: var(--space-md, 1rem);
    z-index: 15;
    display: flex;
    gap: var(--space-xs, 0.25rem);
    padding: var(--space-xs, 0.25rem);
    border-radius: var(--radius-sm, 4px);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-zoom-controls .btn {
    min-width: 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.modal-zoom-controls .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.content-preview video {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md, 12px);
}

.content-preview .report-pdf-iframe {
    min-height: 70vh;
}

.content-preview audio {
    width: 100%;
    margin: var(--space-lg, 1.5rem) 0;
}

.metadata-panel {
    background: var(--gallery-surface-alt);
    height: 80vh;
    overflow-y: auto;
    padding: var(--space-xl, 2rem);
}

.metadata-section {
    margin-bottom: var(--space-xl, 2rem);
}

.metadata-section-title {
    font-size: var(--font-md, 1rem);
    font-weight: 600;
    color: var(--gallery-text);
    margin-bottom: var(--space-md, 1rem);
    padding-bottom: var(--space-sm, 0.5rem);
    border-bottom: 2px solid var(--gallery-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm, 0.5rem);
}

.metadata-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md, 1rem);
}

/* Three column layout for compact metadata */
.metadata-grid.three-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm, 0.5rem);
}

.metadata-grid.three-columns .metadata-item {
    gap: var(--space-xs, 0.25rem);
}

/* Full width for filename and prompts */
.metadata-grid .metadata-item.full-width {
    grid-column: 1 / -1;
}

/* Copy button for prompts */
.copy-prompt-btn {
    background: var(--gallery-primary);
    color: white;
    border: none;
    padding: var(--space-xs, 0.25rem) var(--space-sm, 0.5rem);
    border-radius: var(--radius-sm, 4px);
    font-size: var(--font-xs, 0.75rem);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--space-xs, 0.25rem);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs, 0.25rem);
}

.copy-prompt-btn:hover {
    background: var(--gallery-secondary);
    transform: translateY(-1px);
}

.copy-prompt-btn:active {
    transform: translateY(0);
}

/* Prompt text areas */
.prompt-text {
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    word-break: break-word;
    line-height: 1.4;
}

.negative-prompt-text {
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
    word-break: break-word;
    line-height: 1.4;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs, 0.25rem);
}

.metadata-label {
    font-size: var(--font-xs, 0.75rem);
    font-weight: 600;
    color: var(--gallery-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-size: var(--font-sm, 0.875rem);
    color: var(--gallery-text);
    font-weight: 400;
    word-break: break-word;
    background: var(--gallery-surface);
    padding: var(--space-sm, 0.5rem);
    border-radius: var(--radius-sm, 4px);
    border: 1px solid var(--gallery-border);
}

.modal-footer {
    background: var(--gallery-surface-alt);
    border-top: 1px solid var(--gallery-border);
}

.metadata-divider {
    margin: var(--space-md, 1rem) 0;
    border-color: var(--gallery-border);
}

.metadata-recreate-action {
    margin-bottom: var(--space-md, 1rem);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl, 4rem) var(--space-xl, 2rem);
    color: var(--gallery-text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: var(--space-lg, 1.5rem);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--gallery-text);
    margin-bottom: var(--space-md, 1rem);
}

/* 3D Viewer Styles */
.viewer-3d-container {
    width: 100%;
    min-height: 800px;
    background: #0f0f13e7;
    border-radius: var(--gallery-border-radius);
    position: relative;
    overflow: hidden;
}

.viewer-3d-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.viewer-3d-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.viewer-3d-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.viewer-3d-controls button i {
    margin-right: 6px;
}

/* 3D Model Badge for masonry items */
.model-3d-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.model-3d-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.model-3d-preview-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

/* 3D Viewer nella masonry grid */
.model-3d-viewer-gallery {
    position: relative;
    min-height: 300px;
}

.model-3d-viewer-gallery canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.masonry-item:hover .model-3d-viewer-gallery {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Audio cards in masonry */
.masonry-item.audio-item {
    min-height: 190px;
}

.audio-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #764ba2;
    border-radius: 10px;
    padding: 12px;
    color: #e2e8f0;
}

.audio-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.audio-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #764ba2, #8978a8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.audio-icon i {
    color: white;
}

.audio-text {
    flex: 1;
    min-width: 0;
}

.audio-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-subtitle {
    font-size: 0.8rem;
    color: #764ba2;
}

.audio-player {
    width: 100%;
}

/* Report cards: layout unificato icona + tipo + nome (PDF, Word, MD) */
.report-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.report-card:hover {
    opacity: 0.92;
}

.report-card__icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.report-card__type {
    font-weight: 600;
    font-size: 0.95rem;
}

.report-card__name {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.report-card--md {
    border: 1px solid #e2e8f0;
}

.report-card--pdf {
    color: white !important;
}

.report-card--pdf .report-card__name {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Report aggregati: stessa card con iconcine PDF / MD / DOCX e unico nome sotto */
.masonry-item--report-aggregate .report-aggregate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    padding: 1rem;
    border-radius: 8px;
    background: var(--gallery-surface-alt, #f8fafc);
    border: 1px solid var(--gallery-border, #e2e8f0);
}

.report-aggregate-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.report-aggregate-icon {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-size: 1.35rem;
}

.report-aggregate-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.report-aggregate-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gallery-text, #1e293b);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.35;
    padding: 0 0.25rem;
}

.report-aggregate-meta {
    font-size: 0.7rem;
    color: var(--gallery-text-muted, #64748b);
    margin-top: 0.35rem;
}

.masonry-item--report-aggregate .masonry-item-info {
    border-top: 1px solid var(--gallery-border, #e2e8f0);
}

/* Report preview nel modale (MD, DOCX) - testo scuro su sfondo bianco, override tema dark */
.report-preview--md.markdown-content,
.report-preview--docx {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1e293b !important;
    background: #ffffff !important;
    min-height: 100%;
    flex: 1;
    overflow-y: auto;
}

.report-preview--md *,
.report-preview--docx * {
    color: inherit !important;
}

.report-preview--md a,
.report-preview--docx a {
    color: #2563eb !important;
}

.report-preview--md h1,
.report-preview--md h2,
.report-preview--md h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #0f172a !important;
}

.report-preview--docx p {
    margin-bottom: 0.5rem;
}

.report-preview--docx table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.report-preview--docx th,
.report-preview--docx td {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    color: #1e293b !important;
}
