/* 多媒体选择器样式 */

.media-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.media-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.media-picker-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    height: 80%;
    max-height: 700px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.media-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.media-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.media-picker-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.media-picker-close:hover {
    color: #333;
}

.media-picker-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.media-picker-search input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
    font-size: 14px;
}

.btn-upload {
    display: inline-block;
    padding: 8px 20px;
    background: #4CAF50;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-upload:hover {
    background: #45a049;
}

.media-picker-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.media-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.media-file-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    background: white;
}

.media-file-item:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.media-file-item.selected {
    border-color: #4CAF50;
    background: #f1f8f4;
}

.media-file-preview {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.media-file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.file-icon {
    font-size: 48px;
}

.media-file-info {
    text-align: center;
}

.media-file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.media-file-meta {
    font-size: 12px;
    color: #999;
}

.media-file-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #4CAF50;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.media-file-item.selected .media-file-check {
    display: flex;
}

.media-picker-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

.media-picker-pagination {
    display: flex;
    align-items: center;
    gap: 15px;
}

.media-picker-pagination button {
    padding: 6px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.media-picker-pagination button:hover:not(:disabled) {
    background: #f5f5f5;
}

.media-picker-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.media-picker-actions {
    display: flex;
    gap: 10px;
}

.btn-cancel, .btn-select {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-select {
    background: #4CAF50;
    color: white;
}

.btn-select:hover:not(:disabled) {
    background: #45a049;
}

.btn-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading, .error, .empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.error {
    color: #F44336;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .media-picker-container {
        width: 95%;
        height: 90%;
    }

    .media-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .media-file-preview {
        height: 80px;
    }

    .media-picker-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .media-picker-search input {
        width: 100%;
    }
}
