/* Muuri Grid Styles - Overhaul v3 - Enhanced Layouts */

:root {
    /* Artifact Type Colors - Modern & Vibrant Palette */
    --type-text-color: #6366f1;        /* Indigo - Plain text */
    --type-markdown-color: #ef4444;    /* Red - Markdown */
    --type-html-color: #8b5cf6;        /* Purple - HTML */
    --type-code-color: #10b981;        /* Emerald - Code */
    --type-image-color: #ec4899;       /* Pink - Images */
    --type-audio-color: #f59e0b;       /* Amber - Audio */
    --type-video-color: #a855f7;       /* Purple - Video */
    --type-file-color: #f97316;        /* Orange - Files */
    --type-email-color: #3b82f6;       /* Blue - Email */
    --type-drive-color: #22c55e;       /* Green - Drive */
    --type-calendar-color: #06b6d4;    /* Cyan - Calendar */
    --type-pdf-color: #dc2626;         /* Deep Red - PDF */
    --type-spreadsheet-color: #059669; /* Teal - Spreadsheet */
    --type-presentation-color: #ea580c; /* Deep Orange - Presentation */
    
}

/* ============================================
   NESTED ASSET BADGES - Compact Tag Display
   ============================================ */

/* Pending state - hidden until expanded */
.artifact-asset-badges.asset-badges-pending {
    display: none;
}

/* Badges container - compact flex layout */
.artifact-asset-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    border-top: 1px solid var(--border-color-subtle);
    background: var(--bg-surface-tertiary);
}

/* Nested Asset Badge - Compact auto-fit card */
.nested-asset-badge {
    display: inline-flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.15s ease;
}

.nested-asset-badge:hover {
    border-color: var(--primary-color);
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.15);
}

.nested-asset-badge.has-highlighted-tag {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.nested-asset-badge.no-highlighted-tag {
    opacity: 0.4;
}

/* Focused asset badge (bidirectional sync with graph) */
.nested-asset-badge.graph-focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.05);
}

.nested-tag.graph-focused {
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* Asset Header - Compact */
.nested-asset-header {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    cursor: pointer;
    background: var(--bg-surface);
    transition: background 0.15s;
    line-height: 1.2;
}

.nested-asset-header:hover {
    background: var(--bg-surface-secondary);
}

.nested-asset-header .asset-icon {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    font-size: 0.6rem;
    flex-shrink: 0;
}

.nested-asset-header .asset-name {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    flex: 1;
}

/* Asset Delete Button */
.nested-asset-header .asset-delete-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: auto;
    padding: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.7rem;
    transition: all 0.15s ease;
}

.nested-asset-badge:hover .asset-delete-btn {
    display: flex;
}

.nested-asset-header .asset-delete-btn:hover {
    background: var(--danger-color, #dc3545);
    color: white;
}

/* Quick Add Asset Button - inline with badges */
.asset-quick-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.asset-quick-add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

/* Quick Add Dropdown */
.asset-quick-add-dropdown {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 280px;
    overflow: hidden;
}

.asset-quick-add-search {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color-subtle);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
}

.asset-quick-add-search:focus {
    background: var(--bg-surface-secondary);
}

.asset-quick-add-results {
    max-height: 200px;
    overflow-y: auto;
}

.asset-quick-add-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s ease;
}

.asset-quick-add-item:hover {
    background: var(--bg-surface-secondary);
}

.asset-quick-add-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

/* Nested Tags - Compact flexbox (no Muuri) */
.nested-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px 4px 3px 4px;
    background: var(--bg-surface-secondary);
}

/* Individual Nested Tag - Minimal */
.nested-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.55rem;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border-color-subtle);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.3;
}

.nested-tag i {
    font-size: 0.45rem;
    opacity: 0.6;
}

.nested-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nested-tag.tag-highlighted {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.nested-tag.tag-dimmed {
    opacity: 0.35;
}

/* Legacy/deprecated styles */
.nested-tag-item,
.rel-color-bar,
.rel-bar-segment,
.asset-relationship-group {
    display: none;
}

/* Legacy support for flat badges */
.asset-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.72rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid var(--border-color-subtle);
    max-width: 180px;
    position: relative;
}

.asset-badge .asset-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
}

.asset-badge:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.asset-badge.highlighted {
    background: var(--badge-highlight, var(--primary-color));
    color: white;
    border-color: var(--badge-highlight, var(--primary-color));
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    z-index: 2;
}

.asset-badge.related-highlighted {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.asset-badge .asset-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Relationship color indicators */
.asset-badge .rel-colors {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
}

.asset-badge .rel-color-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s;
}

.asset-badge:hover .rel-color-dot {
    background: white !important;
}

/* Tag count badge */
.asset-badge .asset-tag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    border-radius: 7px;
    font-size: 0.6rem;
    font-weight: 600;
    background: var(--bg-surface-secondary);
    color: var(--text-muted);
    margin-left: 2px;
}

.asset-badge:hover .asset-tag-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Tag Chips Container (legacy, mostly unused now) */
.artifact-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 12px 8px 12px;
    background: var(--bg-surface-tertiary);
}

/* Relationship Chips - Color coded */
.relationship-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 500;
    background: var(--chip-bg, rgba(99, 102, 241, 0.1));
    color: var(--chip-text, #4f46e5);
    border: 1px solid var(--chip-border, #6366f1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.relationship-chip:hover {
    background: var(--chip-border, #6366f1);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.relationship-chip i {
    font-size: 0.7rem;
}

.relationship-chip .chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    border-radius: 7px;
    font-size: 0.55rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.3);
    margin-left: 2px;
}

.relationship-chip:hover .chip-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Tag Chips */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border-color-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-chip:hover {
    background: var(--text-secondary);
    color: white;
    border-color: var(--text-secondary);
}

.tag-chip i {
    font-size: 0.6rem;
    opacity: 0.7;
}

.tag-chip .chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12px;
    height: 12px;
    padding: 0 3px;
    border-radius: 6px;
    font-size: 0.5rem;
    font-weight: 600;
    background: var(--bg-surface-secondary);
    margin-left: 2px;
}

.tag-chip:hover .chip-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Hide badges/chips when options are disabled */
[data-show-asset-badges="false"] .artifact-asset-badges {
    display: none !important;
}

[data-show-tag-chips="false"] .artifact-tag-chips {
    display: none !important;
}

/* ============================================
   LAYOUT MODES
   ============================================ */

/* Cards Layout (Default) - Rich preview cards */
[data-layout="cards"] .grid-item {
    /* Default sizing already handled */
}

/* ============================================
   COMPACT LAYOUT - Dense row-based view
   ============================================ */
[data-layout="compact"] .grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Override Muuri's inline height so flex items aren't constrained */
    height: auto !important;
}

[data-layout="compact"] .grid-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: calc(100% - 20px) !important;
    height: 56px !important;
    min-height: 56px !important;
    max-width: none;
    transform: none !important;
    margin: 2px 10px;
    overflow: hidden !important;
    /* Prevent flex shrinking so items maintain 56px height */
    flex-shrink: 0 !important;
}

[data-layout="compact"] .grid-item .grid-item-content {
    flex-direction: row;
    height: 56px !important;
    max-height: 56px !important;
    align-items: center;
    overflow: hidden !important;
}

[data-layout="compact"] .grid-item .grid-item-header {
    width: 240px;
    min-width: 240px;
    border-bottom: none;
    border-right: 1px solid var(--border-color-subtle);
    height: 100% !important;
    max-height: 56px !important;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    overflow: hidden !important;
}

[data-layout="compact"] .grid-item .grid-item-header .tile-title-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

[data-layout="compact"] .grid-item .grid-item-body {
    flex: 1;
    padding: 8px 16px;
    overflow: hidden !important;
    height: 100% !important;
    max-height: 56px !important;
    display: flex;
    align-items: center;
    mask-image: none;
    -webkit-mask-image: none;
}

/* Compact: Show only first child element (excerpt), hide the rest */
[data-layout="compact"] .grid-item .grid-item-body > *:not(:first-child) {
    display: none !important;
}

/* Compact: Style the single visible element */
[data-layout="compact"] .grid-item .grid-item-body > *:first-child {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

[data-layout="compact"] .grid-item .grid-item-body p,
[data-layout="compact"] .grid-item .grid-item-body pre {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-layout="compact"] .grid-item .grid-item-footer {
    display: none;
}

/* Compact - Metadata column */
[data-layout="compact"] .compact-metadata {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 180px;
    border-left: 1px solid var(--border-color-subtle);
    height: 100%;
}

[data-layout="compact"] .compact-metadata .meta-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Compact - Asset badges inline */
[data-layout="compact"] .artifact-asset-badges {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
    width: auto;
    min-width: 120px;
    max-width: 250px;
    border-top: none;
    border-left: 1px solid var(--border-color-subtle);
    padding: 4px 12px;
    height: 100%;
    align-items: center;
    background: transparent;
}

/* Compact - Simpler badges */
[data-layout="compact"] .asset-badge {
    padding: 2px 6px;
    font-size: 0.65rem;
    max-width: 100px;
}

[data-layout="compact"] .asset-badge .rel-colors,
[data-layout="compact"] .asset-badge .asset-tag-count {
    display: none;
}

/* Compact - Hide nested structure, show simplified */
[data-layout="compact"] .asset-relationship-group {
    padding: 2px 6px;
    gap: 4px;
}

[data-layout="compact"] .relationship-label {
    display: none;
}

[data-layout="compact"] .asset-connector {
    display: none;
}

[data-layout="compact"] .nested-asset-badge {
    flex-direction: row;
    max-width: 100px;
}

[data-layout="compact"] .nested-asset-header {
    padding: 2px 6px;
}

[data-layout="compact"] .nested-asset-header .nested-toggle,
[data-layout="compact"] .nested-asset-header .rel-color-bar {
    display: none;
}

[data-layout="compact"] .nested-tags {
    display: none !important;
}

[data-layout="compact"] .artifact-tag-chips {
    display: none;
}

/* Compact - Quick actions visible on hover */
[data-layout="compact"] .grid-item .header-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

[data-layout="compact"] .grid-item:hover .header-actions {
    opacity: 1;
}

/* Highlighted tile (when hovering related asset) */
.grid-item.relationship-highlight {
    outline: 2px solid var(--highlight-color, var(--primary-color));
    outline-offset: 2px;
    z-index: 60 !important;
    transition: outline-color 0.2s, opacity 0.25s, transform 0.2s;
}

.grid-item.relationship-highlight .grid-item-content {
    background: var(--bg-surface);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.grid-item.relationship-dimmed {
    opacity: 0.25;
    filter: grayscale(30%);
    transition: opacity 0.25s, filter 0.25s;
    pointer-events: none;
}

/* Graph-triggered highlighting (from knowledge graph selection) */
.grid-item.graph-highlighted {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
    z-index: 60 !important;
    transition: outline-color 0.2s, opacity 0.25s, transform 0.2s;
}

.grid-item.graph-highlighted .grid-item-content {
    background: var(--bg-surface);
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.25);
}

.grid-item.graph-dimmed {
    opacity: 0.2;
    filter: grayscale(40%);
    transition: opacity 0.25s, filter 0.25s;
}

/* Smooth transition back to normal state */
.grid-item {
    transition: opacity 0.25s ease, filter 0.25s ease, transform 0.3s ease;
}

/* ============================================
   EXISTING STYLES (Preserved)
   ============================================ */

.grid {
    position: relative;
    width: 100%;
    min-height: 200px;
}

/* Base Item */
.grid-item {
    position: absolute;
    width: 300px; /* Base width (Small) */
    max-width: calc(100% - 20px);
    margin: 10px;
    z-index: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Saving State for Grid Items */
.grid-item.saving {
    opacity: 0.7;
    pointer-events: none;
}

.grid-item.saving .grid-item-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: grid-saving-shimmer 1.5s infinite;
    z-index: 10;
}

@keyframes grid-saving-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

[data-theme="dark"] .grid-item.saving .grid-item-content::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.grid-item.muuri-item-dragging { z-index: 100; cursor: move; }
.grid-item.muuri-item-releasing { z-index: 99; }
.grid-item.muuri-item-hidden { z-index: 0; }

/* ============================================ */
/* Extraction Overlay - Per-artifact progress  */
/* ============================================ */

/* During extraction: allow clicking to view, but disable editing actions */
.grid-item.extracting {
    /* Allow read-only viewing during extraction */
    pointer-events: auto;
}

/* Disable drag handle during extraction */
.grid-item.extracting .grid-item-drag-handle {
    pointer-events: none;
    opacity: 0.3;
}

/* Disable action buttons during extraction */
.grid-item.extracting .grid-item-actions,
.grid-item.extracting .artifact-type-icon,
.grid-item.extracting .asset-quick-add-btn {
    pointer-events: none;
    opacity: 0.3;
}

/* Disable collapse toggle during extraction */
.grid-item.extracting .collapse-toggle {
    pointer-events: none;
}

.grid-item .extraction-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    z-index: 20;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    border-radius: 8px;
    gap: 8px;
}

.grid-item.extracting .extraction-overlay {
    display: flex;
}

.extraction-overlay .extraction-icon {
    font-size: 24px;
    color: var(--primary-color);
    animation: extraction-pulse 1.5s ease-in-out infinite;
}

.extraction-overlay .extraction-phase {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.extraction-overlay .extraction-message {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.extraction-overlay .extraction-progress-bar {
    width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.extraction-overlay .extraction-progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

@keyframes extraction-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Extraction complete flash animation */
.grid-item.extraction-complete .grid-item-content {
    animation: extraction-complete-flash 0.6s ease;
}

@keyframes extraction-complete-flash {
    0% { box-shadow: 0 0 0 0 rgba(var(--bs-success-rgb), 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(var(--bs-success-rgb), 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(var(--bs-success-rgb), 0); }
}

/* Extraction error state */
.grid-item.extraction-error .grid-item-content {
    animation: extraction-error-flash 0.6s ease;
}

@keyframes extraction-error-flash {
    0% { box-shadow: 0 0 0 0 rgba(var(--bs-danger-rgb), 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(var(--bs-danger-rgb), 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(var(--bs-danger-rgb), 0); }
}

/* ============================================ */

/* Drag Placeholder - Visual feedback for drop target */
.muuri-drag-placeholder {
    position: absolute;
    z-index: 50;
    background: var(--primary-color);
    opacity: 0.15;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    margin: 10px;
}

[data-theme="dark"] .muuri-drag-placeholder {
    background: var(--primary-color);
    opacity: 0.2;
}

/* Sizing Classes */
.grid-item.size-icon { width: 140px; height: 140px; } /* Tiny for Files/Images */
.grid-item.size-small { width: 300px; } /* Standard Small */
.grid-item.size-medium { width: 620px; } /* 2x + margin */
.grid-item.size-expanded { width: 940px; } /* 3x + margin (Large) */

/* Content Container */


/* Content Container */
.grid-item-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.grid-item-content:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: var(--border-color-hover);
}

/* --- Type Specific Styling --- */

/* Header Styling */
.grid-item-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color-subtle);
    background-color: var(--bg-surface-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary); /* Increased contrast */
    height: 40px;
}

/* Header Action Buttons - Normal text color matching card */
.grid-item-header .header-action-btn,
.grid-item-header .header-action-btn.btn-link,
.grid-item-header a.header-action-btn {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: color 0.15s ease;
}

.grid-item-header .header-action-btn:hover,
.grid-item-header .header-action-btn.btn-link:hover,
.grid-item-header a.header-action-btn:hover {
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

/* Override type-specific icon colors for header action buttons */
.grid-item .grid-item-header .header-action-btn .bi,
.grid-item .grid-item-header .header-action-btn i,
.grid-item[data-type] .grid-item-header .header-action-btn .bi {
    color: inherit !important;
}

/* Footer date styling */
.footer-date {
    font-size: 0.75rem;
}

/* Content type badge with icon */
.content-type-badge {
    font-size: 0.7rem;
}

.content-type-badge i {
    font-size: 0.65rem;
}

/* Embedding needed state - pulsing red text, clickable */
.content-type-badge.embedding-needed {
    color: var(--bs-danger) !important;
    cursor: pointer;
    animation: pulse-embedding 1.5s ease-in-out infinite;
}

.content-type-badge.embedding-needed:hover {
    text-decoration: underline;
}

@keyframes pulse-embedding {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Asset Count Badge (Visible in Both Modes) */
.asset-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-tertiary);
    color: var(--text-secondary); /* Increased contrast */
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.7rem;
}

/* Footer action buttons - matching header button styling */
.grid-item-footer .footer-action-btn,
.grid-item-footer .footer-action-btn.btn-link {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    transition: color 0.15s ease;
}

.grid-item-footer .footer-action-btn:hover,
.grid-item-footer .footer-action-btn.btn-link:hover {
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

/* Override icon colors for footer action buttons */
.grid-item .grid-item-footer .footer-action-btn .bi,
.grid-item .grid-item-footer .footer-action-btn i,
.grid-item[data-type] .grid-item-footer .footer-action-btn .bi {
    color: inherit !important;
}

/* Color Coding Borders */
.grid-item[data-type='Text'] .grid-item-content { border-top: 3px solid var(--type-text-color); }
.grid-item[data-type='Markdown'] .grid-item-content { border-top: 3px solid var(--type-markdown-color); }
.grid-item[data-type='Html'] .grid-item-content { border-top: 3px solid var(--type-html-color); }
.grid-item[data-type='Code'] .grid-item-content { border-top: 3px solid var(--type-code-color); }
.grid-item[data-type='Image'] .grid-item-content { border-top: 3px solid var(--type-image-color); }
.grid-item[data-type='Audio'] .grid-item-content { border-top: 3px solid var(--type-audio-color); }
.grid-item[data-type='Video'] .grid-item-content { border-top: 3px solid var(--type-video-color); }
.grid-item[data-type='File'] .grid-item-content { border-top: 3px solid var(--type-file-color); }
.grid-item[data-type='Email'] .grid-item-content { border-top: 3px solid var(--type-email-color); }
.grid-item[data-type='Drive'] .grid-item-content { border-top: 3px solid var(--type-drive-color); }
.grid-item[data-type='Calendar'] .grid-item-content { border-top: 3px solid var(--type-calendar-color); }
.grid-item[data-type='Pdf'] .grid-item-content { border-top: 3px solid var(--type-pdf-color); }
.grid-item[data-type='Spreadsheet'] .grid-item-content { border-top: 3px solid var(--type-spreadsheet-color); }
.grid-item[data-type='Presentation'] .grid-item-content { border-top: 3px solid var(--type-presentation-color); }

/* Body Styling */
.grid-item-body {
    padding: 12px;
    flex-grow: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Small/Icon Mode Body Styling - consistent height for collapsed tiles */
.grid-item.size-small .grid-item-body {
    height: 120px; /* Fixed height for consistency */
    max-height: 120px;
    overflow: hidden; /* Hide scrollbar */
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.grid-item.size-medium .grid-item-body {
    max-height: 200px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

/* Icon Mode Specifics */
.grid-item.size-icon .grid-item-header,
.grid-item.size-icon .grid-item-footer,
.grid-item.size-icon .grid-item-body {
    display: none;
}

.grid-item.size-icon .grid-item-content {
    border: none;
    background: transparent;
    align-items: center;
    justify-content: center;
}

/* Expanded Modes Body Styling */
.grid-item.size-expanded .grid-item-body {
    height: 600px;
}

/* Footer Styling */
.grid-item-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border-color-subtle);
    background-color: var(--bg-surface-tertiary);
    font-size: 0.75rem;
    color: var(--text-secondary); /* Increased contrast */
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
}

/* --- Specific Templates --- */

/* Image & File (Visual Tiles - collapsed mode) */
.grid-item.visual-tile .grid-item-content {
    border: none;
    background: #000;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

/* Visual tiles (size-icon only) - no longer used for size-small images */
.grid-item.visual-tile.size-icon {
    /* Icon size tiles are fixed 140x140 */
}

.grid-item.visual-tile .grid-item-header,
.grid-item.visual-tile .grid-item-footer,
.grid-item.visual-tile .artifact-asset-badges {
    display: none; /* Hidden by default for visual tiles */
}

/* Hide overlay in expanded mode - header is shown instead */
.grid-item.size-expanded .tile-overlay,
.grid-item.size-expanded .tile-actions {
    display: none;
}

/* Visual tile images (collapsed mode) - must fill container */
.grid-item.visual-tile .image-body {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    background: #000;
    cursor: pointer;
}

.grid-item.visual-tile .image-body img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Image body styling for card layout (non-visual-tile) */
.grid-item:not(.visual-tile) .image-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    min-height: 120px;
    flex: 1;
    cursor: default;
    border-radius: 4px;
    overflow: hidden;
}

/* Image constraints at size-small (card layout) - limit height for compact tile */
.grid-item.size-small:not(.visual-tile) .image-body {
    max-height: 160px;
}

.grid-item.size-small:not(.visual-tile) .image-body img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    width: auto;
    height: auto;
}

/* Image constraints at size-medium and larger */
.grid-item:not(.visual-tile):not(.size-small) .image-body img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    width: auto;
    height: auto;
}

.grid-item.size-expanded .image-body img {
    max-height: 600px;
}

/* File body styling */
.grid-item.visual-tile .file-body {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-secondary);
}

.grid-item:not(.visual-tile) .file-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-secondary);
    min-height: 150px;
    flex: 1;
}

.grid-item .file-body .file-preview {
    position: relative;
    width: auto;
    height: auto;
}

/* File Specific */
.grid-item.type-file .file-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-secondary);
    color: var(--text-muted);
    position: relative;
}

.grid-item.type-file .file-preview i {
    font-size: 4rem;
    opacity: 0.5;
}

/* Overlays for Visual Tiles */
.tile-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 20px 10px 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.grid-item:hover .tile-overlay {
    opacity: 1;
}

.tile-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: auto;
    z-index: 10;
}

/* Dropdown menu escapes card overflow */
.tile-actions .dropdown-menu {
    z-index: 1050 !important;
}

/* Allow dropdown to escape container when open - target all overflow containers */
.grid-item:has(.dropdown-menu.show) {
    z-index: 1000 !important;
    overflow: visible !important;
}

.grid-item:has(.dropdown-menu.show) .grid-item-content {
    overflow: visible !important;
}

.grid-item:hover .tile-actions {
    opacity: 1;
}

/* Email Specific */
.email-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color-subtle);
}
.email-subject { font-weight: bold; display: block; margin-bottom: 4px; }
.email-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Email fields in collapsed mode - truncate to single line */
.grid-item:not(.size-expanded) .email-header .email-from,
.grid-item:not(.size-expanded) .email-header .email-to,
.grid-item:not(.size-expanded) .email-header .email-cc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ============================================
   TYPE-SPECIFIC TILE STYLES
   ============================================ */

/* Calendar Event Tile */
.calendar-event-tile {
    min-height: 100px;
}

.calendar-date-badge {
    padding: 8px;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--type-calendar-color);
}

.grid-item[data-type='CalendarEvent'] .grid-item-content {
    border-top-color: var(--type-calendar-color);
}

/* Drive File Tile */
.drive-file-tile {
    min-height: 80px;
}

.drive-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
}

.grid-item[data-type='DriveFile'] .grid-item-content {
    border-top-color: var(--type-drive-color);
}

/* Audio Tile */
.audio-preview {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.audio-preview i {
    opacity: 0.9 !important;
    color: white;
}

.grid-item[data-type='Audio'] .grid-item-content {
    border-top-color: var(--type-audio-color);
}

/* Type-colored header icons */
.grid-item[data-type='Email'] .grid-item-type-icon { color: var(--type-email-color); }
.grid-item[data-type='Markdown'] .grid-item-type-icon { color: var(--type-markdown-color); }
.grid-item[data-type='Code'] .grid-item-type-icon { color: var(--type-code-color); }
.grid-item[data-type='Image'] .grid-item-type-icon { color: var(--type-image-color); }
.grid-item[data-type='File'] .grid-item-type-icon { color: var(--type-file-color); }
.grid-item[data-type='CalendarEvent'] .grid-item-type-icon { color: var(--type-calendar-color); }
.grid-item[data-type='DriveFile'] .grid-item-type-icon { color: var(--type-drive-color); }
.grid-item[data-type='Audio'] .grid-item-type-icon { color: var(--type-audio-color); }

/* Code Specific */
.grid-item.type-code .grid-item-body {
    font-family: 'Fira Code', monospace;
    background-color: var(--code-bg);
    color: var(--code-color);
    padding: 0;
}
.grid-item.type-code pre { margin: 0; padding: 12px; }

/* Related Assets Section */
.related-assets-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color-subtle);
    display: none;
}

.grid-item.size-expanded .related-assets-section {
    display: block;
}

.related-asset-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    background: var(--bg-surface-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
    color: var(--text-primary);
    text-decoration: none;
}
.related-asset-chip:hover {
    background: var(--bg-surface-secondary);
}

/* ==========================================================
   ARTIFACT EDITOR MODAL - Full-Screen Editor Styles
   ========================================================== */

/* Modal container adjustments - use class-based selectors for flexibility */
.modal-fullscreen .modal-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.modal-fullscreen .modal-header {
    flex-shrink: 0;
}

.modal-fullscreen .modal-footer {
    flex-shrink: 0;
}

/* Artifact metadata row styling */
.modal-fullscreen .artifact-metadata-row {
    flex-shrink: 0;
}

.modal-fullscreen .artifact-metadata-row .form-control {
    font-size: 0.95rem;
}

.modal-fullscreen .artifact-metadata-row textarea.form-control {
    line-height: 1.4;
}

/* Toolbar row styling */
.modal-fullscreen .editor-toolbar-row {
    flex-shrink: 0;
}

/* Editor wrapper - takes all remaining space */
.modal-fullscreen .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
}

/* Editor container fills modal body */
.modal-fullscreen .editor-container {
    height: 100%;
    min-height: 0;
    position: relative;
}

/* All editor wrappers - hidden by default (high specificity) */
.modal .editor-hidden {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    flex: 0 0 0 !important;
}

/* Active editor wrapper */
.modal .editor-active {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    flex: 1 1 auto !important;
}

.modal .editor-active-block {
    display: block !important;
    height: 100% !important;
    flex: 1 1 auto !important;
}

/* Plain Text Editor - Full Height */
.modal-fullscreen textarea.form-control.editor-active-block {
    height: 100% !important;
    min-height: 100% !important;
    border: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 1rem;
    flex: 1 1 auto;
}

.modal-fullscreen textarea.form-control:focus {
    box-shadow: none;
    outline: none;
}

/* Markdown Editor (EasyMDE) - Full Height */
.modal-fullscreen .markdown-editor-wrapper.editor-active {
    height: 100%;
    min-height: 0;
}

.modal-fullscreen .EasyMDEContainer {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
}

.modal-fullscreen .EasyMDEContainer .editor-toolbar {
    flex-shrink: 0;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 0;
    border-left: none;
    border-right: none;
}

/* Toolbar buttons - inline flex, no float */
.modal-fullscreen .EasyMDEContainer .editor-toolbar button,
.modal-fullscreen .EasyMDEContainer .editor-toolbar a {
    float: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px;
    height: 30px;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 4px !important;
}

/* Separator styling */
.modal-fullscreen .EasyMDEContainer .editor-toolbar i.separator {
    float: none !important;
    display: inline-block !important;
    width: 1px;
    height: 20px;
    margin: 0 6px !important;
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.2));
    border-right: none !important;
}

.modal-fullscreen .EasyMDEContainer .CodeMirror {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.modal-fullscreen .EasyMDEContainer .CodeMirror-scroll {
    min-height: 100%;
}

.modal-fullscreen .EasyMDEContainer .editor-statusbar {
    flex-shrink: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

/* EasyMDE side-by-side and preview in fullscreen */
.modal-fullscreen .EasyMDEContainer .editor-preview-side {
    border: none;
    border-left: 1px solid var(--border-color);
}

/* Rich Text Editor (Quill) - Full Height */
.modal-fullscreen .quill-editor-wrapper.editor-active {
    height: 100%;
    min-height: 0;
}

.modal-fullscreen .quill-editor-wrapper .ql-toolbar.ql-snow {
    flex-shrink: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

.modal-fullscreen .quill-editor-wrapper .ql-container.ql-snow {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    font-size: 1rem;
}

.modal-fullscreen .quill-editor-wrapper .ql-editor {
    min-height: 100%;
    padding: 1rem;
}

/* Code Editor (CodeMirror) - Full Height */
.modal-fullscreen .codemirror-editor-wrapper.editor-active-block {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.modal-fullscreen .codemirror-editor-wrapper .CodeMirror {
    height: 100% !important;
    font-size: 14px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* Dark Mode Adjustments for Editor Modal */
[data-theme="dark"] .modal-fullscreen .editor-toolbar-row {
    background-color: var(--bg-surface-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .modal-fullscreen textarea.form-control {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-fullscreen textarea.form-control::placeholder {
    color: var(--text-muted);
}

/* CodeMirror theme override for light mode */
[data-theme="light"] .modal-fullscreen .CodeMirror {
    background: #fff;
}

/* Badge styling */
.modal-fullscreen .badge {
    font-weight: normal;
    font-size: 0.75rem;
}

/* Status text */
.modal-fullscreen .modal-footer .text-muted {
    font-size: 0.8rem;
}

/* Name input validation */
.modal-fullscreen .form-control.is-invalid {
    border-color: var(--bs-danger);
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}


/* Resize Handle - Only visible on expanded tiles */
.resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    cursor: ns-resize;
    z-index: 10;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    touch-action: none; /* Prevent browser scrolling/gestures */
}

/* Show resize handle only on expanded tiles */
.grid-item.size-expanded .resize-handle {
    display: flex;
}

.resize-handle::after {
    content: '';
    width: 30px;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.grid-item.size-expanded .grid-item-content:hover .resize-handle::after {
    opacity: 0.5;
}

.resize-handle:hover::after {
    opacity: 1;
    background-color: var(--primary-color);
}

/* Type-Specific Icon Colors - Modern & Vibrant Palette */
.grid-item[data-type='Email'] .bi,
[data-type='Email'] .bi {
    color: var(--type-email-color);
}

.grid-item[data-type='Text'] .bi,
[data-type='Text'] .bi {
    color: var(--type-text-color);
}

.grid-item[data-type='Markdown'] .bi,
[data-type='Markdown'] .bi {
    color: var(--type-markdown-color);
}

.grid-item[data-type='Html'] .bi,
[data-type='Html'] .bi {
    color: var(--type-html-color);
}

.grid-item[data-type='Code'] .bi,
[data-type='Code'] .bi {
    color: var(--type-code-color);
}

.grid-item[data-type='Image'] .bi,
[data-type='Image'] .bi {
    color: var(--type-image-color);
}

.grid-item[data-type='Audio'] .bi,
[data-type='Audio'] .bi {
    color: var(--type-audio-color);
}

.grid-item[data-type='Video'] .bi,
[data-type='Video'] .bi {
    color: var(--type-video-color);
}

.grid-item[data-type='File'] .bi,
[data-type='File'] .bi {
    color: var(--type-file-color);
}

.grid-item[data-type='Drive'] .bi,
.grid-item[data-type='DriveFile'] .bi,
[data-type='Drive'] .bi,
[data-type='DriveFile'] .bi {
    color: var(--type-drive-color);
}

.grid-item[data-type='Calendar'] .bi,
.grid-item[data-type='CalendarEvent'] .bi,
[data-type='Calendar'] .bi,
[data-type='CalendarEvent'] .bi {
    color: var(--type-calendar-color);
}

.grid-item[data-type='Pdf'] .bi,
[data-type='Pdf'] .bi {
    color: var(--type-pdf-color);
}

.grid-item[data-type='Spreadsheet'] .bi,
[data-type='Spreadsheet'] .bi {
    color: var(--type-spreadsheet-color);
}

.grid-item[data-type='Presentation'] .bi,
[data-type='Presentation'] .bi {
    color: var(--type-presentation-color);
}

.grid-item.resizing {
    z-index: 1000 !important;
}

/* ============================================
   TEMPLATED REPORT STYLES
   ============================================ */
.grid-item[data-type='TemplatedReport'] .grid-item-type-icon {
    color: var(--primary-color);
}

.templated-report-body {
    padding: 0;
}

.templated-report-body .templated-report-container {
    padding: 12px;
}

.templated-report-body .templated-report-error {
    padding: 12px;
}

.templated-report-body .templated-report-header {
    border-bottom: 1px solid var(--border-color-subtle);
    margin-bottom: 12px;
    padding-bottom: 8px;
}

.templated-report-body .chart-container {
    margin-bottom: 16px;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    padding: 12px;
}

.templated-report-body .chart-container h5 {
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.templated-report-body .chart-container canvas {
    max-height: 200px;
}

/* Compact mode for templated reports */
[data-layout="compact"] .templated-report-body {
    max-height: 120px;
    overflow: hidden;
}

[data-layout="compact"] .templated-report-body .chart-container {
    display: none;
}

/* Expanded mode for templated reports */
.grid-item.size-expanded .templated-report-body {
    max-height: none;
}

.grid-item.size-expanded .templated-report-body .chart-container canvas {
    max-height: 300px;
}

/* ============================================
   HORIZONTAL LAYOUT MODE
   ============================================ */
#muuriGridContainer.horizontal-layout {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

#muuriGridContainer.horizontal-layout .grid {
    min-width: max-content;
    height: 100%;
}

/* Scrollbar styling for horizontal mode */
#muuriGridContainer.horizontal-layout::-webkit-scrollbar {
    height: 8px;
}

#muuriGridContainer.horizontal-layout::-webkit-scrollbar-track {
    background: var(--bg-surface-secondary, #f1f1f1);
    border-radius: 4px;
}

#muuriGridContainer.horizontal-layout::-webkit-scrollbar-thumb {
    background: var(--text-muted, #888);
    border-radius: 4px;
}

#muuriGridContainer.horizontal-layout::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #555);
}

