/* ============================================================================
   av-file-preview.css — Modulo CSS estratto da av.html
   AIVEK Vision — Generato automaticamente
   ============================================================================ */

/* ========================================
   FILE PREVIEW MODAL & HIGHLIGHT SYSTEM
   ======================================== */
.file-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.file-preview-overlay.show {
    opacity: 1;
    visibility: visible;
}
.file-preview-modal {
    width: 90%;
    max-width: 900px;
    height: 85vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}
.file-preview-overlay.show .file-preview-modal {
    transform: scale(1) translateY(0);
}
.file-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.file-preview-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}
.file-preview-title i {
    font-size: 20px;
}
.file-preview-title span {
    font-size: 14px;
    font-weight: 600;
}
.file-preview-actions {
    display: flex;
    gap: 8px;
}
.file-preview-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.file-preview-btn.primary {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.file-preview-btn.primary:hover {
    background: rgba(255, 255, 255, 0.3);
}
.file-preview-btn.close {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    padding: 8px;
}
.file-preview-btn.close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.file-preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(102, 126, 234, 0.1);
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}
.file-preview-toolbar-left {
    display: flex;
    gap: 8px;
}
.file-preview-toolbar-btn {
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.file-preview-toolbar-btn:hover {
    background: rgba(102, 126, 234, 0.25);
    color: #fff;
}
.file-preview-toolbar-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}
.file-preview-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-preview-selection-count {
    font-size: 11px;
    color: #a5b4fc;
}
.file-preview-selection-count strong {
    color: #10b981;
}

.file-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.file-preview-content.pdf-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: #525659;
}
.pdf-page-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.pdf-page-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1);
    background: #fff;
}
.pdf-page-canvas {
    display: block;
}
.pdf-text-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    line-height: 1;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
}
.pdf-text-layer > span {
    color: transparent;
    position: absolute;
    white-space: nowrap;
    transform-origin: 0% 0%;
    cursor: text;
    user-select: text;
}
.pdf-text-layer > span::selection {
    background: rgba(0, 80, 255, 0.35);
    color: transparent;
}
.pdf-text-layer > span::-moz-selection {
    background: rgba(0, 80, 255, 0.35);
    color: transparent;
}
.pdf-page-number {
    margin-top: 10px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}
.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #aaa;
}
.pdf-loading i {
    font-size: 48px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.pdf-error {
    padding: 40px;
    text-align: center;
    color: #ef4444;
}
.pdf-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    margin-bottom: 10px;
}
.pdf-controls button {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pdf-controls button:hover {
    background: rgba(102, 126, 234, 0.3);
    color: #fff;
}
.pdf-controls span {
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
}
.file-preview-page {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.file-preview-page-header {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

/* Text Selection Highlighting */
.file-preview-content::selection,
.file-preview-content *::selection {
    background: rgba(102, 126, 234, 0.4);
    color: inherit;
}
.highlight-mode .file-preview-content {
    cursor: text;
    user-select: text;
}
.highlighted-text {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(52, 211, 153, 0.2) 100%);
    border-radius: 3px;
    padding: 2px 4px;
    margin: 0 -4px;
    border-left: 3px solid #10b981;
    display: inline;
    position: relative;
}
.highlighted-text::after {
    content: '×';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.highlighted-text:hover::after {
    opacity: 1;
}

.file-preview-footer {
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-preview-footer-info {
    font-size: 11px;
    color: #64748b;
}
.file-preview-footer-actions {
    display: flex;
    gap: 10px;
}
.file-preview-add-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.file-preview-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}
.file-preview-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.file-preview-add-all-btn {
    padding: 10px 20px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.file-preview-add-all-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    color: #fff;
}

/* File item with preview capability */
.studio-file-item.previewable {
    cursor: pointer;
    transition: all 0.2s ease;
}
.studio-file-item.previewable:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: rgba(102, 126, 234, 0.35);
    transform: translateX(4px);
}
.studio-file-item .file-preview-icon {
    margin-left: auto;
    color: #667eea;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    cursor: pointer;
    padding: 4px;
}
.studio-file-item .file-preview-icon:hover {
    color: #a5b4fc;
    opacity: 1;
}
.studio-file-item .file-delete-icon {
    color: #ef4444;
    opacity: 1;
    transition: opacity 0.2s ease, color 0.2s ease;
    cursor: pointer;
    padding: 4px;
    margin-left: 4px;
}
.studio-file-item .file-delete-icon:hover {
    color: #f87171;
}
.studio-file-item.previewable:hover .file-preview-icon {
    opacity: 1;
}
.studio-file-item .context-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    gap: 4px;
}
/* Show badge only when in-context AND active */
.studio-file-item.in-context .context-badge.active {
    display: inline-flex;
}
.studio-file-item .context-badge.full {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.studio-file-item .context-badge.full:hover {
    background: rgba(16, 185, 129, 0.3);
}
.studio-file-item .context-badge.partial {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}
.studio-file-item .context-badge.partial:hover {
    background: rgba(251, 191, 36, 0.3);
}
.studio-file-item.in-context {
    border-left: 3px solid #10b981;
}

/* Selected content preview styles */
.selected-content-preview {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 20px;
}
.selected-content-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    font-weight: 600;
    font-size: 13px;
}
.selected-content-text {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* Fade out animation for delete */
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-20px); }
}

