/* ============================================
   МОДАЛЬНОЕ ОКНО "ПРИКРЕПИТЬ ФАЙЛ"
   ============================================ */

.fcnc-file-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fcnc-file-modal.active {
    display: flex !important;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.fcnc-file-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.fcnc-file-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: fcnc-modal-slide-in 0.3s ease;
    z-index: 1;
}

@keyframes fcnc-modal-slide-in {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.fcnc-file-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.fcnc-file-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.fcnc-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.fcnc-modal-close:hover {
    color: #333;
}

.fcnc-file-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.fcnc-tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.fcnc-tab-btn:hover {
    background: #f0f0f0;
}

.fcnc-tab-btn.active {
    color: #667eea;
    background: #fff;
}

.fcnc-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.fcnc-file-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
    min-height: 300px;
    max-height: calc(90vh - 200px);
}

.fcnc-tab-content {
    display: none;
}

.fcnc-tab-content.active {
    display: block !important;
}

/* Фильтры и поиск */
.fcnc-modal-filters {
    margin-bottom: 20px;
}

.fcnc-modal-filters input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
}

.fcnc-modal-filter-row {
    display: flex;
    gap: 12px;
}

.fcnc-modal-filter-row select {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* Список файлов */
.fcnc-modal-file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    min-height: 200px;
}

.fcnc-file-item {
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.fcnc-file-item:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.fcnc-file-item.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.fcnc-file-icon {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.fcnc-file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    word-break: break-word;
    margin-bottom: 6px;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fcnc-file-size {
    font-size: 12px;
    color: #999;
}

/* Зона загрузки */
.fcnc-upload-zone {
    text-align: center;
    padding: 60px 40px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.fcnc-upload-zone:hover,
.fcnc-upload-zone.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.fcnc-upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
    color: #667eea;
}

.fcnc-upload-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin: 0 0 8px 0;
}

.fcnc-upload-text-or {
    font-size: 14px;
    color: #999;
    margin: 16px 0;
}

.fcnc-btn-select-files {
    padding: 14px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fcnc-btn-select-files:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.fcnc-upload-info {
    margin-top: 20px;
    font-size: 13px;
    color: #999;
    line-height: 1.6;
}

.fcnc-upload-info strong {
    color: #667eea;
    font-weight: 600;
}

/* Footer */
.fcnc-file-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.fcnc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fcnc-btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.fcnc-btn-secondary:hover {
    background: #d0d0d0;
}

.fcnc-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fcnc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.fcnc-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Загрузка */
.fcnc-file-loading,
.fcnc-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.fcnc-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: fcnc-spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes fcnc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

