/* File management styles */

/* ---------- File Upload Dialog ---------- */
.file-upload-dialog .dialog-container {
    max-width: 600px;
}

.file-upload-form {
    margin-top: 15px;
}

.file-upload-form input[type="file"] {
    display: block;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    margin-top: 5px;
}

/* Files list styles */
.files-list {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
}

.files-bulk-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.file-item, .user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background-color: var(--hover-bg);
}

.file-select-checkbox {
    margin-right: 10px;
}

.file-info {
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 0; /* Allows flex children to shrink below content size */
    overflow: hidden;
}

.file-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color); /* Ensure icon inherits theme text color */
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Ensure SVG icons properly inherit colors from parent */
.file-icon svg,
.file-actions button svg {
    fill: currentColor;
}

/* File attachment section icon styling */
.attachment-icon {
    width: 42px;
    height: 42px;
    margin-right: 15px;
    color: var(--text-color);
    padding: 8px;
    border-radius: 8px;
}

/* Make the attachment icons larger in the document attachment section */
.attachment-icon i.fa {
    font-size: 40px;
}

.attachment-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.file-name {
    font-weight: 500;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    margin-right: 10px;
    position: relative;
}

.file-name .name-text {
    display: block;
    width: 100%;
}

.file-name .name-edit {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95em;
}

/* Indicator for files mentioned in document - link icon on insert button */
.file-item.mentioned-in-doc .insert-file-btn {
    position: relative;
}

.file-item.mentioned-in-doc .insert-file-btn:before {
    content: '\f0c1'; /* FontAwesome link icon */
    font-family: 'FontAwesome';
    color: #4caf50;
    font-size: 0.7em;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Remove the checkmark after filename since we're using the button indicator */
.file-item.mentioned-in-doc .file-name:after {
    display: none;
}

.file-size {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-left: 10px;
}

.file-actions {
    display: flex;
    gap: 8px;
    padding-left: 12px;
}

.file-actions button,
.file-actions .download-file-btn {
    border: none;
    background-color: var(--hover-bg);
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    box-sizing: border-box;
    text-decoration: none;
    line-height: 1;
}

.file-actions button span,
.file-actions .download-file-btn span {
    display: none; /* Hide text labels */
}

.file-actions button:hover,
.file-actions .download-file-btn:hover {
    background-color: var(--border-color);
    color: var(--text-color);
    transform: translateY(-1px);
}

.file-actions button svg,
.file-actions .download-file-btn i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-actions .copy-url-btn:hover,
.file-actions .insert-file-btn:hover {
    color: var(--primary-color);
}

.file-actions .delete-file-btn:hover {
    color: var(--danger-color);
}

.file-actions .insert-file-btn {
    color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb, 0, 120, 210), 0.08);
}

.file-actions .insert-file-btn:hover {
    background-color: rgba(var(--primary-color-rgb, 0, 120, 210), 0.15);
}

.file-actions .delete-file-btn {
    color: var(--danger-color, #ff5252);
    background-color: rgba(255, 82, 82, 0.08);
}

.file-actions .delete-file-btn:hover {
    background-color: rgba(255, 82, 82, 0.15);
}

.file-actions .rename-file-btn, .file-actions .view-file-btn, .file-actions .download-file-btn {
    color: var(--text-color);
    background-color: rgba(var(--text-color-rgb, 128, 128, 128), 0.08);
}

.file-actions .rename-file-btn:hover, .file-actions .view-file-btn:hover, .file-actions .download-file-btn:hover {
    color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb, 0, 120, 210), 0.15);
}

/* File Attachments Section Styles */
.file-attachments-section {
    margin-top: 40px;
    margin-bottom: 30px;
    padding-top: 30px;
    padding-bottom: 30px;
    border-top: 1px solid var(--border-color);
    display: none; /* Hidden by default, shown when files exist */
}

.file-attachments-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    color: var(--text-color);
    font-weight: 600;
    position: relative;
    padding-left: 34px;
}

.file-attachments-section h3:before {
    content: "\f0c6"; /* Font Awesome paperclip icon */
    font-family: "FontAwesome";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    font-size: 20px;
    color: #777777;
    display: flex;
    align-items: center;
}

:root[data-theme="dark"] .file-attachments-section h3:before {
    color: #bbbbbb;
}

.file-attachments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.attachment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-hover);
    color: var(--primary-hover);
}

.attachment-item:hover .attachment-icon,
.attachment-item:hover .attachment-name,
.attachment-item:hover .attachment-size {
    color: var(--primary-hover);
}

.attachment-item:hover svg {
    fill: var(--primary-hover);
}

.attachment-info {
    flex-grow: 1;
    overflow: hidden;
}

.attachment-name {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
    font-size: 1.1em;
}

.attachment-size {
    font-size: 0.85em;
    color: var(--text-secondary);
    display: inline-block;
    padding: 2px 8px;
    background-color: var(--hover-bg);
    border-radius: 12px;
}

.loading-message, .no-files-message {
    grid-column: 1 / -1;
    padding: 25px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    background-color: var(--hover-bg);
    border-radius: 8px;
}